Re: prepopulated_fields problem (+admin CSS issues)
If the slugs are something you're really concerned with... I would say customize the change form to work the way you want. Personally, I would rather the computer error on the side of not breaking...instead of trying to anticipate what I want it to do this time...vs next time vs a year from now. Re the CSS of the admin: Well...I've noticed it...though I never thought of it as an 'issue'. CSS/Design isn't my strong point. In fact...I wouldn't even consider myself average at it! Probably sufficiently below average. So I always take stuff that's been designed by others to be purposeful. I can't say why it was designed that way or if it was an accident of the way the filter gets added... hope that helps. n On Tue, Sep 14, 2010 at 3:30 PM, Nick wrote: > Yeah that makes sense. I guess we just need to be more careful when > adding live posts. Maybe it wouldn't be a bad idea to add the > functionality on change if a post is anything but live. This way the > slug stays relevant to the title for drafts if the editor feels like > experimenting with different titles. > > As for my second question. Can you not help because you haven't > experienced this issue, or is it something you just don't have a > problem with? > > On Sep 14, 11:20 am, "nick.l...@gmail.com" > wrote: > > 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 > > > > . > > > 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 > "D
Re: prepopulated_fields problem (+admin CSS issues)
Yeah that makes sense. I guess we just need to be more careful when adding live posts. Maybe it wouldn't be a bad idea to add the functionality on change if a post is anything but live. This way the slug stays relevant to the title for drafts if the editor feels like experimenting with different titles. As for my second question. Can you not help because you haven't experienced this issue, or is it something you just don't have a problem with? On Sep 14, 11:20 am, "nick.l...@gmail.com" wrote: > 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 > > > > > > 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 > > . > > 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.
Re: prepopulated_fields problem (+admin CSS issues)
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 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 > . > 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.
prepopulated_fields problem (+admin CSS issues)
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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.