pepe is a racist meme

This commit is contained in:
Oliver Walters 2017-03-28 23:21:26 +11:00
parent 9aebdab1c2
commit a5009147c3
6 changed files with 18 additions and 14 deletions

View File

@ -34,6 +34,7 @@ class SupplierPart(models.Model):
description = models.CharField(max_length=250,
blank=True)
def __str__(self):
return "{mpn} - {supplier}".format(
mpn = self.MPN,
@ -53,9 +54,10 @@ class SupplierPriceBreak(models.Model):
currency = models.CharField(max_length=10,
blank=True)
def __str__(self):
return "{mpn} - {cost}{currency} @ {quan}".format(
mpn=part.MPN,
cost=self.cost,
currency=self.currency if self.currency else '',
quan=self.quantity)
quan=self.quantity)

View File

@ -8,4 +8,4 @@ urlpatterns = [
url(r'^(?P<supplier_id>[0-9]+)/$', views.supplierDetail, name='detail'),
url(r'^$', views.index, name='index')
]
]

View File

@ -3,11 +3,13 @@ from django.http import HttpResponse
from .models import Supplier
def index(request):
return HttpResponse("This is the suppliers page")
def supplierDetail(request, supplier_id):
supplier = get_object_or_404(Supplier, pk=supplier_id)
return render(request, 'supplier/detail.html',
{'supplier': supplier})
{'supplier': supplier})

View File

@ -2,7 +2,8 @@ from django.contrib import admin
from .models import UniquePart
class UniquePartAdmin(admin.ModelAdmin):
list_display = ('part', 'revision', 'serial', 'creation_date')
admin.site.register(UniquePart, UniquePartAdmin)
admin.site.register(UniquePart, UniquePartAdmin)

View File

@ -37,14 +37,14 @@ class UniquePart(models.Model):
PART_DESTROYED = 50
status = models.IntegerField(default=PART_IN_PROGRESS,
choices=[
(PART_IN_PROGRESS, "In progress"),
(PART_IN_STOCK, "In stock"),
(PART_SHIPPED, "Shipped"),
(PART_RETURNED, "Returned"),
(PART_DAMAGED, "Damaged"),
(PART_DESTROYED, "Destroyed"),
])
choices=[
(PART_IN_PROGRESS, "In progress"),
(PART_IN_STOCK, "In stock"),
(PART_SHIPPED, "Shipped"),
(PART_RETURNED, "Returned"),
(PART_DAMAGED, "Damaged"),
(PART_DESTROYED, "Destroyed"),
])
def __str__(self):
return self.part.name
@ -59,4 +59,4 @@ class PartTrackingInfo(models.Model):
part = models.ForeignKey(UniquePart, on_delete=models.CASCADE)
date = models.DateField(auto_now_add=True,
editable=False)
notes = models.CharField(max_length=500)
notes = models.CharField(max_length=500)

View File

@ -4,4 +4,3 @@ from django.http import HttpResponse
def index(request):
return HttpResponse("This is the Tracking page")