-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add form to set fields for fake incidents in admin
- Loading branch information
1 parent
ad042a0
commit 30ede8b
Showing
3 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add possibility to set fields when creating fake incidents in Django admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/argus/incident/templates/incident/admin/fake_incident_add_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{% extends "admin/base_site.html" %} | ||
{% load i18n admin_urls static admin_modify %} | ||
|
||
{% block extrahead %}{{ block.super }} | ||
<script src="{% url 'admin:jsi18n' %}"></script> | ||
{% endblock %} | ||
|
||
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" href="{% static "admin/css/forms.css" %}">{% endblock %} | ||
|
||
{% block coltype %}colM{% endblock %} | ||
|
||
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %} | ||
|
||
{% block breadcrumbs %} | ||
<div class="breadcrumbs"> | ||
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> | ||
› <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> | ||
› <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a> | ||
› {% blocktranslate with name=opts.verbose_name %}Add fake incident{% endblocktranslate %} | ||
</div> | ||
{% endblock %} | ||
|
||
{% block content %}<div id="content-main"> | ||
<form method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %} | ||
<div> | ||
{% if errors %} | ||
<p class="errornote"> | ||
{% blocktranslate count counter=errors|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktranslate %} | ||
</p> | ||
{{ adminform.form.non_field_errors }} | ||
{% endif %} | ||
|
||
{% block field_sets %} | ||
{% for fieldset in adminform %} | ||
{% include "admin/includes/fieldset.html" %} | ||
{% endfor %} | ||
{% endblock %} | ||
|
||
{% block after_field_sets %}{% endblock %} | ||
|
||
{% block after_related_objects %}{% endblock %} | ||
|
||
{% block submit_buttons_bottom %} | ||
<div class="submit-row"><input type="submit" value="{% translate 'Save' %}" class="default" name="_save"></div> | ||
{% endblock %} | ||
|
||
{% block admin_change_form_document_ready %} | ||
<script id="django-admin-form-add-constants" | ||
src="{% static 'admin/js/change_form.js' %}" | ||
data-model-name="{{ opts.model_name }}" | ||
async> | ||
</script> | ||
{% endblock %} | ||
|
||
{# JavaScript for prepopulated fields #} | ||
{% prepopulated_fields_js %} | ||
|
||
</div> | ||
</form></div> | ||
{% endblock %} |