mirror of
https://github.com/Without-Proper-Instructions/GoatCTF
synced 2025-10-08 07:40:46 +00:00
Adds hint model to core. Fixes #32.
This commit is contained in:
parent
b48a830a60
commit
63eee10236
@ -108,3 +108,22 @@ class JoinRequest(models.Model):
|
||||
def cancel(self):
|
||||
self.delete()
|
||||
|
||||
|
||||
class Hint(models.Model):
|
||||
"""
|
||||
A hint is a bit of content that provides additional information about a
|
||||
challenge.
|
||||
"""
|
||||
challenge = models.ForeignKey("Challenge")
|
||||
created_date = models.DateTimeField(auto_now_add=True)
|
||||
publish_date = models.DateTimeField(blank=True, null=False)
|
||||
content_markdown = models.TextField()
|
||||
content_html = models.TextField()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.content_html = markdown.markdown(self.content_markdown)
|
||||
if self.publish_date is None:
|
||||
self.publish_date = self.created_date
|
||||
|
||||
super(Hint, self).save(*args, **kwargs)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user