-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add admin actions for adding/removing tags/categories on Articles
- Loading branch information
1 parent
b22fe09
commit 4e86f26
Showing
5 changed files
with
363 additions
and
2 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
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,49 @@ | ||
{% extends "admin/base_site.html" %} | ||
{% load i18n l10n admin_urls static %} | ||
|
||
{% block extrahead %} | ||
{{ block.super }} | ||
{{ media }} | ||
{{ form.media }} | ||
<script src="{% static 'admin/js/cancel.js' %}" async></script> | ||
{% endblock %} | ||
|
||
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% 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> | ||
› {% translate 'Add Categories' %} | ||
</div> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<h2> | ||
{% translate "Selected Articles" %} | ||
</h2> | ||
|
||
<form method="post">{% csrf_token %} | ||
<div> | ||
<ul style="margin-bottom: 20px"> | ||
{% for obj in queryset %} | ||
<li> | ||
{{ obj.title }} | ||
<input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}"> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<div style="margin-bottom: 20px"> | ||
<label for="categories">{{ form.categories.label }}:</label> | ||
{{ form.categories }} | ||
</div> | ||
|
||
<input type="hidden" name="action" value="add_categories"> | ||
<input type="hidden" name="post" value="yes"> | ||
<input type="submit" value="{% translate 'Yes, I’m sure' %}"> | ||
<a href="#" class="button cancel-link">{% translate "No, take me back" %}</a> | ||
</div> | ||
</form> | ||
{% endblock %} |
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,49 @@ | ||
{% extends "admin/base_site.html" %} | ||
{% load i18n l10n admin_urls static %} | ||
|
||
{% block extrahead %} | ||
{{ block.super }} | ||
{{ media }} | ||
{{ form.media }} | ||
<script src="{% static 'admin/js/cancel.js' %}" async></script> | ||
{% endblock %} | ||
|
||
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% 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> | ||
› {% translate 'Add Tags' %} | ||
</div> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<h2> | ||
{% translate "Selected Articles" %} | ||
</h2> | ||
|
||
<form method="post">{% csrf_token %} | ||
<div> | ||
<ul style="margin-bottom: 20px"> | ||
{% for obj in queryset %} | ||
<li> | ||
{{ obj.title }} | ||
<input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}"> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<div style="margin-bottom: 20px"> | ||
<label for="tags">{{ form.tags.label }}:</label> | ||
{{ form.tags }} | ||
</div> | ||
|
||
<input type="hidden" name="action" value="add_tags"> | ||
<input type="hidden" name="post" value="yes"> | ||
<input type="submit" value="{% translate 'Yes, I’m sure' %}"> | ||
<a href="#" class="button cancel-link">{% translate "No, take me back" %}</a> | ||
</div> | ||
</form> | ||
{% endblock %} |
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,49 @@ | ||
add_categories.html{% extends "admin/base_site.html" %} | ||
{% load i18n l10n admin_urls static %} | ||
|
||
{% block extrahead %} | ||
{{ block.super }} | ||
{{ media }} | ||
{{ form.media }} | ||
<script src="{% static 'admin/js/cancel.js' %}" async></script> | ||
{% endblock %} | ||
|
||
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% 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> | ||
› {% translate 'Remove Categories' %} | ||
</div> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<h2> | ||
{% translate "Selected Articles" %} | ||
</h2> | ||
|
||
<form method="post">{% csrf_token %} | ||
<div> | ||
<ul style="margin-bottom: 20px"> | ||
{% for obj in queryset %} | ||
<li> | ||
{{ obj.title }} | ||
<input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}"> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<div style="margin-bottom: 20px"> | ||
<label for="categories">{{ form.categories.label }}:</label> | ||
{{ form.categories }} | ||
</div> | ||
|
||
<input type="hidden" name="action" value="remove_categories"> | ||
<input type="hidden" name="post" value="yes"> | ||
<input type="submit" value="{% translate 'Yes, I’m sure' %}"> | ||
<a href="#" class="button cancel-link">{% translate "No, take me back" %}</a> | ||
</div> | ||
</form> | ||
{% endblock %} |
Oops, something went wrong.