diff options
author | Kyle McFarland <tfkyle@gmail.com> | 2018-10-20 21:51:14 -0600 |
---|---|---|
committer | Kyle McFarland <tfkyle@gmail.com> | 2018-10-20 21:51:14 -0600 |
commit | 02ede72ce9ddeb4d7d7241503585bb07fe3e2c50 (patch) | |
tree | 0c3ce633cd75c9c4756aa4799ff17ca26b8f6b26 /procurement/templates | |
parent | bfdc219f139bf9645f29b95bf4cc7824138f87b7 (diff) | |
download | coding-assignment-02ede72ce9ddeb4d7d7241503585bb07fe3e2c50.zip coding-assignment-02ede72ce9ddeb4d7d7241503585bb07fe3e2c50.tar.gz coding-assignment-02ede72ce9ddeb4d7d7241503585bb07fe3e2c50.tar.bz2 |
Allow suppliers to have multiple representatives
This adds a basic Representative model and allows for editing them in
the admin interface both in the Suppliers admin panel for each
supplier and in a new Representatives admin panel which allows bulk
editing of all representatives. Currently multiple representatives are
just listed in the component view as extra rows below the company row
but it would probably make sense to add a view for viewing suppliers
directly.
The REST API has also been slightly modified to return a list of
representatives for each supplier in the components endpoint, adding a
suppliers endpoint would probably also be a good idea.
Requires running:
$ python manage.py migrate procurement 0002_add_representative
To update the database for the new model, both forward and lossy reverse
data migration is implemented in the migration.
Diffstat (limited to 'procurement/templates')
-rw-r--r-- | procurement/templates/procurement/includes/supplier_list.html | 12 | ||||
-rw-r--r-- | procurement/templates/procurement/source_components.html | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/procurement/templates/procurement/includes/supplier_list.html b/procurement/templates/procurement/includes/supplier_list.html index 028e62c..ffd7435 100644 --- a/procurement/templates/procurement/includes/supplier_list.html +++ b/procurement/templates/procurement/includes/supplier_list.html @@ -17,11 +17,17 @@ </thead> <tbody> {% for supplier in supplier_results %} + {% for representative in supplier.representatives.all %} <tr> + {% if forloop.first %} <td>{{ supplier.name }}</td> - <td>{{ supplier.representative_name }}</td> - <td>{{ supplier.representative_email }}</td> + {% else %} + <td></td> + {% endif %} + <td>{{ representative.name }}</td> + <td>{{ representative.email }}</td> </tr> + {% endfor %} {% empty %} <tr> <td colspan="3">No authorized suppliers found.</td> @@ -34,4 +40,4 @@ </div> <!-- /.panel-body --> </div> -<!-- / Supplier Results Panel -->
\ No newline at end of file +<!-- / Supplier Results Panel --> diff --git a/procurement/templates/procurement/source_components.html b/procurement/templates/procurement/source_components.html index 3eebf84..db412a2 100644 --- a/procurement/templates/procurement/source_components.html +++ b/procurement/templates/procurement/source_components.html @@ -42,6 +42,10 @@ <span class="record-updated text-muted small"><em>{{ suppliers_last_updated }}</em></span> </span> <span class="list-group-item"> + <span class="record-list"><i class="fa fa-users fa-fw"></i> {{ representative_count }} Representatives</span> + <span class="record-updated text-muted small"><em>{{ representatives_last_updated }}</em></span> + </span> + <span class="list-group-item"> <span class="record-list"><i class="fa fa-cog fa-fw"></i> {{ component_count }} Components</span> <span class="record-updated text-muted small"><em>{{ components_last_updated }}</em></span> </span> @@ -58,4 +62,4 @@ {% block additional_js %} <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script> <script src="{% static 'procurement/js/component_search.js' %}"></script> -{% endblock %}
\ No newline at end of file +{% endblock %} |