How does one change the slug for an existing object? I have two objects with conflicting slugs and I need to change one to fix the problem. Is there a way to do this in the admin interface? I’m not seeing one.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You need to make sure that a) The appropriate app is registered to appear in the admin interface, and b), the
slugis set to be included. Inadmin.pyof the relevant app, you need to make sure thatslugis in thefieldsattribute:admin.py
furthremore, you should try to avoid getting into a situation where two records have the same slug. You can do this by adding
unique=Trueto the model field.models.py
If there are problems with the above, you will have to manually change one of the slugs in the DB or use the shell: