Hi, any idea how to construct my get_absolute_url (
127.0.0.1:8000/category-slug/id-slug-post)
for example i have my models like this
class Category(...):
    name = CharField(....)
    slug = SlugField(.....)

class MyModel(modesl.Model):
    post = models.CharField(....)
    slug = models.SlugField(.....)
    categories = models.ManyToMany(Category)

   def get_absolute_url(self):
       return "/%s/%s-%s/" % (self.categories.slug, self.id, self.slug)

  #error 'ManyRelatedManager' object has no attribute 'slug'
  in self.categories.slug


i would like this url in my page
127.0.0.1:8000/category-slug/id-slug-post

example
http://mydomain.com/food-green/120-one-hundry-food-green
          domain.com / category slug   / pk - (dash) post slug

the problems is for my get_absolute_url  see, one post have multiple
category
the error is:
'ManyRelatedManager' object has no attribute 'slug'

what is the best way to do this?

any idea?

Cheers

-- 
att.
Carlos Rocha

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM-7rO0wbik3zq5Tj_Fc9dhQNASnLd%2Bx5mA4Xp%3DAzkKyPS%2BQtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to