Commits

Jens Diemer committed dff5506

Add PostTrackingAdmin
---

  • Participants
  • Parent commits f3fb387

Comments (0)

Files changed (2)

File djangobb_forum/admin.py

 from django.utils.translation import ugettext_lazy as _
 
 from djangobb_forum.models import Category, Forum, Topic, Post, Profile, Reputation, \
-    Report, Ban, Attachment, Poll, PollChoice
+    Report, Ban, Attachment, Poll, PollChoice, PostTracking
 
 
 class BaseModelAdmin(admin.ModelAdmin):
     list_display = ['user', 'status', 'time_zone', 'location', 'language']
     raw_id_fields = ['user']
 
+class PostTrackingAdmin(BaseModelAdmin):
+    list_display = ['user', 'last_read', 'topics']
+    raw_id_fields = ['user']
+
 class ReputationAdmin(BaseModelAdmin):
     list_display = ['from_user', 'to_user', 'post', 'sign', 'time', 'reason']
     raw_id_fields = ['from_user', 'to_user', 'post']
 admin.site.register(Topic, TopicAdmin)
 admin.site.register(Post, PostAdmin)
 admin.site.register(Profile, ProfileAdmin)
+admin.site.register(PostTracking, PostTrackingAdmin)
 admin.site.register(Reputation, ReputationAdmin)
 admin.site.register(Report, ReportAdmin)
 admin.site.register(Ban, BanAdmin)

File djangobb_forum/models.py

     """
 
     user = AutoOneToOneField(User)
-    topics = JSONField(null=True)
-    last_read = models.DateTimeField(null=True)
+    topics = JSONField(null=True, blank=True)
+    last_read = models.DateTimeField(null=True, blank=True)
 
     class Meta:
         verbose_name = _('Post tracking')