PEP fixes

This commit is contained in:
Oliver Walters 2021-02-23 09:01:03 +11:00
parent 58863b1924
commit 832a6ef9a2
4 changed files with 12 additions and 7 deletions

View File

@ -269,13 +269,17 @@ class Build(MPTTModel):
else:
descendants = self.get_descendants(include_self=True)
Build.objects.filter(parent__pk__in=[d.pk for d in descendants])
def sub_build_count(self, cascade=True):
"""
Return the number of sub builds under this one.
Args:
cascade: If True (defualt), include cascading builds under sub builds
"""
return self.sub_builds(cascade=cascade).count()
@property
def is_overdue(self):
"""

View File

@ -25,6 +25,8 @@
{% block js_ready %}
{{ block.super }}
loadBuildTable($('#sub-build-table'), {
url: '{% url "api-build-list" %}',
filterTarget: "#filter-list-sub-build",

View File

@ -4,7 +4,6 @@ from __future__ import unicode_literals
from datetime import datetime, timedelta
from rest_framework.test import APITestCase
from rest_framework import status
from django.urls import reverse
from django.contrib.auth import get_user_model
@ -64,11 +63,11 @@ class BuildListTest(BuildAPITest):
url = reverse('api-build-list')
def get(self, status=200, data={}):
def get(self, status_code=200, data={}):
response = self.client.get(self.url, data, format='json')
self.assertEqual(response.status_code, status)
self.assertEqual(response.status_code, status_code)
return response.data
@ -102,7 +101,7 @@ class BuildListTest(BuildAPITest):
part = Part.objects.get(pk=50)
build = Build.objects.create(
Build.objects.create(
part=part,
quantity=10,
title='Just some thing',

View File

@ -2,9 +2,9 @@
{% load i18n %}
{% load report %}
{% load barcode %}
{% load inventree_extras %}
{% load markdownify %}
{% load qr_code %}
{% block page_margin %}
margin: 2cm;