Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8022219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:12:20+00:00 2026-06-04T22:12:20+00:00

In my admin.py file I am trying to use Prepopulated_fields to auto slug a

  • 0

In my admin.py file I am trying to use Prepopulated_fields to auto slug a title. It seems to have problems with short two letter words however. When I type in “Is”, “the” or “to”, it blanks it out of the slug. Also I tried “before” and the second I hit the E button, it blanked that out too. Is this expected with prepopulated fields or am I doing something wrong?

Models.py

title = models.CharField(max_length=255)
entry = models.TextField()    
date_edited = models.DateTimeField(auto_now=True, verbose_name = "Last edited")
date_posted = models.DateTimeField(verbose_name="Post Date")
slug = models.SlugField(max_length=255, unique=True)

Admin.py

 prepopulated_fields = {"slug": ("title",)}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:12:21+00:00Added an answer on June 4, 2026 at 10:12 pm

    Like @Alasdair said in his answer, there are words that get ignored when you use prepoulated_fields. Instead of overriding the js file that handles those words I turned the slug field from the title in the save_model.

    def save_model(self, request, obj, form, change):        
        if not change:
            obj.slug = slugify(('%s') % obj.title)
        obj.save()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my urls file I have configured the Django admin application to run off
Let's say that I have this website file root structure: frontend /home/username/public_html/ backend /home/username/public_html/admin/
I have to change the is_staff option from views.py file to disabling the Django-admin
I have a dictionary object of type Dictionary and trying to use StreamWriter to
i am just trying to use copyfile to copy a file, it is as
Can I use conditional statements in my either my models.py or admin.py file to
I'm trying to use valums ajax uploader. http://valums.com/ajax-upload/ I have the following on my
I have been trying to use HG convert to migrate a local CVS repository
Hey folks, I am trying to import a database (.sql) file using phpmy admin
I am trying to use datetimepicker from: http://trentrichardson.com/ functionality is working it seems, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.