provided however I would like to create a similar view that returns
url information from the record that is located next.
So in essence take the info from my first view, list/order it in some
way preferably by date and return the records located next and
previous in the list.
Can somebody please explain to me and provide a simple example of how
I would do this. I am new to django and I am stuck. All Help is
greatly appreciated. Thanks.
Here are the models URLs and views I have used
Model
class Body(models.Model):
type = models.ForeignKey(Content)
url = models.SlugField(unique=True, help_text='A Google friendly
title.')
published = models.DateTimeField(default=datetime.now)
maintxt = models.CharField(max_length=200)
View
def news_view(request, url):
news = get_object_or_404(Body, url=url)
return render_to_response('news/news_view.html', {
'news': news
}, context_instance=RequestContext(request))
URL
url(r'^/(?P<url>[\w\-]+)/$', 'news_view', name="news_view"),
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment