Added markdown description for challenges and profile info

This commit is contained in:
teras
2017-12-02 21:24:54 +02:00
committed by Lauri Võsandi
parent c13b0c7971
commit 9e5a795295
3 changed files with 61 additions and 25 deletions

View File

@@ -17,6 +17,8 @@ def get_inventory_item_path(filename):
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
icon = models.ImageField(upload_to=get_profile_image_path, default='default_icon.png')
phone_number = models.CharField(max_length=16, blank=True, null=True)
contact_info = models.TextField(blank=True, null=True)
def __str__(self):
return self.user.username
@@ -35,7 +37,7 @@ class Challenge(models.Model):
id = models.AutoField(primary_key=True)
creator = models.ForeignKey(User, blank=True, null=True, editable=False, on_delete=models.SET_NULL)
name = models.CharField(max_length=256)
description = models.TextField(blank=True)
description = models.TextField(blank=True, null=True)
tags = models.ManyToManyField(ChallengeTag, blank=True)
def __str__(self):

View File

@@ -35,6 +35,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'location_field.apps.DefaultConfig',
'markdownify',
'kspace'
]
@@ -80,6 +81,20 @@ DATABASES = {
}
}
MARKDOWNIFY_WHITELIST_TAGS = [
'a',
'abbr',
'acronym',
'b',
'blockquote',
'em',
'i',
'li',
'ol',
'p',
'strong',
'ul'
]
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators