|
Why are you creating the join table yourself instead of just using a ManyToManyField? EDIT: If the reason you are doing it is to add extra fields to the join table look at the through kwarg on M2M Fields.
|
# ¿ Sep 5, 2008 16:34 |
|
|
# ¿ May 16, 2024 02:35 |
|
Also, it should br primary_key = True; not 'True', one is a string, the other is a bool.
|
# ¿ Sep 6, 2008 19:18 |
|
DjangoCon videos are starting to come out: http://www.youtube.com/results?search_query=djangocon&search=tag
|
# ¿ Sep 15, 2008 23:53 |
|
Django doesn't have "negative filters" so there is no not equal filter, or not in, you just use excluse instead of filter.
|
# ¿ Oct 4, 2008 16:24 |
|
Munkeymon posted:I'm trying to add content from the blog app in my project to templates rendered by the main project and I don't think I'm doing it the best way. Right now, I have a view on the main app calling a view on the blog that renders a post using a template and returns the result wich I dump into the main page context. My concern is that the blog post is being rendered whether or not it is being displayed, but I don't know of a better way to do this and keep the template under the control of the blog app which (as I see it) is where it belongs. I would do an inclusion tag(look for that in the doc), or do something like this: http://www.b-list.org/weblog/2006/jun/07/django-tips-write-better-template-tags/
|
# ¿ Oct 9, 2008 22:46 |
|
nbv4 posted:I've been developing a PHP webapp for the past year or so. It's working fine right now, but when I started the project, I didn't really know that much about web development, so it didn't get a very good foundation to start on. A year later, everything works, but the code is a clusterfuck. There are certain things I'd like to change about my app, but since the code is so unorganized, it'll take forever. I'd check out James Bennet's Practical Django projects, the code is NOT fully up to date with 1.0, but most of it will work unchanged, and it does exactly what you want.
|
# ¿ Oct 13, 2008 01:34 |
|
bitprophet posted:Guess it depends on what exactly you need to do with those values on the query side of things, but it could be an OK choice, nothing obviously wrong with it that I can see. Congrats! How is pbx doing? I remember hearing he was in a bad car accident over the summer.
|
# ¿ Oct 30, 2008 23:19 |
|
Just looked through the index for your book, and I have to say the examples sound really cool, I can't wait to check it out.
|
# ¿ Oct 31, 2008 03:10 |
|
Just started blogging(thanks to a bunch of Django people for yelling at me), here's my first post: http://lazypython.blogspot.com/2008/11/lazy-user-foreign-keysthis-is-double.html Let me know what you guys think.
|
# ¿ Nov 4, 2008 01:19 |
|
Wulfeh posted:I was under the impression that class Meta ordering was "bad", something to do with inheritance, I forget. It was something mentioned by David Cramer at djangocon. Does anyone remember the exact reason why? If I recall correctly he was running into something where it was lreading to ordering a huge dataset where it wasn't necessary.
|
# ¿ Nov 7, 2008 07:42 |
|
FYI, reverse often appears slow, but it's cached, so it's not a big performance issue(compared to all the other things that can be slow in a request).
|
# ¿ Nov 14, 2008 00:49 |
|
I think you mean to be using model formset factory, instead of formset factory.
|
# ¿ Nov 17, 2008 03:33 |
|
WickedMetalHead posted:Does unique_for_month still work? Right now, in model forms, the only thing that's validated is unique, and unique together(I'm the guy who wrote that). Properly validating for everything isn't going to happen until 1.1, when ticket #6845 get's fixed, that ticket is model validation, and amongst other things it will handle propogating all validation on the model to the form level.
|
# ¿ Nov 20, 2008 01:21 |
|
nbv4 posted:Does anyone have any experience using django-tagging with django 1.0? Is it stable? or alternatively a tagging system that works well with 1.0? yeah it should work fine, you need to use the newforms-admin branch though.
|
# ¿ Nov 20, 2008 17:35 |
|
bitprophet posted:Is there some sort of neo-newforms-admin that continues to exist/be relevant post-1.0? Not nfa within django itself, but the nfa branch on django-tagging, it just hasn't been updated yet I guess.
|
# ¿ Nov 20, 2008 23:31 |
|
Murodese posted:How do I stop recursive foreign keys from being able to choose themselves? I don't want a category to be able to pick itself as its parent :V I'd just create a custom model form for use in the admin and elsewhere that has a clean_<my_fkey> method which throws a validation error if cleaned_data['my_fkey'] == self.model.id
|
# ¿ Nov 23, 2008 06:48 |
|
To the gentleman who wanted to have a view that combined querysets of different types that had a few common fields, I wrote a blog post about it today, hope it's helpful, here
|
# ¿ Nov 25, 2008 01:46 |
|
No Safe Word posted:So Adrian and company are working on an updated Django Book, and the work-in-progress is online for everyone to see like last time, yay! James Bennet also announced(officially) that he's working on a 2.0 of Practical Django Projects. Also, for those who haven't been following 1.1, there is going to be a crapton of new, awesome, stuff, I've been helping out with some of it and it's going to be awesome
|
# ¿ Jan 9, 2009 17:05 |
|
Well aggregation is really nice, I love the API on it. Model validation is going to be a huge boon for people who want it just because there wasn't an easy workaround for those that needed it before(you could always write raw SQL). Plus bulk-editing stuff on the changelist actually looks great and can be a huge help for what should be simple tasks(for example making a BooleanField editable from there and just using it to enable stuff en masse). Of course I've been following all of these, coded 1 myself, and provided a bit of assistance on the others, so I might be biased
|
# ¿ Jan 9, 2009 17:52 |
|
mwarkentin posted:Any idea if the read-only admin fields are going to make it in? Possible, it's already possible to do in your own code though: http://lazypython.blogspot.com/2008/12/building-read-only-field-in-django.html
|
# ¿ Jan 9, 2009 21:50 |
|
FYI aggregates: http://code.djangoproject.com/changeset/9742
|
# ¿ Jan 15, 2009 17:35 |
|
For those who are interested EuroDjangoCon registration is now open here: http://euro.djangocon.org/ . I've submitted a talk proposal on some advanced forms techniques.
|
# ¿ Feb 11, 2009 21:10 |
|
2 pieces to the puzzle, 1 a management command for the script itself, 2 python lockfile for the lock: http://pypi.python.org/pypi/lockfile
|
# ¿ Feb 19, 2009 15:36 |
|
deimos posted:As a sidenote, what's the state of django on Windows? I haven't tried it at all. I need to connect to SQL Server and last I checked the only reliable way was running django on Windows through Apache and mod_python. On the MSSQL front django-pyodbc and django-mssql are both decent, though I don't know which is actually better.
|
# ¿ Feb 20, 2009 14:01 |
|
Mashi posted:Anyone got any recomendations for database schema migration tools for Django? Anyone use and are happy with it? I'm talking about the sort of tool that allows me to type "manage.py evolvedb" and it will print SQL to sync the differences between the models and the DB structure. I like django-evolution: http://code.google.com/p/django-evolution/ south is also popular: http://south.aeracode.org/
|
# ¿ Feb 20, 2009 15:45 |
|
code:
|
# ¿ Feb 20, 2009 23:17 |
|
bitprophet posted:Sorry...it does it's actually just 376 pages of bad slash fanfiction starring Django Reinhardt and his pet snake. Somehow I imagine m0nk3yz jumping straight up to Marty's book within a week.
|
# ¿ Mar 13, 2009 00:27 |
|
m0nk3yz posted:Also, if anyone knows anyone, I'm looking for a senior-or-higher level web person, preferably someone with Django experience. (in MA) You could try luring Doug Napoleone away from his job, I don't think he gets to do Python by day
|
# ¿ Mar 13, 2009 03:41 |
|
Ansible posted:Wow, I love Django already. Never programmed in Python before, but was able to setup a linux VM and blow through the OP in under two hours. There are a few changes besides __unicode__ in 1.0 but they weren't a big deal. Be sure to read the official docs/tutorial, they really are great (I feel like I say this alot).
|
# ¿ Mar 20, 2009 22:19 |
|
Lamacq posted:Wait, what? I am a django newb and for my first app I've been using render_to_response() b/c that's what the tutorial does. I'll go back to the docs again (I've been spending a LOT of time with the django docs over the past couple weeks) and look for that stuff, but can you give me the 30 second elevator pitch on why I should use template.render(context) and what are context_processors?? You're fine using render_to_response I think he meant it in the reverse. context processors are basically a way to have a "global" template variable. So say you want a logic form on every page you could put it in a template context processor so every single view didn't have to provide it.
|
# ¿ Mar 21, 2009 02:14 |
|
No Safe Word posted:And I could have sworn there was some sort of RequestContext middleware that either shipped with Django at some point or was on their code.djangoproject.com wiki somewhere that did this for every response automatically but I'll be damned if I can't find it. I don't want to reimplement it half-assed if it's already out there, but I can. Are you takling about this: http://www.djangosnippets.org/snippets/3/
|
# ¿ Mar 21, 2009 04:19 |
|
Ansible posted:There was a few other differences as well, such as the new admin.py, maxlength renamed to max_length and prepopulated fields being defined in admin.py I believe we have a full listing here: http://docs.djangoproject.com/en/dev/releases/1.0/
|
# ¿ Mar 21, 2009 22:13 |
|
Ansible posted:Yup that is what I used. Yep, and if it's editing multiple models of the same type there take a look at formsets.
|
# ¿ Mar 24, 2009 00:55 |
|
duck monster posted:Keep in mind the relational stuff does, as far as I'm aware, the joins at the python side rather than the mysql side. What? There's just no basis for what you just said. Django preforms normal SQL queries with joins. If you want to use views you can use the new managed option on models.
|
# ¿ Mar 24, 2009 13:11 |
|
bitprophet posted:Well, as king_kilr said, check out the new 'managed' option for models: Indeed, anything in trunk makes it's way into the release. The Django policy isn't to branch for a release after feature freeze, it's to wait until the the release is done before committing any new features.
|
# ¿ Mar 24, 2009 20:43 |
|
Write a template filter/tag to let you do simple operations on a queryset in the template will be the easiest way.
|
# ¿ Mar 25, 2009 20:20 |
|
if the issue is not having a django settings file you can always do: from django.conf import settings settings.configure(MY_SETTING=value, OTHER_SETTING=value) To set up the right settings for there, because what you're seeing is django's internationalizating framework, you can probably coerce them to strings with just: settings.configure(USE_I18N=False)
|
# ¿ Mar 26, 2009 16:12 |
|
Ansible posted:I agree. Is there a good source for best practices in django development? My entire site is just one app, but I'm considering splitting it up into functional areas based on related tables/models. Read anything james bennet writes(see his DjangoCon video on youtube on reusable applications) his look, Practical Django Development is also good.
|
# ¿ Apr 1, 2009 20:39 |
|
Mashi posted:Anyone have a preferred method for storing additional profile data against users? Using a user profile makes the account creation / editing forms a bit messy. Anyone had success subclassing User, or know a nice way to do the forms for a User with a custom profile? Just use a user profile model, that's how it's done. Needing to hook up a signal reciever and handle 2 ModelForm's isn't difficult, it's like 10 lines of code.
|
# ¿ Apr 7, 2009 17:24 |
|
|
# ¿ May 16, 2024 02:35 |
|
m0nk3yz posted:Man if only we had an example Yes, if only
|
# ¿ Apr 7, 2009 19:02 |