Deduping a queryset based on one field

2007-06-12 Thread bahund
I have a Searchlog model, and I'm trying to build a queryset of all unique searches ('searchstr' field). Using distinct() doesn't seem to work because the pk will always be different. Ideally, I'd like to use distinct() in a way where I could pass it the field I want to be unique, such as: quer

Order SelectField items

2007-01-04 Thread bahund
Hello, This is a simplified example of what I'm trying to accomplish. In my model I have the following objects and fields: class ColorAccount(models.Model): WINE_VARIETALS = ( (0, 'Red'), (1, 'Orange'), (2, 'Yellow'), (3, 'Green'), ... ) fav_colo

Order SelectField items

2007-01-04 Thread bahund
Hello, This is a simplified example of what I'm trying to accomplish. In my model I have the following objects and fields: class ColorAccount(models.Model): COLORS = ( (0, 'Red'), (1, 'Orange'), (2, 'Yellow'), (3, 'Green'), ... ) fav_color = mode

Re: Order SelectField items

2007-01-04 Thread bahund
I solved this by sorting the tuple of tuples outside of the add/create custom manipulators, then using that sorted list instead of ColorAccount.COLORS: col_list = list(ColorAccount.COLORS) col_list.sort(lambda x, y: cmp(x[1], y[1])) col_tuple = tuple(col_list) And then: forms.Selec

syncdb capabilities

2006-06-06 Thread bahund
I understand that the "manage.py syncdb" command should create any non-existant tables, but should it also update any individual fields that have been added to a model/table? If the answer is no, which is what I'm seeing, any suggestions on making changes to the model fieldsets other than droppin

Re: syncdb capabilities

2006-06-06 Thread bahund
Thanks Adrian, I appreciate the speedy response ... and that all makes sense for the time being. Keep up the good work over there! bahund --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Mark user as 'already voted' in polls app

2006-06-26 Thread bahund
I'm in the same boat as well, where I'll have logged in users as well as anonymous users, and each user will only be allowed to submit each poll once. I haven't figured out how to handle the anonymous users yet (I'll stay tuned to this thread), but I may be able to suggest a way to handle it in t

Null foreign key, is this possible?

2006-06-27 Thread bahund
Hi, I have the following model which has a foreign key field that I would like to be null at times: class Car(models.Model): make = models.CharField(maxlength=100, core=True) model = models.CharFeild(maxlength=100, core=True) date = models.DateTimeField(auto_now_add=True) forum =