Test the "contact.contactnumber_set.all" in a shell, I'm not sure 100% sure
on the syntax
On Fri, Nov 18, 2016 at 11:51 AM, 'David Turner' via Django users <
django-users@googlegroups.com> wrote:
> Thankyou for this, although for some reason it does not work.
> What other infromation would you ne
Thankyou for this, although for some reason it does not work.
What other infromation would you need to further advise me.
Thanks
On 18 November 2016 at 13:42, Vijay Khemlani wrote:
> In your model a contact may have multiple phone numbers (multiple
> Contactnumber instances with foreign key to t
In your model a contact may have multiple phone numbers (multiple
Contactnumber instances with foreign key to the same Contact instance) so
your question is a bit vague.
If you wanted to list all numbers for a given contact you could do
somethinkg like
{% for contact in practice.contacts.all %}
As still learning django I have a simple issue.
I have the following models:
class Contactnumber(TimeStampedModel):
phone_number = models.CharField(max_length=100, unique=True)
contact = models.ForeignKey(‘contacts.Contact')
class Contact(TimeStampedModel):
contact = models.CharFi
emplate_data["parents"] = Parent.objects.filter(student=id)
> > return render_to_response( template, template_data,
> > context_instance=RequestContext(request))
>
> > The template data is returning the data in the format:
> > [ , ]
>
> > Instead, I need
urn u'Parent : %s %s' % (self.first_name, self.last_name)
>
> > The method in my view currently looks something like this:
>
> > def get_parents( request, template )
> > id=request.GET['id']
> > template_data["parents"] = Parent.ob
>id=request.GET['id']
>template_data["parents"] = Parent.objects.filter(student=id)
> return render_to_response( template, template_data,
> context_instance=RequestContext(request))
>
> The template data is returning the
t; template_data["parents"] = Parent.objects.filter(student=id)
> return render_to_response( template, template_data,
> context_instance=RequestContext(request))
>
> The template data is returning the data in the format:
> [ , ]
>
> I think this because you return y
self.last_name)
The method in my view currently looks something like this:
def get_parents( request, template )
id=request.GET['id']
template_data["parents"] = Parent.objects.filter(student=id)
return render_to_response( template, template_data,
context_instance=Reques
On Friday 12 May 2006 10:32, Malcolm Tredinnick wrote:
> Now, slicing on QuerySets is used to provide SQL's offset and limit
> functionality. So evts[1:], which you have later on in the code
> translates (approximately) to SELECT ... FROM ... WHERE ... OFFSET 1.
> On the other hand, something lik
Rob Hudson wrote:
>What I'm not clear on is what ifchanged looks at. Does it look at the
>for loop and "event", or does it look at what's in the body of
>ifchanged? In this case the event.date_from?
>
>
It looks at the string between {% ifchanged %} and {% endifchanged %} no
matter how it
I actually went to the shell and looked at my evts with "dir(evts)" and
it looked like a simple list so I thought slicing would be no problem.
Thanks for explaining what was really going on.
-Rob
Malcolm Tredinnick wrote:
> I suspect we might be seeing this sort of question a bit now. You have
My inclination was it could be done with a lot less code. Thanks for
giving me this. The only thing I had to change was to put all() before
order_by b/c I got some error about all() not being a method of the
querySet (or something like that).
What I'm not clear on is what ifchanged looks at.
Rob Hudson wrote:
>def list(request):
>"""
>Sets up a list of tuples: (month, list of events)
>[("March", [, ]), ("April", [<>])]
>"""
>
>
Malcolm has answered your question but I want to add that with Django
templates you can do this thing much simpler without two nested loops
On Fri, 2006-05-12 at 01:33 -0700, Rob Hudson wrote:
> I think I'm making this harder than it should be. Could someone help
> me out here please? The gist is that I'm trying to display a list of
> events like the following. I'm getting the error "'offset' is not
> allowed without 'limit'" which
I think I'm making this harder than it should be. Could someone help
me out here please? The gist is that I'm trying to display a list of
events like the following. I'm getting the error "'offset' is not
allowed without 'limit'" which doesn't seem right. I'm thinking
someone will spot a much s
16 matches
Mail list logo