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):
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",
[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
>
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
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
--~--~-~--~~~---~--~~
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.
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
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
[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
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
10 matches
Mail list logo