django admin view on site don't use get_absolute_url -
i'm using default django admin. registered models in admin.py,i define get_absolute_url in models, when i'm on editing form of model button view on site redirect me basic localhost:8000 no metter writing in get_absolute_url, appears admin didn't use @ all.
class products(models.model): name=models.charfield(max_length=30,unique=true) slug=models.charfield(max_length=30) description=models.textfield(max_length=200) price=models.floatfield() created_at=models.datetimefield() modified_at=models.datetimefield(blank=true,null=true) def __unicode__(self): return (self.name) def get_absolute_url(self): return '/foo/bar/'
decision:
def get_absolute_url(self): products.views import single_product return reverse(single_product, args=[self.slug])
Comments
Post a Comment