Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Deniz Dogan
On 18 Feb, 19:33, Jacob Kaplan-Moss wrote: > On Wed, Feb 18, 2009 at 12:24 PM, Deniz Dogan > wrote: > > I'm sorry about that, I meant something like this: > > > { 2008-01-02 : [Bike 1, Bike 2], > >  2008-02-09 : [Bike 7, Bike 4] } > > Well, you can'

Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Deniz Dogan
> { 'production_date' : 2008-01-02, >   'bikes' : [Bike 1, Bike 2], >   'production_date' : 2008-02-09, >   'bikes : [Bike 7, Bike 4] > > } I'm sorry about that, I meant something like this: { 2008-01-02 : [Bike 1, Bike 2], 2008-02-09 : [Bike 7, Bike 4] } I guess I didn't quite think that thr

Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Deniz Dogan
On 18 Feb, 19:08, Jacob Kaplan-Moss wrote: > On Wed, Feb 18, 2009 at 11:12 AM, Deniz Dogan > wrote: > > Let's say I have a model called Bike with a DateField called > > "production_date". Now I want to get all of the Bikes and group them > > by their

Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Deniz Dogan
Hi I'm having trouble understanding the new aggregation support in Django 1.1, and here is what I want to do: Let's say I have a model called Bike with a DateField called "production_date". Now I want to get all of the Bikes and group them by their production date. How would I do this in Django?

Question about templates

2009-02-15 Thread Deniz Dogan
Hi I'm developing a website which will have a small menu at the top which has a "login" link in it. However, if the user has already logged in, it should be a "logout" link instead. This menu is part of a base template which is extended in all of my other templates. So to for the templates to kn

Re: Unable to login (cookies not enabled?)

2009-01-06 Thread Deniz Dogan
On 5 Jan, 11:41, Deniz Dogan wrote: > On 5 Jan, 10:47, Deniz Dogan wrote: > > > > > Hi > > > I'm having trouble when using the AuthenticationForm in Django. It > > tells me that I haven't enabled cookies, even though I'm completely > > sure

Re: Unable to login (cookies not enabled?)

2009-01-05 Thread Deniz Dogan
On 5 Jan, 10:47, Deniz Dogan wrote: > Hi > > I'm having trouble when using the AuthenticationForm in Django. It > tells me that I haven't enabled cookies, even though I'm completely > sure that I have. I get this error: > > "Your Web browser doesn'

Unable to login (cookies not enabled?)

2009-01-05 Thread Deniz Dogan
Hi I'm having trouble when using the AuthenticationForm in Django. It tells me that I haven't enabled cookies, even though I'm completely sure that I have. I get this error: "Your Web browser doesn't appear to have cookies enabled. Cookies are required for logging in." I've tried restarting Dja

Joining models on M2M field

2008-12-30 Thread Deniz Dogan
Hi I have a user profile which has a many-to-many relationship to a model Level. The relationship is called "unlocked" and says which levels a specific user has unlocked. Now I wish to retrieve all the levels but "joined" with the user's unlocked levels, so that I get a QuerySet containing exactl

Re: Heavy database query (max 32 tables problem)

2008-07-19 Thread Deniz Dogan
l intersection of the > users' courses, not the union. > >   -- Scott > > On Fri, Jul 18, 2008 at 11:49 AM, Norman Harman <[EMAIL PROTECTED]> > wrote: > > > > > > > Deniz Dogan wrote: > > > Hey. > > > > I have a model Course and the

Heavy database query (max 32 tables problem)

2008-07-18 Thread Deniz Dogan
Hey. I have a model Course and then I have django.contrib.auth.models.User. Users and courses are related through M2M, so a user can register for many courses and a course can register multiple users. Now, given a potentially very long list of users, I want to retrieve all the courses for which a

Re: Dynamically setting a form's fields

2008-06-30 Thread Deniz Dogan
Thanks! On Jun 30, 9:28 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Try taking a look at > this:http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/conf... > > On Jun 30, 2:09 am, Deniz Dogan <[EMAIL PROTECTED]> wrote: > > > H

Dynamically setting a form's fields

2008-06-30 Thread Deniz Dogan
Hello. I'm trying to do what I like to call "dynamically set a form's field". I want the user to input a dictionary e.g. { 'intField' : 'int', 'strField' : 'str' } ...to the constructor of the form which will then create the fields 'intField' (forms.IntegerField) and 'strField' (forms.CharField

Re: Complex filtering

2008-06-23 Thread Deniz Dogan
Disregard this thread. Fixed it. Basically at first I was thinking "check so that X = True for all X", but instead I now check "check so that no X = False for all X". On Jun 23, 12:50 pm, Deniz Dogan <[EMAIL PROTECTED]> wrote: > Hello. > > I have a model Stu

Complex filtering

2008-06-23 Thread Deniz Dogan
Hello. I have a model Students and another one called Course. The basic structure is as follows: class Student(models.Model): name = models.CharField() courses = models.ManyToManyField(Course) class Course(models.Model): name = models.CharField() Now I want to have a query set of all t

Re: user profile is not getting saved in admin

2008-06-23 Thread Deniz Dogan
ere's a work around or best > practice way to handle it. I noticed in the docs stating to wrap > access to the user.get_profile() call around a try: except: and create > it if you get an error. But, I don't see how to do that simply in the > Admin system. > > On Jun 21, 3

Re: user profile is not getting saved in admin

2008-06-20 Thread Deniz Dogan
On 20 Juni, 05:26, "Gene Campbell" <[EMAIL PROTECTED]> wrote: > I have looked through the docs and search the group and web. Seems other's > are asking the question, but I haven't seen an answer yet. > > class UserProfile(models.Model): > country = models.ForeignKey(Country, core=True) >