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): """