Skip to content
Snippets Groups Projects
Commit 25a075fc authored by jarmil's avatar jarmil
Browse files

REF: sdileny model Person misto PersonPage

parent 98ced150
No related branches found
No related tags found
2 merge requests!173Release,!134Weby pro MS
# Generated by Django 3.1.3 on 2021-01-07 09:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("shared", "0015_auto_20210106_1029"),
]
operations = [
migrations.RemoveField(
model_name="personpage",
name="profile_id",
),
migrations.RemoveField(
model_name="personpage",
name="username",
),
]
# Generated by Django 3.1.3 on 2021-01-07 09:58
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("shared", "0016_auto_20210107_1025"),
]
operations = [
migrations.CreateModel(
name="Person",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("username", models.TextField(verbose_name="Uživatelské jméno osoby")),
(
"profile_id",
models.IntegerField(
blank=True,
default=0,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(2),
],
verbose_name="Číslo medailonku (0..2) z lide.pirati.cz",
),
),
(
"perex",
models.TextField(blank=True, verbose_name="Defaultni perex osoby"),
),
],
options={
"verbose_name": "Pirat",
"verbose_name_plural": "Pirati",
},
),
]
# Generated by Django 3.1.3 on 2021-01-07 10:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("shared", "0017_person"),
]
operations = [
migrations.AlterModelOptions(
name="person",
options={"verbose_name": "Pirát", "verbose_name_plural": "Piráti"},
),
]
......@@ -87,8 +87,8 @@ class Article(ArticleMixin, Page, SharedSubpageMixin, MetadataPageMixin):
]
class PersonPage(SharedSubpageMixin, MetadataPageMixin, Page):
"""Stranka Pirata.
class Person(models.Model):
"""Informace o Piratovi. Slouzi prevazne jako cache informaci o osobe pro uziti v ramci Majaku.
Snaha je zadavat tady minimum informaci o osobe a zbytek vytahovat via API z jinych zdroju,
neb nechceme dalsi databazi lidi.
"""
......@@ -102,9 +102,9 @@ class PersonPage(SharedSubpageMixin, MetadataPageMixin, Page):
validators=[MinValueValidator(0), MaxValueValidator(2)],
)
perex = models.TextField("Perex osoby", blank=True)
perex = models.TextField("Defaultni perex osoby", blank=True)
content_panels = Page.content_panels + [
panels = [
FieldPanel("username"),
FieldPanel("profile_id"),
FieldPanel("perex"),
......@@ -154,6 +154,22 @@ class PersonPage(SharedSubpageMixin, MetadataPageMixin, Page):
def facebook(self):
return None # TODO
class Meta:
verbose_name_plural = "Piráti"
verbose_name = "Pirát"
class PersonPage(SharedSubpageMixin, MetadataPageMixin, Page):
"""Stranka Pirata v kontextu jednoho webu"""
# person = models.ForeignKey(Person, on_delete=models.PROTECT)
perex = models.TextField("Perex osoby", blank=True)
content_panels = Page.content_panels + [
# FieldPanel("person"),
FieldPanel("perex"),
]
class Meta:
verbose_name = "Člověk" # to zni hrde
......
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from .models import Person
class PersonAdmin(ModelAdmin):
model = Person
menu_label = "Pirati"
menu_icon = "group"
menu_order = 200
add_to_settings_menu = False
exclude_from_explorer = False
list_display = ("username",)
search_fields = ("username",)
modeladmin_register(PersonAdmin)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment