SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jul 2007
    Location
    San Jose, California
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Python Decorator

    I am getting this error:
    File "/models.py", line 13, in Item
    @permalink
    NameError: name 'permalink' is not defined

    Code Python:
    class Item(models.Model):
            name = models.CharField(max_length=250)
            description = models.TextField()
     
            class Meta:
                    order = ['name']
     
            def __unicode__(self):
                    return self.name
     
            @permalink
            def get_absolute_url(self):
                    return ('item_detail', None, {'object_id' : self.id})


    That's the code, any clue why that is happening?

  2. #2
    SitePoint Addict
    Join Date
    Jul 2007
    Location
    San Jose, California
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind, it's from django if anybody else has this problem
    and you need to make @models.permalink


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •