fixed keywords without icons
This commit is contained in:
@ -74,7 +74,10 @@ class Keyword(models.Model):
|
|||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{0} {1}".format(self.icon, self.name)
|
if self.icon:
|
||||||
|
return f"{self.icon} {self.name}"
|
||||||
|
else:
|
||||||
|
return f"{self.name}"
|
||||||
|
|
||||||
|
|
||||||
class Recipe(models.Model):
|
class Recipe(models.Model):
|
||||||
@ -99,7 +102,7 @@ class Recipe(models.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def all_tags(self):
|
def all_tags(self):
|
||||||
return ' '.join([(x.icon + x.name) for x in self.keywords.all()])
|
return ' '.join([(str(x)) for x in self.keywords.all()])
|
||||||
|
|
||||||
|
|
||||||
class Unit(models.Model):
|
class Unit(models.Model):
|
||||||
|
@ -70,11 +70,12 @@
|
|||||||
|
|
||||||
{% if recipe.internal %}
|
{% if recipe.internal %}
|
||||||
<small>{% trans 'by' %} {{ recipe.created_by.username }}<br/></small>
|
<small>{% trans 'by' %} {{ recipe.created_by.username }}<br/></small>
|
||||||
<br/>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if recipe.all_tags %}
|
{% if recipe.keywords %}
|
||||||
{{ recipe.all_tags }}
|
{% for x in recipe.keywords.all %}
|
||||||
|
<span class="badge badge-pill badge-light">{{ x }}</span>
|
||||||
|
{% endfor %}
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Reference in New Issue
Block a user