my model is like:
class Modeloxy(models.Model):
...
...
slug = models.slug()
class mymodel(models.Model):
marca = ...
...
modelo = models.ForeignKey(Modeloxy)
def get_absolute_url(self):
return '/%s/%s/%s' % (self.marca,self.modelo__slug,self.pk)
So, i can’t get the absolute url usin self.modelo__slug…. how i will do that?
thanks guys
It would be
self.modelo.slugThe double underscore syntax was created to solve the problem of not being able to use dot syntax as a keyword argument
function(keyword_arg=Foo)and unrelated to python: you’re literally looking for a variable namedmodelo__slugin your case.