PEP fixes

This commit is contained in:
Oliver Walters 2019-04-18 23:47:04 +10:00
parent 8040ad8a6a
commit 456164f1d9
3 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,7 @@ def str2bool(text, test=True):
if test: if test:
return str(text).lower() in ['1', 'y', 'yes', 't', 'true', 'ok', ] return str(text).lower() in ['1', 'y', 'yes', 't', 'true', 'ok', ]
else: else:
return str(text).lower() in ['0', 'n', 'no', 'none', 'f', 'false',] return str(text).lower() in ['0', 'n', 'no', 'none', 'f', 'false', ]
def WrapWithQuotes(text): def WrapWithQuotes(text):

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
from django.db import models from django.db import models
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from rest_framework.exceptions import ValidationError from rest_framework.exceptions import ValidationError
from .helpers import str2bool
from django.db.models.signals import pre_delete from django.db.models.signals import pre_delete
from django.dispatch import receiver from django.dispatch import receiver

View File

@ -50,7 +50,7 @@ class PartCreate(AjaxCreateView):
""" """
model = Part model = Part
form_class = EditPartForm form_class = EditPartForm
ajax_form_title = 'Create new part' ajax_form_title = 'Create new part'
ajax_template_name = 'modal_form.html' ajax_template_name = 'modal_form.html'
@ -89,7 +89,7 @@ class PartCreate(AjaxCreateView):
initials = super(PartCreate, self).get_initial() initials = super(PartCreate, self).get_initial()
else: else:
initials = super(PartCreate, self).get_initial() initials = super(PartCreate, self).get_initial()
if self.get_category_id(): if self.get_category_id():
initials['category'] = get_object_or_404(PartCategory, pk=self.get_category_id()) initials['category'] = get_object_or_404(PartCategory, pk=self.get_category_id())