Initial updates required to run under django 2.2

- Change to middleware.py
- Change some URLs formatting
- Fix django version at 2.2
This commit is contained in:
Oliver Walters 2019-04-12 20:44:22 +10:00
parent ceea053368
commit c67dc6f56e
6 changed files with 67 additions and 4 deletions

View File

@ -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'):

View File

@ -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'),

View 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)]),
),
]

View 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'),
),
]

View 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)]),
),
]

View File

@ -1,4 +1,4 @@
Django>=1.11
Django==2.2
pillow>=5.0.0
djangorestframework>=3.6.2
django_filter>=1.0.2