Define get_absolute_url in models.py that is a file in your application's
directory.
from django.db import models
class MyModeName(models.Model):
# Add field names here like --> name = models.CharField(max_length=20,
primary_key=True)
def __unicode__(self): # Well, you don't need to define
this actually, but they say it's just in case
return self.name_of_a_field # So in our case since we gave the
model a "name" field, then give return self.name here (because that's
a field of the model that is the primary key)
@models.permalink
def get_absolute_url(self):
return
('project_name.application_name.views.function_name_in_the_views.py_file', [
self.pk]) # [self.pk] must be written as it is here -- it just gets the
primary key, so like that "name" thing from the model MyModeName; leave this
self.pk as is
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.