Nick,

I can answer you first question...but not really the second...hopefully
someone else will come and explain that one to you...

re slugs: The prepopulated_fields are working as intended.

The reason being, say you've written a blog post. You've send that link out
to thousands and millions of people. Then you realize that you wanted to
change a word in your title (hence changing the slug).

As soon as you change that slug, you've broken a link on the internet that
was previously NOT broken before. Even if you change the title, don't change
the slug.

Django can figure out the "absolute_url" for what ever slug you pick. But
once the link has been published _outside_ your site, you don't want to have
broken links. Remember it's just a slug...just a url...the real title can be
what ever you want it to be.

BUT if you want django to behave the way you're expecting, the great thing
about django is you can change it to behave that way. All it takes is a
little customization of the change_view for the admin of your blog app (or
what ever app you want to change the behavior of).

Hope that helps

Nick (also)

On Tue, Sep 14, 2010 at 3:10 PM, Nick <iregisteratwebsiteswitht...@gmail.com
> wrote:

> Hello,
>
> I'm running django 1.2.3 on a local server and am still quite new to
> django. I was working with the "practical django projects second
> edition" book and implemented the prepopulated_fields option to auto
> populate slugs from titles.
>
> It works when I add a new post but it does not work when I edit the
> post, is this working as intended or broken? It seems for this option
> to be useful it must update on change as well. If that's not a
> supported option what can I do to hack it in?
>
> The code I am using is (admin.py):
>
> class CategoryAdmin(admin.ModelAdmin):
>    prepopulated_fields = { 'slug': ['title'] }
>
> class EntryAdmin(admin.ModelAdmin):
>    prepopulated_fields = { 'slug': ['title'] }
>
> class LinkAdmin(admin.ModelAdmin):
>    prepopulated_fields = { 'slug': ['title'] }
>
> admin.site.register(Category, CategoryAdmin)
> admin.site.register(Entry, EntryAdmin)
> admin.site.register(Link, LinkAdmin)
>
> I also tried using the django documentation's syntax with no luck, it
> resulted in the same broken functionality. I tried it with Opera 10.x
> and IE8, same results.
>
> Also there appears to be a massive problem with the CSS when using the
> filter sidebar. The admin is designed to be fluid width and
> automatically generates the proper fluid width of columns but it fails
> to make the column widths fluid when the filter sidebar is enabled.
>
> Is there a known hack to correct this? It looks very awkward when you
> have a 1600 width screen and 3 or 4 columns are shrunken to 75-100
> pixels wide with a 1000 pixel white space before it shows the sidebar.
>
> Thanks,
> Nick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Guadajuko! Vamos a correr!
 -"Cool! we are going to run!"

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to