combined member and material system
parent
6dd141b3fa
commit
0f02570657
@ -1,12 +1,22 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import MaterialPart
|
from .models import MaterialPart, Ownership
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
class OwnershipInline(admin.StackedInline):
|
||||||
|
"""
|
||||||
|
This shows the ownership selection directly in the MaterialPart edit
|
||||||
|
view
|
||||||
|
"""
|
||||||
|
model = Ownership
|
||||||
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
class MaterialAdmin(admin.ModelAdmin):
|
class MaterialAdmin(admin.ModelAdmin):
|
||||||
|
"""Edit view of a MaterialPart"""
|
||||||
fields = ['name', 'buy_date']
|
fields = ['name', 'buy_date']
|
||||||
list_display = ('name', 'buy_date', 'should_be_replaced')
|
list_display = ('name', 'buy_date', 'should_be_replaced')
|
||||||
|
inlines = [OwnershipInline]
|
||||||
|
|
||||||
admin.site.register(MaterialPart, MaterialAdmin)
|
admin.site.register(MaterialPart, MaterialAdmin)
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Generated by Django 1.10.2 on 2016-10-17 15:22
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('material', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='materialpart',
|
|
||||||
name='buy_date',
|
|
||||||
field=models.DateField(verbose_name='purchase date'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
Loading…
Reference in New Issue