diff --git a/equipment/admin.py b/equipment/admin.py index 7c4de9c..bcadaa1 100644 --- a/equipment/admin.py +++ b/equipment/admin.py @@ -1,7 +1,7 @@ from django.contrib import admin from django import forms -from .models import Equipment, EquipmentDefault, EquipmentRevision, EquipmentOwner, EquipmentPole, EquipmentCategory, EquipmentLost +from .models import Equipment, EquipmentDefault, EquipmentRevision, EquipmentPole, EquipmentCategory, EquipmentLost from .fields import IdField, IdWidget from shared.admin import admin_site @@ -69,7 +69,6 @@ class EquipmentAdmin(admin.ModelAdmin): admin_site.register(Equipment, EquipmentAdmin) -admin_site.register(EquipmentOwner, CharFieldModelAdmin) admin_site.register(EquipmentPole, CharFieldModelAdmin) admin_site.register(EquipmentCategory, CharFieldModelAdmin) admin.site.register(Equipment, EquipmentAdmin) diff --git a/equipment/migrations/0003_auto_20180807_1828.py b/equipment/migrations/0003_auto_20180807_1828.py new file mode 100644 index 0000000..3ce898d --- /dev/null +++ b/equipment/migrations/0003_auto_20180807_1828.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.11 on 2018-08-07 18:28 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('equipment', '0002_auto_20180807_1658'), + ] + + operations = [ + migrations.AlterField( + model_name='equipment', + name='owner', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='auth.Group'), + ), + migrations.DeleteModel( + name='EquipmentOwner', + ), + ] diff --git a/equipment/models.py b/equipment/models.py index 7a9e5e3..9b47dff 100644 --- a/equipment/models.py +++ b/equipment/models.py @@ -1,6 +1,7 @@ from django.db import models from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ +from django.contrib.auth.models import Group from event.models import Activity, EventSpecificMixin from .fields import IdField @@ -9,20 +10,6 @@ from taggit.managers import TaggableManager from datetime import date -class EquipmentOwner(models.Model): - name = models.CharField( - _("nom"), - max_length=200, - ) - - class Meta: - verbose_name = _("propriétaire de matériel") - verbose_name_plural = _("propriétaires de matériel") - - def __str__(self): - return self.name - - class EquipmentPole(models.Model): name = models.CharField( _("nom"), @@ -64,7 +51,7 @@ class Equipment(EventSpecificMixin, models.Model): through="EquipmentAttribution", ) owner = models.ForeignKey( - EquipmentOwner, + Group, blank=True, null=True, )