Added ability to mark project part as "output" (generated BY project)

This commit is contained in:
Oliver 2017-04-11 23:22:05 +10:00
parent 4a74cd2199
commit 08fc21eb9b
3 changed files with 7 additions and 2 deletions

View File

@ -12,7 +12,7 @@ class ProjectAdmin(admin.ModelAdmin):
class ProjectPartAdmin(admin.ModelAdmin):
list_display = ('part', 'project', 'quantity')
list_display = ('part', 'project', 'quantity', 'output')
class ProjectRunAdmin(admin.ModelAdmin):

View File

@ -64,6 +64,10 @@ class ProjectPart(models.Model):
default=OVERAGE_ABSOLUTE,
choices=OVARAGE_CODES.items())
# Set if the part is generated by the project,
# rather than being consumed by the project
output = models.BooleanField(default=False)
def __str__(self):
return "{quan} x {name}".format(
name=self.part.name,

View File

@ -12,7 +12,8 @@ class ProjectPartSerializer(serializers.ModelSerializer):
'project',
'quantity',
'overage',
'overage_type')
'overage_type',
'output')
class ProjectBriefSerializer(serializers.ModelSerializer):