Added markdown description for challenges and profile info
This commit is contained in:
parent
c13b0c7971
commit
9e5a795295
@ -17,6 +17,8 @@ def get_inventory_item_path(filename):
|
|||||||
class Profile(models.Model):
|
class Profile(models.Model):
|
||||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
icon = models.ImageField(upload_to=get_profile_image_path, default='default_icon.png')
|
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):
|
def __str__(self):
|
||||||
return self.user.username
|
return self.user.username
|
||||||
@ -35,7 +37,7 @@ class Challenge(models.Model):
|
|||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
creator = models.ForeignKey(User, blank=True, null=True, editable=False, on_delete=models.SET_NULL)
|
creator = models.ForeignKey(User, blank=True, null=True, editable=False, on_delete=models.SET_NULL)
|
||||||
name = models.CharField(max_length=256)
|
name = models.CharField(max_length=256)
|
||||||
description = models.TextField(blank=True)
|
description = models.TextField(blank=True, null=True)
|
||||||
tags = models.ManyToManyField(ChallengeTag, blank=True)
|
tags = models.ManyToManyField(ChallengeTag, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -35,6 +35,7 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'location_field.apps.DefaultConfig',
|
'location_field.apps.DefaultConfig',
|
||||||
|
'markdownify',
|
||||||
'kspace'
|
'kspace'
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -80,6 +81,20 @@ DATABASES = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MARKDOWNIFY_WHITELIST_TAGS = [
|
||||||
|
'a',
|
||||||
|
'abbr',
|
||||||
|
'acronym',
|
||||||
|
'b',
|
||||||
|
'blockquote',
|
||||||
|
'em',
|
||||||
|
'i',
|
||||||
|
'li',
|
||||||
|
'ol',
|
||||||
|
'p',
|
||||||
|
'strong',
|
||||||
|
'ul'
|
||||||
|
]
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% load markdownify %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row container">
|
<div class="row container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -11,44 +14,60 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p style="">{{ challenge.description }}
|
<p style="">{{ challenge.description | markdownify }}</p>
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<p>I am usually at k-space on weekends. Come and take a look.</p>
|
{% if challenge.creator.profile.contact_info %}
|
||||||
<div class="valign-wrapper"><i class="material-icons">email</i> eric.cartman@email.com</div>
|
<p>{{ challenge.creator.profile.contact_info }}</p>
|
||||||
<br>
|
{% endif %}
|
||||||
<div class="valign-wrapper"><i class="material-icons">phone</i> 55 55 5555</div>
|
{% if challenge.creator.email %}
|
||||||
|
<div class="valign-wrapper"><i class="material-icons">email</i> {{ challenge.creator.email }}</div>
|
||||||
|
<br>
|
||||||
|
{% endif %}
|
||||||
|
{% if challenge.creator.profile.phone_number %}
|
||||||
|
<div class="valign-wrapper"><i class="material-icons">phone</i> {{ challenge.creator.profile.phone_number }}</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col m4">
|
<div class="col m4">
|
||||||
<ul class="collection">
|
<ul class="collection">
|
||||||
<li class="collection-item avatar">
|
<li class="collection-item avatar">
|
||||||
<img src="https://vignette.wikia.nocookie.net/southpark/images/0/0d/1a.jpg/revision/latest/scale-to-width-down/310?cb=20100826182516"
|
<img src="/media/{{ challenge.creator.profile.icon }}"
|
||||||
alt="" class="circle">
|
alt="" class="circle">
|
||||||
<span class="title">Author</span>
|
<span class="title">Author</span>
|
||||||
<p><b>{{ challenge.creator.username }}</b></p>
|
<p><b>{{ challenge.creator.username }}</b></p>
|
||||||
</li>
|
</li>
|
||||||
<li class="collection-item">
|
|
||||||
<span class="title">Programming</span>
|
|
||||||
</li>
|
|
||||||
<li class="collection-item">
|
|
||||||
<span class="title">Soldering</span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="collection with-header">
|
{% if challenge.tags|length > 0 %}
|
||||||
<li class="collection-header">
|
<ul class="collection with-header">
|
||||||
<span class="title"><b>What we need</b></span>
|
<li class="collection-header">
|
||||||
</li>
|
<span class="title"><b>Tags</b></span>
|
||||||
<li class="collection-item">
|
</li>
|
||||||
<span class="">CNC bench experience</span>
|
|
||||||
</li>
|
{% for tag in challenge.tags.all %}
|
||||||
<li class="collection-item">
|
<li class="collection-item">
|
||||||
<span class="title">Screwdriver</span>
|
<span class="">{{ tag.name }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if challenge.tags|length > 0 %}
|
||||||
|
<ul class="collection with-header">
|
||||||
|
<li class="collection-header">
|
||||||
|
<span class="title"><b>Tags</b></span>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{% for tag in challenge.tags.all %}
|
||||||
|
<li class="collection-item">
|
||||||
|
<span class="">{{ tag.name }}</span>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user