Jay,
I've already added my SlugField. Here is a look at the table I
created
class news(models.Model):
title = models.CharField(maxlength=200)
theslug = models.SlugField(prepopulate_from=("title"))
body = models.TextField(maxlength=2000)
def __str__(self,):
return self.title
class Admin:
However, when i login to my admin and type something into my title
field nothing appears in the SlugField. I'm assuming that I need to
import some JavaScript file so that my SlugField gets auto-populated
when I enter text into the text field.
Thanks for you help
On May 6, 11:09 am, "Jay Parlar" <[EMAIL PROTECTED]> wrote:
> On 5/6/07, gsmith <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have a table called Stories that contains two fields 'Title' and
> > 'Body'. We'll I want the page to be accessed by a SlugField. I have
> > added a SlugField to my table. However, I want it so that whenever I
> > enter a title for a story in my admin then the SlugField gets auto-
> > populated with the contents of the title.
>
> > So if I enter a title of 'The weather has been severe'. Then the want
> > the SlugField to be populated with something like 'weather-severe'. I
> > think I'm going to have to implement some type of JavaScript file to
> > accomplish this.
>
> Django can already do this for you. See the SlugField
> documentation:http://www.djangoproject.com/documentation/model-api/#slugfield
>
> Jay P.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---