forked from wiktor/spejstore-new
feat: Add wiki_link field
This commit is contained in:
parent
1fcbbd9dd3
commit
d1b9beca6d
|
@ -18,6 +18,7 @@ class ModelAdminMixin(object):
|
|||
|
||||
class ItemForm(forms.ModelForm):
|
||||
name = forms.CharField(widget=forms.TextInput())
|
||||
wiki_link = forms.CharField(widget=forms.TextInput())
|
||||
|
||||
class Meta:
|
||||
model = Item
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
]
|
|
@ -71,6 +71,7 @@ class Item(models.Model, TreeModelMixin):
|
|||
|
||||
name = models.TextField()
|
||||
|
||||
wiki_link = models.TextField()
|
||||
description = models.TextField(blank=True, null=True)
|
||||
state = models.CharField(max_length=31, choices=STATES, default=STATES[0][0])
|
||||
categories = models.ManyToManyField(Category, blank=True)
|
||||
|
|
|
@ -10,8 +10,18 @@
|
|||
</ol>
|
||||
<h2>
|
||||
{% 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 }}
|
||||
{% endif %}
|
||||
</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="col-md-4">
|
||||
|
||||
|
|
Loading…
Reference in New Issue