mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Modified configs so that templates are rendered. Functionality and styling are NOT complete (need to change css framework)
This commit is contained in:
@@ -58,7 +58,7 @@ INSTALLED_APPS = (
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'RIGS',
|
||||
'assets'
|
||||
'assets',
|
||||
|
||||
'debug_toolbar',
|
||||
'registration',
|
||||
|
||||
@@ -12,7 +12,7 @@ urlpatterns = [
|
||||
# url(r'^blog/', include('blog.urls')),
|
||||
|
||||
url(r'^', include('RIGS.urls')),
|
||||
url('assets', include('assets.urls')),
|
||||
url('^assets/', include('assets.urls')),
|
||||
url('^user/register/$', RegistrationView.as_view(form_class=RIGS.forms.ProfileRegistrationFormUniqueEmail),
|
||||
name="registration_register"),
|
||||
url('^user/', include('django.contrib.auth.urls')),
|
||||
|
||||
@@ -16,23 +16,7 @@ function filterAssetTable() {
|
||||
});
|
||||
}
|
||||
|
||||
function updateAsset() {
|
||||
$.ajax({
|
||||
url : "/asset/update/", // the endpoint
|
||||
type : "POST", // http method
|
||||
data : {
|
||||
form: $('#asset_update_form').serialize()
|
||||
},
|
||||
traditional: true,
|
||||
|
||||
success : function(data) {
|
||||
// console.log(data);
|
||||
window.location.href = data['url'];
|
||||
},
|
||||
|
||||
error : function(xhr) {console.log(xhr.status + ": " + xhr.responseText)}
|
||||
});
|
||||
}
|
||||
|
||||
function formAssetSearch() {
|
||||
$.ajax({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}List{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% block content %}
|
||||
|
||||
<h4>Asset List</h4>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% block title %}Asset {{ object.asset_id }}{% endblock %}
|
||||
|
||||
|
||||
{% block main %}
|
||||
{% block content %}
|
||||
|
||||
<h4>
|
||||
{% if edit and object %}
|
||||
@@ -294,7 +294,26 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
{% block js %}
|
||||
<script>
|
||||
function updateAsset() {
|
||||
$.ajax({
|
||||
url: "{% url 'ajax_asset_update' %}", // the endpoint
|
||||
type: "POST", // http method
|
||||
data: {
|
||||
form: $('#asset_update_form').serialize()
|
||||
},
|
||||
traditional: true,
|
||||
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
window.location.href = data['url'];
|
||||
},
|
||||
|
||||
error: function (xhr) { console.log(xhr.status + ": " + xhr.responseText) }
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{# <script>#}
|
||||
{# $('#asset_update_form').on('submit', function(event){#}
|
||||
@@ -323,5 +342,4 @@
|
||||
M.updateTextFields();
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
16
assets/templates/confirm_delete.html
Normal file
16
assets/templates/confirm_delete.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<div id="confirm_delete_modal" class="modal">
|
||||
<form method="post" id="confirm_delete_form">
|
||||
{% csrf_token %}
|
||||
<div class="modal-content">
|
||||
<h4>Confirm Delete</h4>
|
||||
<p>Are you sure you want to delete asset:
|
||||
<strong>{{ object }}</strong>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="modal-close btn-flat" onclick="deleteAsset({{ object.id }})">Delete</button>
|
||||
{# <a href="#" class="modal-close btn-flat green">Close</a>#}
|
||||
<a href="#" class="modal-close btn-flat red">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
17
assets/templates/helpers/paginator.html
Normal file
17
assets/templates/helpers/paginator.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% if is_paginated %}
|
||||
<ul class="pagination center-align">
|
||||
{% if page_obj.has_previous %}
|
||||
<li class="waves-effect"><a href="?page={{ page_obj.previous_page_number }}" class="no-pad"><i class="material-icons nnt-purple">chevron_left</i></a></li>
|
||||
{% else %}
|
||||
<li class="disabled"><i class="material-icons grey-text">chevron_left</i></li>
|
||||
{% endif %}
|
||||
|
||||
<li class="nnt-orange" id="page">{{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</li>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<li class="waves-effect"><a href="?page={{ page_obj.next_page_number }}" class="no-pad"><i class="material-icons nnt-purple">chevron_right</i></a></li>
|
||||
{% else %}
|
||||
<li class="disabled"><i class="material-icons grey-text">chevron_right</i></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
15
assets/templates/helpers/render_field.html
Normal file
15
assets/templates/helpers/render_field.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% load widget_tweaks %}
|
||||
|
||||
<div class="input-field col {{ width|default:'s12' }}">
|
||||
{% if css %}
|
||||
{% render_field field|add_class:css %}
|
||||
{% elif disable_if_filled and field.value %}
|
||||
{% render_field field|attr:'disabled' %}
|
||||
{% elif css and disable_if_filled %}
|
||||
{% render_field field|add_class:css|attr:'disabled' %}
|
||||
{% else %}
|
||||
{{ field }}
|
||||
{% endif %}
|
||||
<label for="{{ field.id_for_label }}">{{ label|default:field.label }}</label>
|
||||
<span class="helper-text" data-error="{{ field.errors.text }}"></span>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Detail{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% block content %}
|
||||
{{ object }}
|
||||
{% endblock %}
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}List{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% block content %}
|
||||
|
||||
<h4>Supplier List</h4>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Edit{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% block content %}
|
||||
|
||||
<h4>
|
||||
Supplier
|
||||
|
||||
@@ -28,11 +28,6 @@ class PasswordChange(auth_views.PasswordChangeView):
|
||||
def get_success_url(self):
|
||||
return reverse_lazy('profile_detail', kwargs={'pk': self.request.user.id})
|
||||
|
||||
|
||||
class Index(LoginRequiredMixin, generic.TemplateView):
|
||||
template_name = 'index.html'
|
||||
|
||||
|
||||
class AssetList(LoginRequiredMixin, generic.ListView):
|
||||
model = models.Asset
|
||||
template_name = 'asset_list.html'
|
||||
|
||||
2
pytest.ini
Normal file
2
pytest.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
DJANGO_SETTINGS_MODULE = myproject.settings
|
||||
Reference in New Issue
Block a user