mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Papa Pep
This commit is contained in:
parent
b5dc22f33a
commit
7ce5a9a7e5
@ -43,7 +43,6 @@ class InvenTreeTree(models.Model):
|
|||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True)
|
null=True)
|
||||||
#limit_choices_to={id: getAcceptableParents})
|
|
||||||
|
|
||||||
def getUniqueChildren(self, unique=None):
|
def getUniqueChildren(self, unique=None):
|
||||||
""" Return a flat set of all child items that exist under this node.
|
""" Return a flat set of all child items that exist under this node.
|
||||||
|
@ -88,7 +88,7 @@ class PartRevision(models.Model):
|
|||||||
|
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
description = models.CharField(max_length=500)
|
description = models.CharField(max_length=500)
|
||||||
revision_date = models.DateField(auto_now_add = True)
|
revision_date = models.DateField(auto_now_add=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -6,6 +6,7 @@ from rest_framework import generics
|
|||||||
from .models import PartCategory, Part
|
from .models import PartCategory, Part
|
||||||
from .serializers import PartSerializer, PartCategorySerializer
|
from .serializers import PartSerializer, PartCategorySerializer
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
return HttpResponse("Hello world. This is the parts page")
|
return HttpResponse("Hello world. This is the parts page")
|
||||||
|
|
||||||
|
@ -2,12 +2,15 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from .models import ProjectCategory, Project, ProjectPart
|
from .models import ProjectCategory, Project, ProjectPart
|
||||||
|
|
||||||
|
|
||||||
class ProjectCategoryAdmin(admin.ModelAdmin):
|
class ProjectCategoryAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'path', 'description')
|
list_display = ('name', 'path', 'description')
|
||||||
|
|
||||||
|
|
||||||
class ProjectAdmin(admin.ModelAdmin):
|
class ProjectAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'description', 'category')
|
list_display = ('name', 'description', 'category')
|
||||||
|
|
||||||
|
|
||||||
class ProjectPartAdmin(admin.ModelAdmin):
|
class ProjectPartAdmin(admin.ModelAdmin):
|
||||||
list_display = ('part', 'project', 'quantity')
|
list_display = ('part', 'project', 'quantity')
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from django.db import models
|
|||||||
from InvenTree.models import InvenTreeTree
|
from InvenTree.models import InvenTreeTree
|
||||||
from part.models import Part
|
from part.models import Part
|
||||||
|
|
||||||
|
|
||||||
class ProjectCategory(InvenTreeTree):
|
class ProjectCategory(InvenTreeTree):
|
||||||
""" ProjectCategory provides hierarchical organization of Project objects.
|
""" ProjectCategory provides hierarchical organization of Project objects.
|
||||||
Each ProjectCategory can contain zero-or-more child categories,
|
Each ProjectCategory can contain zero-or-more child categories,
|
||||||
@ -15,6 +16,7 @@ class ProjectCategory(InvenTreeTree):
|
|||||||
verbose_name = "Project Category"
|
verbose_name = "Project Category"
|
||||||
verbose_name_plural = "Project Categories"
|
verbose_name_plural = "Project Categories"
|
||||||
|
|
||||||
|
|
||||||
class Project(models.Model):
|
class Project(models.Model):
|
||||||
""" A Project takes multiple Part objects.
|
""" A Project takes multiple Part objects.
|
||||||
A project can output zero-or-more Part objects
|
A project can output zero-or-more Part objects
|
||||||
@ -33,6 +35,7 @@ class Project(models.Model):
|
|||||||
"""
|
"""
|
||||||
return self.projectpart_set.all()
|
return self.projectpart_set.all()
|
||||||
|
|
||||||
|
|
||||||
class ProjectPart(models.Model):
|
class ProjectPart(models.Model):
|
||||||
""" A project part associates a single part with a project
|
""" A project part associates a single part with a project
|
||||||
The quantity of parts required for a single-run of that project is stored.
|
The quantity of parts required for a single-run of that project is stored.
|
||||||
@ -56,5 +59,5 @@ class ProjectPart(models.Model):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{quan} x {name}".format(
|
return "{quan} x {name}".format(
|
||||||
name = self.part.name,
|
name=self.part.name,
|
||||||
quan = self.quantity)
|
quan=self.quantity)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
return HttpResponse("This is the Projects page")
|
return HttpResponse("This is the Projects page")
|
@ -2,9 +2,11 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from .models import Warehouse, StockItem
|
from .models import Warehouse, StockItem
|
||||||
|
|
||||||
|
|
||||||
class WarehouseAdmin(admin.ModelAdmin):
|
class WarehouseAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'path', 'description')
|
list_display = ('name', 'path', 'description')
|
||||||
|
|
||||||
|
|
||||||
class StockItemAdmin(admin.ModelAdmin):
|
class StockItemAdmin(admin.ModelAdmin):
|
||||||
list_display = ('part', 'quantity', 'location', 'status', 'updated')
|
list_display = ('part', 'quantity', 'location', 'status', 'updated')
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ class StockItem(models.Model):
|
|||||||
|
|
||||||
status = models.IntegerField(default=ITEM_IN_PROGRESS,
|
status = models.IntegerField(default=ITEM_IN_PROGRESS,
|
||||||
choices=[
|
choices=[
|
||||||
(ITEM_IN_PROGRESS, "In progress"),
|
(ITEM_IN_PROGRESS, "In progress"),
|
||||||
(ITEM_DAMAGED, "Damaged"),
|
(ITEM_DAMAGED, "Damaged"),
|
||||||
(ITEM_ATTENTION, "Requires attention"),
|
(ITEM_ATTENTION, "Requires attention"),
|
||||||
(ITEM_COMPLETE, "Complete")
|
(ITEM_COMPLETE, "Complete")
|
||||||
])
|
])
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user