type hinting
This commit is contained in:
parent
e264df3bf3
commit
e847ce9fe6
2 changed files with 20 additions and 1 deletions
17
src/c3nav/editor/templates/editor/graph.html
Normal file
17
src/c3nav/editor/templates/editor/graph.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% load bootstrap3 %}
|
||||
{% load i18n %}
|
||||
{% include 'editor/fragment_levels.html' %}
|
||||
|
||||
<h3>{{ space.title }}</h3>
|
||||
<p>
|
||||
<a class="btn btn-default btn-xs" accesskey="e" href="{% url 'editor.spaces.edit' level=space.level.pk pk=space.pk %}">
|
||||
{% trans 'Space' as model_title %}
|
||||
<i class="glyphicon glyphicon-pencil"></i> {% blocktrans %}Edit {{ model_title }}{% endblocktrans %}
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="{% url 'editor.spaces.list' level=space.level.pk %}">« {% trans 'back to overview' %}</a>
|
||||
</p>
|
||||
{% bootstrap_messages %}
|
||||
|
||||
{% include 'editor/fragment_child_models.html' %}
|
|
@ -1,7 +1,9 @@
|
|||
import typing
|
||||
from contextlib import suppress
|
||||
|
||||
from django.contrib import messages
|
||||
from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist
|
||||
from django.db import models
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
@ -9,7 +11,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from c3nav.editor.views.base import sidebar_view
|
||||
|
||||
|
||||
def child_model(request, model, kwargs=None, parent=None):
|
||||
def child_model(request, model: typing.Union[str, models.Model], kwargs=None, parent=None):
|
||||
model = request.changeset.wrap_model(model)
|
||||
related_name = model._meta.default_related_name
|
||||
if parent is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue