Si vous constatez la perte de tickets, de commentaires ou de projets, veuillez consulter la page https://status.framasoft.org/incident/626.

...
 
Commits (3)
version = "0.9.9"
version = "0.10.0"
description = "Add a person and a persons index pages to Wagtail as well as a person block for StreamFields."
# Generated by Django 3.0.5 on 2020-04-16 16:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailperson', '0005_auto_20200220_1854'),
]
operations = [
migrations.AlterModelOptions(
name='personpage',
options={'ordering': ['title'], 'verbose_name': 'Person or author page', 'verbose_name_plural': 'Person or author pages'},
),
migrations.AddField(
model_name='person',
name='name_slug',
field=models.CharField(blank=True, editable=False, max_length=250),
),
]
......@@ -80,6 +80,11 @@ class Person(ClusterableModel):
verbose_name=_('Name'),
max_length=250,
)
name_slug = models.CharField(
max_length=250,
editable=False,
blank=True,
)
tags = TaggableManager(through=PersonTag, blank=True)
intro = models.CharField(
verbose_name=_('Introduction'),
......@@ -109,8 +114,12 @@ class Person(ClusterableModel):
def __str__(self):
return self.name
def save(self, *args, **kwargs):
self.name_slug = slugify(self.name)
return super(Person, self).save(*args, **kwargs)
# Models
# Page Models
class PersonPage(Page):
......
from django.test import TestCase
# Create your tests here.
from wagtailperson.models import Person
class PersonTasteCase(TestCase):
"""Test the Person model"""
def setUp(self):
"""Setup the database"""
self.person_name = 'Alice and Bob'
self.person_name_slug = 'alice-and-bob'
self.person = Person(
name=self.person_name,
)
self.person.save()
def test_person_name_slug(self):
"""Test the slugify name of a person"""
self.assertEqual(
self.person.name_slug,
self.person_name_slug,
)