I am working my way through the HelloWebApp Intermediate Concepts.
On page 19 in the section headed ‘Helper functions on your model’, there is a snippet of code for models.py:-
class Thing(models.Model): name = models.CharField(max_length=255) description = models.TextField() slug = models.SlugField() user = models.OneToOneField(User, blank=True, null=True) # new helper method def get_absolute_url(self): return "/things/%s/" % self.slug
Where did the user field come from as I can’t see it previously?
I have commented it out as it throws an error “NameError: name ‘User’ is not defined” if left in.