mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #100 from SchrodingersGat/master
Updated to django 2.2
This commit is contained in:
commit
426f460916
@ -14,7 +14,7 @@ class AuthRequiredMiddleware(object):
|
||||
|
||||
response = self.get_response(request)
|
||||
|
||||
if not request.user.is_authenticated():
|
||||
if not request.user.is_authenticated:
|
||||
print(request.path_info)
|
||||
|
||||
if not request.path_info == reverse_lazy('login'):
|
||||
|
@ -48,8 +48,8 @@ urlpatterns = [
|
||||
|
||||
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||
|
||||
url(r'^login/', auth_views.login, name='login'),
|
||||
url(r'^logout/', auth_views.logout, {'template_name': 'registration/logout.html'}, name='logout'),
|
||||
url(r'^login/', auth_views.LoginView.as_view(), name='login'),
|
||||
url(r'^logout/', auth_views.LogoutView.as_view(template_name='registration/logout.html'), name='logout'),
|
||||
url(r'^admin/', admin.site.urls, name='inventree-admin'),
|
||||
|
||||
url(r'^index/', IndexView.as_view(), name='index'),
|
||||
|
25
InvenTree/build/migrations/0002_auto_20190412_2030.py
Normal file
25
InvenTree/build/migrations/0002_auto_20190412_2030.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Generated by Django 2.2 on 2019-04-12 10:30
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('build', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='build',
|
||||
name='part',
|
||||
field=models.ForeignKey(limit_choices_to={'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='builds', to='part.Part'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='build',
|
||||
name='status',
|
||||
field=models.PositiveIntegerField(choices=[(10, 'Pending'), (20, 'Holding'), (30, 'Cancelled'), (40, 'Complete')], default=10, validators=[django.core.validators.MinValueValidator(0)]),
|
||||
),
|
||||
]
|
@ -58,7 +58,7 @@
|
||||
field: 'part',
|
||||
title: 'Part',
|
||||
formatter: function(value, row, index, field) {
|
||||
return renderLink(value.name, value.url);
|
||||
return renderLink(value.name, value.url + 'suppliers/');
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -73,6 +73,11 @@
|
||||
sortable: true,
|
||||
field: 'manufacturer',
|
||||
title: 'Manufacturer',
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'MPN',
|
||||
title: 'MPN',
|
||||
}
|
||||
],
|
||||
url: "{% url 'api-part-supplier-list' %}"
|
||||
|
@ -20,7 +20,7 @@
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
$('#new-company').click(function () {
|
||||
launchModalForm('#modal-form',
|
||||
launchModalForm(
|
||||
"{% url 'company-create' %}",
|
||||
{
|
||||
follow: true
|
||||
|
@ -35,7 +35,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
{% if part.URL %}
|
||||
<tr><td><URL></td><td><a href="{{ part.URL }}">{{ part.URL }}</a></td></tr>
|
||||
<tr><td>URL</td><td><a href="{{ part.URL }}">{{ part.URL }}</a></td></tr>
|
||||
{% endif %}
|
||||
{% if part.description %}
|
||||
<tr><td>Description</td><td>{{ part.description }}</td></tr>
|
||||
|
19
InvenTree/part/migrations/0003_auto_20190412_2030.py
Normal file
19
InvenTree/part/migrations/0003_auto_20190412_2030.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Generated by Django 2.2 on 2019-04-12 10:30
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('part', '0002_part_default_location'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='bomitem',
|
||||
name='part',
|
||||
field=models.ForeignKey(limit_choices_to={'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='bom_items', to='part.Part'),
|
||||
),
|
||||
]
|
@ -32,6 +32,7 @@ class PartBriefSerializer(serializers.ModelSerializer):
|
||||
'url',
|
||||
'name',
|
||||
'description',
|
||||
'available_stock',
|
||||
]
|
||||
|
||||
|
||||
|
@ -85,10 +85,29 @@
|
||||
},
|
||||
{
|
||||
field: 'quantity',
|
||||
title: 'Quantity',
|
||||
title: 'Required',
|
||||
searchable: false,
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'sub_part.available_stock',
|
||||
title: 'Available',
|
||||
searchable: false,
|
||||
sortable: true,
|
||||
formatter: function(value, row, index, field) {
|
||||
var text = "";
|
||||
if (row.quantity < row.sub_part.available_stock)
|
||||
{
|
||||
text = "<span class='label label-success'>" + value + "</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "<span class='label label-warning'>" + value + "</span>";
|
||||
}
|
||||
|
||||
return renderLink(text, row.sub_part.url + "stock/");
|
||||
}
|
||||
},
|
||||
{
|
||||
formatter: function(value, row, index, field) {
|
||||
return editButton(row.url + 'edit') + ' ' + deleteButton(row.url + 'delete');
|
||||
|
@ -173,7 +173,7 @@
|
||||
return renderLink(value, row.url + 'stock/');
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
return "<span class='label label-warning'>No stock</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,11 @@
|
||||
sortable: true,
|
||||
field: 'manufacturer',
|
||||
title: 'Manufacturer',
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'MPN',
|
||||
title: 'MPN',
|
||||
}
|
||||
],
|
||||
url: "{% url 'api-part-supplier-list' %}"
|
||||
|
19
InvenTree/stock/migrations/0004_auto_20190412_2030.py
Normal file
19
InvenTree/stock/migrations/0004_auto_20190412_2030.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Generated by Django 2.2 on 2019-04-12 10:30
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0003_auto_20180510_1042'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='stockitem',
|
||||
name='status',
|
||||
field=models.PositiveIntegerField(choices=[(10, 'OK'), (50, 'Attention needed'), (55, 'Damaged'), (60, 'Destroyed')], default=10, validators=[django.core.validators.MinValueValidator(0)]),
|
||||
),
|
||||
]
|
@ -1,4 +1,4 @@
|
||||
Django>=1.11
|
||||
Django==2.2
|
||||
pillow>=5.0.0
|
||||
djangorestframework>=3.6.2
|
||||
django_filter>=1.0.2
|
||||
|
Loading…
Reference in New Issue
Block a user