Hi all, I'm working on a Django project where I've ran into some difficulties. I've a message archive where I (and the admins) can post a message to the regular users of the page.
Because there come more and more messages I want to build a archive for them, just like en blog, where it's categorist as "December 2008, January 2009, February 2009, March 2009, ... " and so on. I'm not that an expert to Django yet, so I'm having some problems creating that view. I've tried to look at some tutorials and some Opensource Django scripts but can't seem to get it to work. I don't know what kind of information you need to guide me, so I rather be better safe than sorry so you get the whole schubang: My URLS.py: (r'^message_archive.html', messageArchive), My Views.py (MessageArchive): def messageArchive(request): if request.user.is_authenticated(): user = request.user adminuser = 0 if request.user.is_staff==True: adminuser = 1 employee = user.get_profile() name = employee.first_name+' '+employee.last_name department = employee.department.name messages = Message.objects.all().order_by('-date') messagelist = [] for i in messages: if i.recepient=='Alle': messagelist.append(i) elif i.recepient==department: messagelist.append(i) return render_to_response('message_archive.html', locals()) else: return HttpResponseRedirect('unauthorised.html') My message_archive.html: {% extends "base.html" %} {% block content %} <div id="content_header"><h2>Besked oversigten</h2></div><br> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" valign="top" align="left"> <table width="100%" border="0" cellspacing="0" cellpadding="0" id="Message"> {% for i in messagelist%} <tr> <thead> <th width="100%"><b>Skrevet af {{ i.writer }} {{ i.date|date:"l d F Y" }}</b></td> </thead> </tr> <tbody> <td width="100%"><span class="subject">{{ i.topic }}</span></td> </tr> <tr> <td width="100%">{{ i.text }}</td> </tr> {% endfor %} </tbody> </table> </td> </tr> </table> {% endblock %} I would really appreciate if there were some good answers that I can learn from and implement the Generic Views in my Django project. Thanks - Bobo --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---