admin: fixup some urls

This commit is contained in:
Jens Langhammer 2020-05-28 10:36:10 +02:00
parent bc495828e7
commit fdfc6472d2
5 changed files with 21 additions and 11 deletions

View file

@ -81,7 +81,7 @@
<li class="pf-c-nav__item"> <li class="pf-c-nav__item">
<a href="{% url 'passbook_admin:stage-prompts' %}" <a href="{% url 'passbook_admin:stage-prompts' %}"
class="pf-c-nav__link {% is_active 'passbook_admin:stage-prompts' 'passbook_admin:stage-prompt-create' 'passbook_admin:stage-prompt-update' 'passbook_admin:stage-prompt-delete' %}"> class="pf-c-nav__link {% is_active 'passbook_admin:stage-prompts' 'passbook_admin:stage-prompt-create' 'passbook_admin:stage-prompt-update' 'passbook_admin:stage-prompt-delete' %}">
{% trans 'Stage Prompts' %} {% trans 'Prompts' %}
</a> </a>
</li> </li>
<li class="pf-c-nav__item"> <li class="pf-c-nav__item">

View file

@ -66,8 +66,8 @@
</ul> </ul>
</td> </td>
<td> <td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:stage-update' pk=stage.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> <a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:stage-update' pk=stage.stage_uuid %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:stage-delete' pk=stage.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> <a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:stage-delete' pk=stage.stage_uuid %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
{% get_links stage as links %} {% get_links stage as links %}
{% for name, href in links.items %} {% for name, href in links.items %}
<a class="pf-c-button pf-m-tertiary" href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a> <a class="pf-c-button pf-m-tertiary" href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a>

View file

@ -26,7 +26,9 @@
<table class="pf-c-table pf-m-compact pf-m-grid-xl" role="grid"> <table class="pf-c-table pf-m-compact pf-m-grid-xl" role="grid">
<thead> <thead>
<tr role="row"> <tr role="row">
<th role="columnheader" scope="col">{% trans 'Name' %}</th> <th role="columnheader" scope="col">{% trans 'Field' %}</th>
<th role="columnheader" scope="col">{% trans 'Label' %}</th>
<th role="columnheader" scope="col">{% trans 'Type' %}</th>
<th role="columnheader" scope="col">{% trans 'Flows' %}</th> <th role="columnheader" scope="col">{% trans 'Flows' %}</th>
<th role="cell"></th> <th role="cell"></th>
</tr> </tr>
@ -37,19 +39,30 @@
<th role="columnheader"> <th role="columnheader">
<div> <div>
<div>{{ prompt.field_key }}</div> <div>{{ prompt.field_key }}</div>
<small>{{ prompt|verbose_name }}</small>
</div> </div>
</th> </th>
<td role="cell">
<div>
{{ prompt.label }}
</div>
</td>
<td role="cell">
<div>
{{ prompt.type }}
</div>
</td>
<td role="cell"> <td role="cell">
<ul> <ul>
{% for flow in prompt.flow_set.all %} {% for flow in prompt.flow_set.all %}
<li><a href="{% url 'passbook_admin:flow-update' pk=flow.pk %}">{{ flow.slug }}</a></li> <li><a href="{% url 'passbook_admin:flow-update' pk=flow.pk %}">{{ flow.slug }}</a></li>
{% empty %}
<li>-</li>
{% endfor %} {% endfor %}
</ul> </ul>
</td> </td>
<td> <td>
<a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:prompt-update' pk=prompt.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a> <a class="pf-c-button pf-m-secondary" href="{% url 'passbook_admin:stage-prompt-update' pk=prompt.pk %}?back={{ request.get_full_path }}">{% trans 'Edit' %}</a>
<a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:prompt-delete' pk=prompt.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a> <a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:stage-prompt-delete' pk=prompt.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
{% get_links prompt as links %} {% get_links prompt as links %}
{% for name, href in links.items %} {% for name, href in links.items %}
<a class="pf-c-button pf-m-tertiary" href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a> <a class="pf-c-button pf-m-tertiary" href="{{ href }}?back={{ request.get_full_path }}">{% trans name %}</a>

View file

@ -1,7 +1,6 @@
"""Flow and Stage forms""" """Flow and Stage forms"""
from django import forms from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from passbook.flows.models import Flow, FlowStageBinding from passbook.flows.models import Flow, FlowStageBinding
@ -17,7 +16,6 @@ class FlowForm(forms.ModelForm):
"name", "name",
"slug", "slug",
"designation", "designation",
"stages",
] ]
help_texts = { help_texts = {
"name": _("Shown as the Title in Flow pages."), "name": _("Shown as the Title in Flow pages."),
@ -31,7 +29,6 @@ class FlowForm(forms.ModelForm):
} }
widgets = { widgets = {
"name": forms.TextInput(), "name": forms.TextInput(),
"stages": FilteredSelectMultiple(_("stages"), False),
} }

View file

@ -74,7 +74,7 @@ class Prompt(models.Model):
return super().save(*args, **kwargs) return super().save(*args, **kwargs)
def __str__(self): def __str__(self):
return f"Prompt '{self.field_key}' type={self.type}'" return f"Prompt '{self.field_key}' type={self.type}"
class Meta: class Meta: