Skip to content

Instantly share code, notes, and snippets.

@jy95

jy95/models.py Secret

Created November 1, 2017 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jy95/583b5ea2d3e0470f7c264881cbfb0d51 to your computer and use it in GitHub Desktop.
Save jy95/583b5ea2d3e0470f7c264881cbfb0d51 to your computer and use it in GitHub Desktop.
class SkillHistory(models.Model):
"""
The reason why a Skill is acquired or not,
or not yet, when and by who/how
"""
skill = models.ForeignKey(Skill)
"""The Skill to validate"""
student = models.ForeignKey('users.Student')
"""The Student concerned by this Skill"""
datetime = models.DateTimeField(auto_now_add=True)
"""The date the Skill status was created"""
value = models.CharField(max_length=255, choices=(
('unknown', 'Inconnu'),
('acquired', 'Acquise'),
('not acquired', 'None Acquise'),
))
"""The Skill status : unknown, acquired or not acquired"""
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
reason_object = GenericForeignKey('content_type', 'object_id')
reason = models.CharField(max_length=255)
"""Why the Skill is validated or not"""
by_who = models.ForeignKey(User)
class Meta:
ordering = ['datetime']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment