Currently in my forum app, the topic last modified date is auto set:
topic_modification_date = models.DateTimeField(auto_now = True,
blank=True)

I want to set that to false and explicitly set it when certain views
happen (namely, new topic or new posts). I don't want it to set when
other things happen (like deleting a post).

So, in my view, I've imported datetime, and it works fine in other
views that need it. But in the add_topic view, it's returning null.
Here's a truncated version of the view:

def add_topic(request, forum_slug):
        if request.user.is_authenticated():
                forum = Forum.objects.get(forum_slug=forum_slug)
                manipulator = Topic.AddManipulator()
                if request.POST and len(request.POST.copy()
['post_text']) > 1:
                        page_data = request.POST.copy()
                        page_data['topic_posts'] = 1
                        page_data['topic_views'] = 1
                        page_data['topic_modification_date'] =
datetime.datetime.now()
                        page_data['post_text'] =
html2safehtml(page_data['post_text'],valid_tags=('b', 'a', 'i', ...
'blockquote'))
                        manipulator.do_html2python(page_data)
                        new_place = manipulator.save(page_data)

I even tried just returning datetime.datetime.now() from within the
view, and that worked. But when I try to save it to the database, it's
null.
Any ideas?


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to