SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 51a53e3f authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Extend the core model an abstract timestamp object

The core model is extended with an abstract model called
TimeStampedModel. Future and existing models should
inherit from this model to include the default timestamp fields.
parent 58a7f2a5
No related branches found
No related tags found
No related merge requests found
......@@ -179,6 +179,19 @@ TITLE_CHOICES = (
title_dict = dict(TITLE_CHOICES)
class TimeStampedModel(models.Model):
"""
All objects should inherit from this abstract model.
This will ensure the creation of created and modified
timestamps in the objects.
"""
created = models.DateTimeField(auto_now_add=True)
latest_activity = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
class Contributor(models.Model):
"""
All users of SciPost are Contributors.
......@@ -258,7 +271,7 @@ class Contributor(models.Model):
def public_info_as_table(self):
"""Prints out all publicly-accessible info as a table."""
template = Template('''
<table>
<tr><td>Title: </td><td>&nbsp;</td><td>{{ title }}</td></tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment