1
0
Fork 0

feat: Add wiki_link field

This commit is contained in:
Dariusz Niemczyk 2023-12-03 19:55:26 +01:00
parent 1fcbbd9dd3
commit d1b9beca6d
No known key found for this signature in database
4 changed files with 30 additions and 1 deletions

View File

@ -18,6 +18,7 @@ class ModelAdminMixin(object):
class ItemForm(forms.ModelForm): class ItemForm(forms.ModelForm):
name = forms.CharField(widget=forms.TextInput()) name = forms.CharField(widget=forms.TextInput())
wiki_link = forms.CharField(widget=forms.TextInput())
class Meta: class Meta:
model = Item model = Item

View File

@ -0,0 +1,17 @@
# Generated by Django 3.2.20 on 2023-12-03 18:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("storage", "0011_auto_20230720_1240"),
]
operations = [
migrations.AddField(
model_name="item",
name="wiki_link",
field=models.TextField(blank=True, null=True),
),
]

View File

@ -71,6 +71,7 @@ class Item(models.Model, TreeModelMixin):
name = models.TextField() name = models.TextField()
wiki_link = models.TextField()
description = models.TextField(blank=True, null=True) description = models.TextField(blank=True, null=True)
state = models.CharField(max_length=31, choices=STATES, default=STATES[0][0]) state = models.CharField(max_length=31, choices=STATES, default=STATES[0][0])
categories = models.ManyToManyField(Category, blank=True) categories = models.ManyToManyField(Category, blank=True)

View File

@ -10,8 +10,18 @@
</ol> </ol>
<h2> <h2>
{% include "widgets/categoryicon.html" with category=item.primary_category %} {% include "widgets/categoryicon.html" with category=item.primary_category %}
{% if item.wiki_link %}
<a href="{{item.wiki_link}}" target="_blank">{{ item.name }}</a>
{% else %}
{{ item.name }} {{ item.name }}
{% endif %}
</h2> </h2>
{% if item.wiki_link %}
<span>Click <a href="{{item.wiki_link}}" target="_blank">HERE</a> or title for wiki</span>
{% endif %}
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">