From 04034470ece955c305a4b792aff89493098b2dc9 Mon Sep 17 00:00:00 2001 From: dellsystem Date: Sun, 10 Feb 2013 18:11:44 -0500 Subject: [PATCH] Add maintainer field to Page (#165) NOTE: when creating the column, make sure to specify a default (1 should be fine, as that's the admin user). --- views/pages.py | 3 +-- wiki/models/pages.py | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/views/pages.py b/views/pages.py index 6fdfb68..d1f35c0 100644 --- a/views/pages.py +++ b/views/pages.py @@ -262,8 +262,7 @@ def create(request, department, number, page_type, semester=None): else: commit_message = request.POST['message'] if request.POST['message'] else 'Minor edit' # The title and subject are generated by the PageType object, in kwargs - new_page = Page(course_sem=course_sem, page_type=page_type, **kwargs) - new_page.save() + new_page = Page.objects.create(course_sem=course_sem, page_type=page_type, maintainer=request.user, **kwargs) username = request.user.username email = request.user.email new_page.save_content(request.POST['content'], commit_message, username) diff --git a/wiki/models/pages.py b/wiki/models/pages.py index 52eaeee..249b55b 100644 --- a/wiki/models/pages.py +++ b/wiki/models/pages.py @@ -2,6 +2,7 @@ import os from django.db import models +from django.contrib.auth.models import User from wiki.utils.pages import page_types, page_type_choices, get_section_start_end from wiki.utils.gitutils import Git @@ -23,6 +24,7 @@ class Meta: professor = models.ForeignKey('Professor', null=True, blank=True) slug = models.CharField(max_length=50) content = models.TextField(null=True) # processed markdown, like a cache + maintainer = models.ForeignKey(User) def load_section_content(self, anchor_name): """