mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-06 20:11:37 +00:00
Flakey
Fixing python style errors
This commit is contained in:
@@ -3,9 +3,6 @@ from django_filters import NumberFilter
|
||||
|
||||
from rest_framework import generics, permissions, response
|
||||
|
||||
|
||||
|
||||
|
||||
# from InvenTree.models import FilterChildren
|
||||
from .models import StockLocation, StockItem
|
||||
from .serializers import StockItemSerializer, StockQuantitySerializer
|
||||
|
@@ -14,7 +14,6 @@ class EditStockLocationForm(forms.ModelForm):
|
||||
self.helper.form_id = 'id-edit-part-form'
|
||||
self.helper.form_class = 'blueForms'
|
||||
self.helper.form_method = 'post'
|
||||
#self.helper.form_action = 'submit'
|
||||
|
||||
self.helper.add_input(Submit('submit', 'Submit'))
|
||||
|
||||
@@ -36,11 +35,9 @@ class EditStockItemForm(forms.ModelForm):
|
||||
self.helper.form_id = 'id-edit-part-form'
|
||||
self.helper.form_class = 'blueForms'
|
||||
self.helper.form_method = 'post'
|
||||
#self.helper.form_action = 'submit'
|
||||
|
||||
self.helper.add_input(Submit('submit', 'Submit'))
|
||||
|
||||
|
||||
class Meta:
|
||||
model = StockItem
|
||||
fields = [
|
||||
@@ -49,4 +46,4 @@ class EditStockItemForm(forms.ModelForm):
|
||||
'location',
|
||||
'quantity',
|
||||
'status'
|
||||
]
|
||||
]
|
||||
|
@@ -14,6 +14,7 @@ from datetime import datetime
|
||||
from django.db.models.signals import pre_delete
|
||||
from django.dispatch import receiver
|
||||
|
||||
|
||||
class StockLocation(InvenTreeTree):
|
||||
""" Organization tree for StockItem objects
|
||||
A "StockLocation" can be considered a warehouse, or storage location
|
||||
@@ -47,6 +48,7 @@ def before_delete_stock_location(sender, instance, using, **kwargs):
|
||||
child.parent = instance.parent
|
||||
child.save()
|
||||
|
||||
|
||||
class StockItem(models.Model):
|
||||
|
||||
def get_absolute_url(self):
|
||||
|
@@ -1,5 +1,4 @@
|
||||
from django.conf.urls import url, include
|
||||
from django.views.generic.base import RedirectView
|
||||
|
||||
from . import views
|
||||
from . import api
|
||||
@@ -58,4 +57,4 @@ stock_urls = [
|
||||
url(r'^item/(?P<pk>\d+)/', include(stock_item_detail_urls)),
|
||||
|
||||
url(r'^.*$', views.StockIndex.as_view(), name='stock-index'),
|
||||
]
|
||||
]
|
||||
|
@@ -1,6 +1,5 @@
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
|
||||
from django.views.generic import DetailView, ListView
|
||||
from django.views.generic.edit import UpdateView, DeleteView, CreateView
|
||||
@@ -11,6 +10,7 @@ from .models import StockItem, StockLocation
|
||||
from .forms import EditStockLocationForm
|
||||
from .forms import EditStockItemForm
|
||||
|
||||
|
||||
class StockIndex(ListView):
|
||||
model = StockItem
|
||||
template_name = 'stock/index.html'
|
||||
@@ -29,6 +29,7 @@ class StockIndex(ListView):
|
||||
|
||||
return context
|
||||
|
||||
|
||||
class StockLocationDetail(DetailView):
|
||||
context_object_name = 'location'
|
||||
template_name = 'stock/location.html'
|
||||
@@ -118,4 +119,4 @@ class StockItemDelete(DeleteView):
|
||||
if 'confirm' in request.POST:
|
||||
return super(StockItemDelete, self).post(request, *args, **kwargs)
|
||||
else:
|
||||
return HttpResponseRedirect(self.get_object().get_absolute_url())
|
||||
return HttpResponseRedirect(self.get_object().get_absolute_url())
|
||||
|
Reference in New Issue
Block a user