Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
show shortname of groups
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreJunod committed Aug 28, 2023
1 parent 0ced1f6 commit b2636ad
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
1 change: 1 addition & 0 deletions geocity/apps/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ class DepartmentAdminForm(forms.ModelForm):
class Meta:
model = models.PermitDepartment
fields = [
"shortname",
"description",
"administrative_entity",
"is_validator",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.4 on 2023-08-28 12:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("accounts", "0014_alter_administrativeentity_is_single_form_submissions"),
]

operations = [
migrations.AlterField(
model_name="permitdepartment",
name="shortname",
field=models.CharField(
blank=True,
help_text="Nom affiché par défaut dans les différentes étapes du formulaire, ne s'affiche pas dans l'admin (max. 100 caractères)",
max_length=100,
verbose_name="nom court",
),
),
]
6 changes: 3 additions & 3 deletions geocity/apps/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ class PermitDepartment(models.Model):
description = models.CharField(_("description"), max_length=100, default="Service")
shortname = models.CharField(
_("nom court"),
max_length=32,
max_length=100,
help_text=_(
"Nom affiché par défaut dans les différentes étapes du formulaire, ne s'affiche pas dans l'admin (max. 32 caractères)"
"Nom affiché par défaut dans les différentes étapes du formulaire, ne s'affiche pas dans l'admin (max. 100 caractères)"
),
blank=True,
)
Expand Down Expand Up @@ -202,7 +202,7 @@ class Meta:
)

def __str__(self):
return str(self.group)
return self.shortname if self.shortname else self.group.name


class AdministrativeEntityQuerySet(models.QuerySet):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,22 @@ class Migration(migrations.Migration):
),
),
migrations.RunPython(generate_uuids),
migrations.AlterField(
model_name="form",
name="quick_access_slug",
field=models.UUIDField(
blank=True,
default=uuid.uuid4,
help_text="Permettant d'accéder directement au formulaire par l'url: https://geocity.ch/?form=demande-macaron",
unique=True,
validators=[
django.core.validators.RegexValidator(
re.compile("^[-a-zA-Z0-9_]+\\Z"),
"Enter a valid “slug” consisting of letters, numbers, underscores or hyphens.",
"invalid",
)
],
verbose_name="URL courte",
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ <h2>{% translate "Validation" %}</h2>
{% for validation in validations %}
<div class="container">
<dl>
<dt> {{ validation.department.group.name }} </dt>
<dt> {{ validation.department }} </dt>
<dd{% if validation.is_pending %} class="text-muted"{% endif %}>
{% if 'Approuvé' in validation.get_validation_status_display %}
<i class="fa fa-check-circle" aria-hidden="true"></i>&#x202F;
Expand Down

0 comments on commit b2636ad

Please sign in to comment.