add new view CustomerHostingPackageList
- create view hostingpackages.views.CustomerHostingPackageList to display a specific customer's hosting packages - add docstring to view AllCustomerHostingPackageList - add URL pattern 'hosting_packages' to hostingpackages.urls - restructure hostingpackages URL patterns to remove useless parts - add template hostingpackages/customerhostingpackage_list.html - change links in template base.html to link to 'hosting_packages'
This commit is contained in:
parent
3f07ddb062
commit
2d4282194f
4 changed files with 92 additions and 7 deletions
|
@ -0,0 +1,43 @@
|
|||
{% extends "hostingpackages/base.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{{ block.super }} - {% spaceless %}
|
||||
{% if user == customer %}
|
||||
{% trans "Your hosting packages" %}
|
||||
{% else %}
|
||||
{% blocktrans with customer=customer.get_full_name %}Hosting Packages of {{ customer }}{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% endspaceless %}{% endblock title %}
|
||||
|
||||
{% block page_title %}{% spaceless %}
|
||||
{% if user == customer %}
|
||||
{% trans "Your hosting packages" %}
|
||||
{% else %}
|
||||
{% blocktrans with customer=customer.get_full_name %}Hosting Packages <small>of {{ customer }}</small>{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% endspaceless %}{% endblock page_title %}
|
||||
|
||||
{% block content %}
|
||||
{% if customerhostingpackage_list %}
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Name" %}</th>
|
||||
<th>{% trans "Setup date" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for package in customerhostingpackage_list %}
|
||||
<tr>
|
||||
<td><a href="{{ package.get_absolute_url }}">{{ package.name }}</a></td>
|
||||
<td>{{ package.created }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="text-info">{% if user == customer %}{% trans "You have no hosting packages setup yet." %}{% else %}{% trans "There are no hosting packages setup for this customer yet." %}{% endif %}</p>
|
||||
{% endif %}
|
||||
{% if user.is_staff %}
|
||||
<p><a href="{% url 'create_customer_hosting_package' user=customer.username %}" class="btn btn-primary">{% trans "Add hosting package" %}</a></p>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
Loading…
Add table
Add a link
Reference in a new issue