Re: How do I manage the order of related objects?

2009-01-17 Thread scelerat
On Jan 15, 2:44 am, Beres Botond wrote: > And I'm not sure why you need the order, since they will be already > ordered by primary key (the most recent activity part added will have > highest primary key), and you can just use that. I need to keep track of the order explicitly because I may w

How do I manage the order of related objects?

2009-01-14 Thread scelerat
I've got a part/collection pairing of objects tables, and I'd like to know the best way to manage the order of things inside the table. Briefly: class Activity(models.Model): # etc... class ActivityPart(models.Model): order = models.IntegerField("order in parent", default=1) a

Re: How does django.contrib.auth.views.login work?

2009-01-14 Thread scelerat
On Jan 9, 9:16 am, Brian Neal wrote: > If you use RequestContext and have the settings in your > TEMPLATE_CONTEXT_PROCESSORS, then the user variable will be available > for use in your templates. Check out: > > http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-c... I just wan

How does django.contrib.auth.views.login work?

2009-01-09 Thread scelerat
Hi, I'm new to Django and am trying to figure out how to make authentication work in any view. First off, I have a base template which has a conditional like this: {% if user.is_authenticated %} Yay! {% else %} Boo. {% endif %] In an accounts/urls.py, I add a line like this: urlpatterns = patt

Re: Ordering a ManyToManyField with "through" relation

2008-12-02 Thread scelerat
I'm coming late to this thread -- this example is exactly what I was looking for, so thanks for posting this. I'm doing something where I want admins to be able to define an arbitrary number of Collections which are just different orderings and combinations of a (relatively) small set of Things.