Re: newbie and slugs
I think my problem might be that I'm not saving the slug. When I save a review I do... review = Review(.) #< Everything but a slug gets passed as a kwarg review.save() #<--- Then I save the review. How do I save the slug when I save the review. Does Django automajically do this for me or do I need to do something with a review.save() method? Thanks again, Bill On Wed, Nov 5, 2008 at 3:51 PM, William Purcell <[EMAIL PROTECTED]>wrote: > I am trying to create an application to help some classmates and myself > team up on journal article reviewing. I have everything working nicely > except being able to create a slug from the title of the journal article and > then using it in urls.py and creating links in templates. The application is > called journal_review. Journal_review.models has a class called Review and > in it I have... > > class Review(models.Model): > > slug = models.CharField(max_length=60) > . > > > and then in journal_review.admin I have ... > > class ReviewAdmin(admin.ModelAdmin): > ... > prepopulated_fields = {'slug': ('title',) } > admin.site.register(Review, ReviewAdmin) > > Then in a template I want to do something like... >{% for review in latest_review_list %} > {{review.pub_date.ctime}}| > {{ review.title }} | > {{ review.review }} | > {{ review.username}} | > * {{ review.slug }} *| > {% if review.tags %} > {% for tag in review.tags %} > {{tag}} > {% endfor %} > {% endif %} > > {% endfor %} > > In the above, review.link is a method of journal_review.models.Review and > it looks like this ... > > def link(self,obj): > return self.get_absolute_url()+self.slug > > I don't think that any slugs are being generated because {{ review.slug }} > renders as a blank line and {{ review.link }} renders as the current page. > > My urls.py for this is > (r'^journal_review/$','testproject.journal_review.views.index'), > (r'^journal_review/(?P[a-zA-Z0-9_.-]+)/$', > 'testproject.journal_review.views.detail'), > > Excuse my ignorance as I am fairly new to django and I appreciate any help > or direction. > Thanks, > Bill > > P.S. I am using Django 1.0 > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~--~~~~--~~--~--~---
newbie and slugs
I am trying to create an application to help some classmates and myself team up on journal article reviewing. I have everything working nicely except being able to create a slug from the title of the journal article and then using it in urls.py and creating links in templates. The application is called journal_review. Journal_review.models has a class called Review and in it I have... class Review(models.Model): slug = models.CharField(max_length=60) . and then in journal_review.admin I have ... class ReviewAdmin(admin.ModelAdmin): ... prepopulated_fields = {'slug': ('title',) } admin.site.register(Review, ReviewAdmin) Then in a template I want to do something like... {% for review in latest_review_list %} {{review.pub_date.ctime}}| {{ review.title }} | {{ review.review }} | {{ review.username}} | * {{ review.slug }} *| {% if review.tags %} {% for tag in review.tags %} {{tag}} {% endfor %} {% endif %} {% endfor %} In the above, review.link is a method of journal_review.models.Review and it looks like this ... def link(self,obj): return self.get_absolute_url()+self.slug I don't think that any slugs are being generated because {{ review.slug }} renders as a blank line and {{ review.link }} renders as the current page. My urls.py for this is (r'^journal_review/$','testproject.journal_review.views.index'), (r'^journal_review/(?P[a-zA-Z0-9_.-]+)/$', 'testproject.journal_review.views.detail'), Excuse my ignorance as I am fairly new to django and I appreciate any help or direction. Thanks, Bill P.S. I am using Django 1.0 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: django on apache looses all styling
I see that django documentation says to copy the admin media files so that they live within your Apache document root. I have put the media files from the django/contrib in the Apache document root. How does django/apache see them? On Thu, Oct 16, 2008 at 2:42 PM, William Purcell <[EMAIL PROTECTED]>wrote: > I am new to django, and web development in general for that matter, so > please bear with me. I have done the introductory tutorial at the django web > site. Everything works fine. I have now installed apache and I'm trying to > serve django with mod_python installed in apache. I can now browse to > localhost/myapp/admin but the admin page has lost all styling. Any comments > or suggestions are very much appreciated. Sorry for such an elementary > question, but I am stuck and can't find anything on google. > Thanks, > Bill > > Windows XP > Apache 2.0.63 > mod_python 3.3.1 > Python 2.5 > django 1.1 > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~--~~~~--~~--~--~---
django on apache looses all styling
I am new to django, and web development in general for that matter, so please bear with me. I have done the introductory tutorial at the django web site. Everything works fine. I have now installed apache and I'm trying to serve django with mod_python installed in apache. I can now browse to localhost/myapp/admin but the admin page has lost all styling. Any comments or suggestions are very much appreciated. Sorry for such an elementary question, but I am stuck and can't find anything on google. Thanks, Bill Windows XP Apache 2.0.63 mod_python 3.3.1 Python 2.5 django 1.1 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~--~~~~--~~--~--~---