add group owner

This commit is contained in:
Qwann 2018-08-07 20:44:57 +02:00
parent a5cb99c0c3
commit 4c1a1da64f
3 changed files with 29 additions and 2 deletions

View file

@ -61,8 +61,8 @@ class CharFieldModelAdmin(admin.ModelAdmin):
class EquipmentAdmin(admin.ModelAdmin): class EquipmentAdmin(admin.ModelAdmin):
list_display = ['name', 'stock', 'pole', 'category'] list_display = ['name', 'stock', 'owner', 'pole', 'category']
ordering = ['name', 'pole', 'category'] ordering = ['name', 'owner', 'pole', 'category']
inlines = [EquipmentDefaultExtraInline, inlines = [EquipmentDefaultExtraInline,
EquipmentLostExtraInline, EquipmentLostExtraInline,
EquipmentRevisionExtraInline] EquipmentRevisionExtraInline]

View file

@ -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'),
),
]

View file

@ -50,6 +50,11 @@ class Equipment(EventSpecificMixin, models.Model):
related_name="equipment", related_name="equipment",
through="EquipmentAttribution", through="EquipmentAttribution",
) )
owner = models.ForeignKey(
Group,
blank=True,
null=True,
)
pole = models.ForeignKey( pole = models.ForeignKey(
EquipmentPole, EquipmentPole,
) )