2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Added pages for /supplier/

- Supplier list view
- Supplier detail view /supplier/<pk>/
- Added create / edit / delete views for supplier
- Supplier part detail at /supplier/part/<pk>
- Added create / edit / delete views for supplier part
- Added some templates to make things easier
This commit is contained in:
Oliver
2018-04-15 15:35:01 +10:00
parent 8232baeed7
commit ab4b91cd46
25 changed files with 321 additions and 119 deletions

View File

@ -12,7 +12,7 @@ class EditPartForm(forms.ModelForm):
self.helper = FormHelper()
self.helper.form_id = 'id-edit-part-form'
self.helper.form_class = 'blueForms'
#self.helper.form_class = 'blueForms'
self.helper.form_method = 'post'
#self.helper.form_action = 'submit'
@ -38,7 +38,7 @@ class EditCategoryForm(forms.ModelForm):
self.helper = FormHelper()
self.helper.form_id = 'id-edit-part-form'
self.helper.form_class = 'blueForms'
#self.helper.form_class = 'blueForms'
self.helper.form_method = 'post'
#self.helper.form_action = 'submit'

View File

@ -0,0 +1,19 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<div class='panel panel-primary'>
<div class='panel-heading'>
{% block obj_title %}
Object title goes here
{% endblock %}
</div>
<div class='panel-body'>
{% load crispy_forms_tags %}
{% crispy form %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,26 @@
{% extends "base.html" %}
{% block content %}
<div class="panel panel-danger">
<div class="panel-heading">
{% block del_title %}
Deletion title goes here
{% endblock %}
</div>
<div class="panel-body">
<p><b>This is a permanent action and cannot be undone.</b></p>
{% block del_body %}
Deletion body goes here
{% endblock %}
<form action="" method="post">{% csrf_token %}
<input type="submit" name='confirm' value="Confirm" />
<input type="submit" name="cancel" value="Cancel" />
</form>
</div>
</div>
{% endblock %}

View File

@ -1,12 +1,10 @@
{% extends 'base.html' %}
{% extends 'delete_obj.html' %}
{% block content %}
{% block del_title %}
Are you sure you want to delete category '{{ category.name }}'?
{% endblock %}
<div class="panel panel-danger">
<div class="panel-heading">Are you sure you want to delete category '{{ category.name }}'?</div>
<div class='panel-body'>
<p><b>Deleting this category is a permanent action and cannot be undone.</b></p>
{% block del_body %}
{% if category.children.all|length > 0 %}
<p>This category contains {{ category.children.all|length }} child categories.<br>
@ -40,11 +38,4 @@
</ul>
{% endif %}
<form action="" method="post">{% csrf_token %}
<input type="submit" name='confirm' value="Confirm" />
<input type="submit" name="cancel" value="Cancel" />
</form>
</div>
</div>
{% endblock %}

View File

@ -17,10 +17,10 @@
<div class='container-fluid'>
<a href="{% url 'category-create' %}?category={{ category.id }}">
<button class="btn btn-default">New Category</button>
<button class="btn btn-success">New Category</button>
</a>
<a href="{% url 'part-create' %}?category={{ category.id }}">
<button class="btn btn-default">New Part</button>
<button class="btn btn-success">New Part</button>
</a>
<a href="{% url 'category-edit' category.id %}">

View File

@ -1,16 +1,5 @@
{% extends "base.html" %}
{% block content %}
{% include "part/cat_link.html" with category=category %}
<div class='panel panel-primary'>
<div class='panel-heading'>Edit details for category '{{ category.name }}'</div>
<div class='panel-body'>
{% load crispy_forms_tags %}
{% crispy form %}
</div>
</div>
{% extends "create_edit_obj.html" %}
{% block obj_title %}
Edit category '{{ category.name }}'
{% endblock %}

View File

@ -1,16 +1,5 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
{% include "part/cat_link.html" with category=category %}
<div class='panel panel-primary'>
<div class='panel-heading'>Create a new part category{% if category %} in category '{{ category.name }}'{% endif %}</div>
<div class='panel-body'>
{% load crispy_forms_tags %}
{% crispy form %}
{% extends "create_edit_obj.html" %}
{% block obj_title %}
Create a new part category{% if category %} in category '{{ category.name }}'{% endif %}
{% endblock %}

View File

@ -1,18 +1,5 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
{% include "part/cat_link.html" with category=category %}
<div class='panel panel-primary'>
<div class='panel-heading'>Create a new part{% if category %} in category '{{ category.name }}'{% endif %}</div>
<div class='panel-body'>
{% load crispy_forms_tags %}
{% crispy form %}
</div>
{% extends "create_edit_obj.html" %}
{% block obj_title %}
Create a new part{% if category %} in category '{{ category.name }}'{% endif %}
{% endblock %}

View File

@ -1,12 +1,11 @@
{% extends 'part/part_base.html' %}
{% extends "delete_obj.html" %}
{% block details %}
<div class="panel panel-danger">
<div class="panel-heading">Are you sure you want to delete part '{{ part.name }}'?</div>
<div class="panel-body">
{% block del_title %}
Are you sure you want to delete part '{{ part.name }}'?
{% endblock %}
<p><b>Deleting this part is a permanent action and cannot be undone.</b></p>
{% block del_body %}
{% if part.usedInCount > 0 %}
<p>This part is used in BOMs for {{ part.usedInCount }} other parts. If you delete this part, the BOMs for the following parts will be updated:
@ -41,11 +40,4 @@
<p>There are {{ part.serials.all|length }} unique parts tracked for '{{ part.name }}'. Deleting this part will permanently remove this tracking information.</p>
{% endif %}
<form action="" method="post">{% csrf_token %}
<input type="submit" name='confirm' value="Confirm" />
<input type="submit" name="cancel" value="Cancel" />
</form>
</div>
</div>
{% endblock %}

View File

@ -1,15 +1,5 @@
{% extends "part/part_base.html" %}
{% block details %}
<div class='panel panel-primary'>
<div class='panel-heading'>Edit details for part '{{ part.name }}'</div>
<div class='panel-body'>
{% load crispy_forms_tags %}
{% crispy form %}
</div>
{% extends "create_edit_obj.html" %}
{% block obj_title %}
Edit details for part '{{ part.name }}'
{% endblock %}

View File

@ -11,10 +11,10 @@
<div class='container-fluid'>
<a href="{% url 'category-create' %}">
<button class="btn btn-default">New Category</button>
<button class="btn btn-success">New Category</button>
</a>
<a href="{% url 'part-create' %}">
<button class="btn btn-default">New Part</button>
<button class="btn btn-success">New Part</button>
</a>
</div>
{% endblock %}

View File

@ -4,8 +4,6 @@ from django.views.generic.base import RedirectView
from . import views
from . import api
app_nam='part'
# URL list for part category API
part_cat_api_urls = [
@ -63,7 +61,7 @@ part_category_urls = [
part_urls = [
# Create a new category
url(r'^new_category/?', views.CategoryCreate.as_view(), name='category-create'),
url(r'^category/new/?', views.CategoryCreate.as_view(), name='category-create'),
# Create a new part
url(r'^new/?', views.PartCreate.as_view(), name='part-create'),