diff --git a/equipment/admin.py b/equipment/admin.py index f4b0091..bcadaa1 100644 --- a/equipment/admin.py +++ b/equipment/admin.py @@ -61,8 +61,8 @@ class CharFieldModelAdmin(admin.ModelAdmin): class EquipmentAdmin(admin.ModelAdmin): - list_display = ['name', 'stock', 'pole', 'category'] - ordering = ['name', 'pole', 'category'] + list_display = ['name', 'stock', 'owner', 'pole', 'category'] + ordering = ['name', 'owner', 'pole', 'category'] inlines = [EquipmentDefaultExtraInline, EquipmentLostExtraInline, EquipmentRevisionExtraInline] diff --git a/equipment/migrations/0004_equipment_owner.py b/equipment/migrations/0004_equipment_owner.py new file mode 100644 index 0000000..ad90cae --- /dev/null +++ b/equipment/migrations/0004_equipment_owner.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.11 on 2018-08-07 18:44 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('auth', '0008_alter_user_username_max_length'), + ('equipment', '0003_auto_20180807_1843'), + ] + + operations = [ + migrations.AddField( + model_name='equipment', + name='owner', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='auth.Group'), + ), + ] diff --git a/equipment/models.py b/equipment/models.py index 7120c4e..9b47dff 100644 --- a/equipment/models.py +++ b/equipment/models.py @@ -50,6 +50,11 @@ class Equipment(EventSpecificMixin, models.Model): related_name="equipment", through="EquipmentAttribution", ) + owner = models.ForeignKey( + Group, + blank=True, + null=True, + ) pole = models.ForeignKey( EquipmentPole, )