Re: any idea for get_absolute_url in m2m categories

2017-02-20 Thread carlos
thank Melvyn :) i understands right now! On Mon, Feb 20, 2017 at 9:24 AM, Melvyn Sopacua wrote: > On Monday 20 February 2017 08:39:07 carlos wrote: > > > Hi, Melvyn yes i use similar but for the question is > > > the best way? > > > > > > def get_absolute_url(self): > > > > > > return '/%s/%s-%s

Re: any idea for get_absolute_url in m2m categories

2017-02-20 Thread Melvyn Sopacua
On Monday 20 February 2017 08:39:07 carlos wrote: > Hi, Melvyn yes i use similar but for the question is > the best way? > > def get_absolute_url(self): > > return '/%s/%s-%s/' % (self.categories.all()[0].slug, self.id, > self.slug) #this way a take first category, but other best way to do > that

Re: any idea for get_absolute_url in m2m categories

2017-02-20 Thread carlos
Hi, Melvyn yes i use similar but for the question is the best way? def get_absolute_url(self): return '/%s/%s-%s/' % (self.categories.all()[0].slug, self.id, self.slug) #this way a take first category, but other best way to do that? thank for helps :) On Mon, Feb 20, 2017 at 5:06 AM, Melvyn S

Re: any idea for get_absolute_url in m2m categories

2017-02-20 Thread Melvyn Sopacua
On Sunday 19 February 2017 23:00:54 carlos wrote: > class Category(...): > name = CharField() > slug = SlugField(.) > > class MyModel(modesl.Model): > post = models.CharField() > slug = models.SlugField(.) > categories = models.ManyToMany(Category) > >def

Re: any idea for get_absolute_url in m2m categories

2017-02-19 Thread Mike Dewhirst
On 20/02/2017 4:00 PM, carlos wrote: 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(.