|
I'm having some trouble figuring out how to update the user table with Django 1.2. I've created my own custom form:code:
code:
|
# ? Jul 23, 2010 11:41 |
|
|
# ? Jun 5, 2024 06:38 |
|
does anyone know how to create a signal for all inherited model classes?code:
|
# ? Jul 26, 2010 12:03 |
|
nbv4 posted:does anyone know how to create a signal for all inherited model classes? What's wrong with this? You could even use range and getattr if the naming scheme just uses numbers like that. code:
|
# ? Jul 26, 2010 15:58 |
|
Jonnty posted:What's wrong with this? You could even use range and getattr if the naming scheme just uses numbers like that. eh I don't really like that because if I add a new SpecificModel later on and forget to add it to the list, it could potentially lead to hard to catch errors. What I ended up doing was modifying the save() method on the GenericModel. I'd still rather use signals, but eh.
|
# ? Jul 26, 2010 18:05 |
|
You might be able to achieve what you want using a metaclass to register the signal.
|
# ? Jul 26, 2010 21:31 |
|
Anybody know what might cause all email messages sent via Django to go to a users spam filter? This would include both messages sent via send_mail() and password reset emails. More of a generic, non-Django question I suppose, but hopefully somebody has come across it.
|
# ? Aug 2, 2010 23:40 |
|
Ferg posted:Anybody know what might cause all email messages sent via Django to go to a users spam filter? This would include both messages sent via send_mail() and password reset emails. More of a generic, non-Django question I suppose, but hopefully somebody has come across it. Depending on the email take a look at the headers that the provider added. Some add score to tell you why it went like that. Could be the return path, could be that you don't have SPF set up, etc...
|
# ? Aug 3, 2010 00:35 |
|
Hughlander posted:Depending on the email take a look at the headers that the provider added. Some add score to tell you why it went like that. Could be the return path, could be that you don't have SPF set up, etc... This is the best I could gather (via Gmail). The domain name is swapped to be myapp.com: code:
|
# ? Aug 3, 2010 03:58 |
|
Ferg posted:This is the best I could gather (via Gmail). The domain name is swapped to be myapp.com: I'd just set up SPF, send another mail through G-Mail to confirm it worked and call it a day... What you're looking to see is: Received-SPF: pass (google.com: domain of support@myapp.com designates 173.203.223.116 as permitted sender) client-ip=173.203.223.116; Authentication-Results: mx.google.com; spf=pass (google.com: domain of support@myapp.com designates 173.203.223.116 as permitted sender) smtp.mail=support@myapp.com
|
# ? Aug 3, 2010 14:40 |
|
I'm moving my my Django portfolio site to a Wordpress site merely because I don't need Django to do it, and Wordpress can achieve everything I'd want with the site out of the box. Not dissing Django, just not necessary for my needs. Anyways, my problem: I used this tutorial (http://www.nerdydork.com/setting-up-django-on-a-whm-cpanel-vps-liquidweb.html) to setup my website. It had me doing that wonky creating a .conf for my website and running a Cpanel script that adds the conf file into the Apache installtion. I understand what it's doing, but that's not my issue. My issue is that I want to get rid of that item that sends all of my traffic from the root of my domain via the wsgi script, and instead revert back to its regular functionality. Aside from recreating my account on my webserver (it's my own dedicated with full root access, so that's not an issue), how can I easily stop the whole relaying thingy mabober. This may be suited for a different topic, but figured someone else may have this problem.
|
# ? Aug 7, 2010 02:22 |
|
Quick, register for Django Dash http://djangodash.com/ Registration closes Saturday! Competition starts next Friday!
|
# ? Aug 7, 2010 03:48 |
I'm having trouble finding the right thing to test. It's a business rule that a Foo is allowed to have many Bars. However, any real test of that would basically just be testing Django's One-to-many manager on the Foo object. Is this a reasonable test? I can't think of a better way to make sure the framework corresponds to a business requirement. code:
|
|
# ? Aug 13, 2010 01:38 |
|
Honestly, that's not something I'd bother to test. Test that the views that add it (or where it comes from, unless it's the admin) work. Testing that you actually wrote code:
|
# ? Aug 13, 2010 02:03 |
Yeah, that's what I figured. Thanks!
|
|
# ? Aug 13, 2010 02:25 |
|
For models, the only thing I test are additional methods or manager that are added. No reason to test the basics of the models themselves
|
# ? Aug 13, 2010 23:41 |
|
How can I pull an inline admin form value out from within a template? I'm customizing the TabularInline template for a UserPhoto's model so that administrators can see the photo on the admin site. However, that requires me to construct a URL dynamically which includes the User ID (foreign key) for a UserPhoto object. I've found an 'inline_admin_form.fk_field' object but can't find documentation on actually getting the value, only the name of the field (via label_tag).
|
# ? Aug 16, 2010 15:58 |
|
I resisted Pinax for the longest time because i didn't think I needed it. I just started playing around with it and i can easily say it is amazing. If you havn't tried it out yet you should.
|
# ? Aug 20, 2010 02:08 |
|
I have a strange question that's really making me go insane. I'm using Django for an internal web app I'm developing for my company. This app is going to be for managing metadata about high quality scanned magazine pages sitting on a NAS with 16TB of capacity. I have that NAS mounted as a share on my web server. I can access it fine. When I "su" to the apache user the apache user can access it fine. I'm implementing my import process for that material, but I'm having a really annoying issue. When I do this: code:
This only happens when httpd is serving my Django app which means that I've built this drat thing. I know it works. I've tested it, but it doesn't work in a production setting. I realize it's odd I'm doing this, but my system has to be able to allow end users to choose which files from the NAS are imported into the system. I'm not trying to serve that directory through apache. I'm just using os.listdir to populate a bunch of javascript selector boxes that allow the user to choose what to import. I'm not moving 16TB of images to the web server when the whole point of this system is to allow people to work with the data from that NAS without waiting 2 minutes to flip between pages. I'm running Django 1.3 alpha on CentOS 5 through mod_python on Apache 2.2.3. ErIog fucked around with this message at 23:03 on Aug 23, 2010 |
# ? Aug 23, 2010 23:00 |
|
hrm does:code:
|
# ? Aug 24, 2010 00:31 |
|
king_kilr posted:hrm does: I'll try that, but I really would like to avoid doing that if at all possible. There's something that feels so unclean about parsing ls output.
|
# ? Aug 24, 2010 01:13 |
|
ErIog posted:I'm running Django 1.3 alpha on CentOS 5 through mod_python on Apache 2.2.3. You know, I hate to be that guy but, have you tried mod_wsgi? I had no end of problems with mod_python and I'd highly suggest you evaluate it as an option, if you can.
|
# ? Aug 24, 2010 04:45 |
|
Captain Capacitor posted:You know, I hate to be that guy but, have you tried mod_wsgi? I had no end of problems with mod_python and I'd highly suggest you evaluate it as an option, if you can. Yeah, I'll look into it. I've decided my dev environment probably isn't suitable for the production system anyway. Apache + mod_python generally feels sluggish compared to even the manage.py runserver command. I played around with moving everything over to Fedora + nginx. So switching to mod_wsgi isn't a big deal compared to that. I like the idea of CentOS, but it's the most annoying thing in the world to know there's a feature or fix for some issue that is nigh on impossible for you to utilize since you're lagged behind like a year for all packages. Update!: It's a good thing you were that guy. I did not go with your mod_wsgi recommendation, but I did get my stuff to work. On a lark I did "yum search nginx", and found a version of nginx in the EPEL CentOS 5 repo. I installed it, configured it, and it runs my script beautifully. It's so much faster and cleaner than apache + mod_python. ErIog fucked around with this message at 17:26 on Aug 24, 2010 |
# ? Aug 24, 2010 05:09 |
|
ErIog posted:Yeah, I'll look into it. I've decided my dev environment probably isn't suitable for the production system anyway. Apache + mod_python generally feels sluggish compared to even the manage.py runserver command. To be another "that guy", you could also try just using gunicorn. It's a lot faster to set up than nginx (not that nginx is hard to set up) and it's just a Python package so you don't have to worry about CentOS being lagged or not.
|
# ? Aug 25, 2010 07:00 |
|
MonkeyMaker posted:To be another "that guy", you could also try just using gunicorn. It's a lot faster to set up than nginx (not that nginx is hard to set up) and it's just a Python package so you don't have to worry about CentOS being lagged or not. You shouldn't be using gunicorn in place of nginx, you should use it in addition to nginx in replacement of mod_wsgi.
|
# ? Aug 25, 2010 07:16 |
|
king_kilr posted:You shouldn't be using gunicorn in place of nginx, you should use it in addition to nginx in replacement of mod_wsgi. People respond better if you tell them why something is instead of just dictating it GUnicorn is intended to be used behind a "real" Web server that is better able to handle actual browser-based clients, such as Apache or NginX. GUnicorn's design is such that it assumes the clients speaking to it will be fast -- see GUnicorn's design doc and also the PHILOSOPHY document for the original Unicorn project. So while yes, it does speak HTTP, it's supposed to be paired up with some sort of general-purpose frontend server and not run standalone.
|
# ? Aug 25, 2010 15:28 |
|
more like GOONicorn
|
# ? Aug 25, 2010 18:27 |
|
king_kilr posted:You shouldn't be using gunicorn in place of nginx, you should use it in addition to nginx in replacement of mod_wsgi. Yeah, sorry for the confusion. I wasn't thinking. Gunicon for Python, nginx for images/css/js/etc.
|
# ? Aug 25, 2010 22:36 |
|
Is there a handy overview to generic views? The docs have a detailed reference page which links to a "overview" the entirety of which is a link back to the reference page. EDIT: Are Django "views" are really controllers from MVC? It seems like all the presentation aspects are handled by the template. wins32767 fucked around with this message at 14:36 on Sep 10, 2010 |
# ? Sep 10, 2010 13:41 |
|
wins32767 posted:Is there a handy overview to generic views? The docs have a detailed reference page which links to a "overview" the entirety of which is a link back to the reference page. That looks like a bug in the documentation; there is no separate "topic guide" page for generic views. The page you're looking at is it. That said, in my opinion generic views aren't really that useful. About the only thing I use them for is when I'm stubbing out my views when first building an app, since just about any app is going to have the usual list/detail views for its models and generic views get you about 80% of the way there with very little work (you still have to write the template of course). The thing is though, once you start to actually put the finishing touches on your app and implementing all your features you end up having to wrap the generic views anyway so you might as well just rewrite the view yourself. RE: the MVC thing, my understanding is that in Django-think the framework itself is the controller. See this FAQ.
|
# ? Sep 10, 2010 14:55 |
|
Lamacq posted:That looks like a bug in the documentation; there is no separate "topic guide" page for generic views. The page you're looking at is it. That said, in my opinion generic views aren't really that useful. About the only thing I use them for is when I'm stubbing out my views when first building an app, since just about any app is going to have the usual list/detail views for its models and generic views get you about 80% of the way there with very little work (you still have to write the template of course).
|
# ? Sep 10, 2010 14:57 |
|
That's the way I've seen it, the views are the controllers.
|
# ? Sep 10, 2010 14:59 |
|
wins32767 posted:Is there a handy overview to generic views? The docs have a detailed reference page which links to a "overview" the entirety of which is a link back to the reference page. Not to toot any horns I may own, but I did a screencast (as part of a series) over Generic Views the other day. You can watch it here if you want.
|
# ? Sep 10, 2010 21:11 |
|
they're most likley going to redo the generic views for 1.3 to be class based, which will make them approximately 3459864578346% less useless.
|
# ? Sep 11, 2010 01:08 |
|
nbv4 posted:they're most likley going to redo the generic views for 1.3 to be class based, which will make them approximately 3459864578346% less useless.
|
# ? Sep 11, 2010 14:49 |
|
The vids from djangocon 2010 are up. Good quality videos this year and some pretty interesting talks.
|
# ? Sep 15, 2010 13:26 |
|
I'm repeating myself in some form validation code for separate forms that use some of the exact same fields. Is the accepted way to solve this problem to define the validation function outside of the forms, have the clean_field_x() function in the form class do nothing, then override __init__ and after calling the superclasse's __init__ assign self.clean_field_x to the shared validation function? Is there a better way? edit: duh, define clean_field_x in a superclass Sock on a Fish fucked around with this message at 18:02 on Oct 4, 2010 |
# ? Oct 4, 2010 17:46 |
|
This is kind of a dumb question, I suspect, but it's been driving me nuts (and I'm probably missing something obvious). I have a model that essentially represents an audit trail of checkins by a system. The name of the system, IP of the system, and the date/time the system checked in are recorded. We frequently want to reference the most recent "heartbeat" or check-in per-system. I can do this: code:
What I am going nuts trying to do is include the ip_address field in that resultset. If that query generates something (like) code:
That is, code:
(for reference, the schema I'm dealing with is fixed, so as a constraint, I cannot add, change, or remove fields).
|
# ? Oct 6, 2010 03:32 |
|
No, postgres (and the SQL standard AFAIK) requires that any non-aggregate listed in the select clause must also appear in the group by clause.
|
# ? Oct 6, 2010 03:48 |
|
So my latter query succeeds due to a deficiency in MySQL then :\ http://dev.mysql.com/doc/refman/5.1/en/group-by-hidden-columns.html Yay. So what might be a better solution? Also assume that I have a site model that relates to the sitemonitoring model by the site_name field, but is not defined as an explicit foreign key (existing legacy schema, Django grafted on top). Since the schema is managed outside DJango, can Iie to Django and make sitemonitoring.site_name a foreign key to site.site_name? I would like to try to avoid joins (but can cope) as the DB is MySQL NDBCLUSTER, which will execute joins but can take a significant perf penalty for doing so. We end up doing a lot of ugly denormalization to work around that :\
|
# ? Oct 6, 2010 04:14 |
|
|
# ? Jun 5, 2024 06:38 |
|
What am I doing wrong? I just want to select stuff after a certain date:code:
*edit* Found the __lte functionality. Trying to get my time in that format... Hopefully it works Doh004 fucked around with this message at 18:46 on Oct 13, 2010 |
# ? Oct 13, 2010 18:31 |