Reputation: 9595
I have this model:
class Invite(models.Model):
user = models.OneToOneField(User)
cookie = models.SlugField()
token = models.SlugField()
def __unicode__(self):
return u"%s's invite" % (self.user)
def get_absolute_url(self):
return (reverse('invite'), args=[self.token])
The final line, return (reverse('invite'), args=[self.token])
, returns a syntax error. When I remove the args=
part, it seems to work fine though.
I have three questions regarding this:
Why is arg=
in this example returning a syntax error while the django docs uses a similiar example here.
How am I supposed to successfully key into this list/check the contents of the list without assigning it a name?
Does return
require ()
to work with more than one variable? Since im using python 2.7.5 wouldn't a simple ,
suffice?
Thanks!
Upvotes: 0
Views: 258
Reputation: 599620
You have the closing parenthesis in the wrong place. args
is an argument to reverse
.
return (reverse('invite', args=[self.token]))
Upvotes: 2