change owner to group
This commit is contained in:
parent
788a2077e2
commit
c8f5df3a13
3 changed files with 27 additions and 17 deletions
|
@ -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)
|
||||
|
|
24
equipment/migrations/0003_auto_20180807_1828.py
Normal file
24
equipment/migrations/0003_auto_20180807_1828.py
Normal file
|
@ -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',
|
||||
),
|
||||
]
|
|
@ -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,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue