Surprising filter results with ForeignKey('self')

2007-04-12 Thread Zak Johnson
I have a model which has a ForeignKey to itself, intended to mark duplicates similar to a bug/ticket-tracking system: class Bug(models.Model): name = models.CharField(maxlength=64) duplicate_of = models.ForeignKey('self', related_name='duplicates', null=True) def __str__(self):

Re: Help using rowcolor with cycle command

2007-02-01 Thread Zak Johnson
jeffhg58 wrote: > When I display a row, I am trying to display a row in a specific > color. > But, I am a bit confused as to how it should work within the cycle > command. > > Here is my line of code. > > {% for item in result %} > {{ item }}{% endfor %} If you want a new row for each "item",

Re: View didn't return an HttpResponse

2007-01-25 Thread Zak Johnson
[EMAIL PROTECTED] wrote: > It looks like it's because (as you said), I'm returning a string, in > the exception... so how do I do that? > > def add_song(request): > try: > f = open('/path/to/songs/'+ > request.FILES['song_file']['filename'], 'wb') # wb = write binary >

Re: For Loops

2007-01-16 Thread Zak Johnson
Mark Jarecki wrote: Replaced the dictionary in the views.py with a list and all was fine. Whoops, sorry; I saw a variable called "Date_List" and didn't notice it wasn't a list. Glad you were able to make things work. -Zak --~--~-~--~~~---~--~~ You received

Re: For Loops

2007-01-16 Thread Zak Johnson
Mark Jarecki wrote: I imagined replacing it with something like: {% for date in Date_List %} {{ Date_List.NotSureWhatToPutHere }} {% endfor %} Much like Python loop syntax: {% for date in Date_List %} {{ date }} {% endfor %} -Zak --~--~-~--~~~---~--~~

Re: Retreiveing a QSet from a Parent Table

2006-11-10 Thread Zak Johnson
Merric Mercer wrote: > Can anybody recommend an elegant way to achieve point this. I can > retrieve the qs with all the related brand records but I cannot work > out how to retrieve the query set whilst omitting the related initial > record. > > Currently I have. > > 1.

Re: QuerySet help

2006-10-24 Thread Zak Johnson
brad wrote: > When I am in "manage.py shell", I import the model Data and I > execute Data.objects.all(), what is returned to me are all of the > prices in the database table. Actually, that returns a list of Data instances. You've told Django (via the __str__ method in class Data) that it

Re: Template tags

2006-10-19 Thread Zak Johnson
Tool69 wrote: > The problem is that it's returning the first 10 blog entries, not the > 10 lasts. Make sure your blog.Post class has an inner Meta class with an ordering property. See: http://www.djangoproject.com/documentation/model_api/#ordering

Re: database querying

2006-10-19 Thread Zak Johnson
[EMAIL PROTECTED] wrote: > Is there a way to combine objects.filter with objects.latest ? objects.filter returns a QuerySet: Info.objects.filter(lab_id=100).latest('dtm_insert') -Zak --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Signal Code Failing - Can anybody see where I've gone wrong.

2006-10-19 Thread Zak Johnson
MerMer wrote: > I must be making some rookie mistake, but I can't work out why its not > working. The code fails to return anything for the line p_qs= > Promotion.objects.filter(id=promotion_id) and therefore the index on > the next line is out of bounds. > > def