hi,
I know this is probably easy, but ...
I have a category model:
class Category(models.Model):
name = models.CharField(max_length=100, unique=True)
slug = models.SlugField(max_length=100, unique=True)
parent = models.ForeignKey('self',blank=True,null=True)
...
the view function that browses categories should return a list of sub-
categories based on receiving the slug field of the parent value.
however, the parent is set to the id value, not the slug.
How do I associate the parent with the parents slug?
my view currently looks like this:
def category(request, myslug):
category_list = get_list_or_404(Category, parent=myslug)
return render_to_response('listings/browse.html',
{'category_list': category_list})
this expects the parents id in myslug, I obviously need the parents
slug.
any help appreciated, thanks.
(using django 1.0)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---