update location model

This commit is contained in:
Robert Einsle 2017-02-04 06:51:09 +01:00
parent 7a7fbfb142
commit db051986a2
5 changed files with 12 additions and 4 deletions

View File

@ -5,7 +5,7 @@ from .models import *
@admin.register(Location) @admin.register(Location)
class LocationAdmin(admin.ModelAdmin): class LocationAdmin(admin.ModelAdmin):
list_display = ('code', 'name', 'city',) list_display = ('code', 'name', 'city',)
fields = ['code', 'name', 'street', 'plz', 'city', 'phone', 'email', 'url', ] fields = ['users', 'code', 'name', 'street', 'plz', 'city', 'phone', 'email', 'url', ]
@admin.register(Client) @admin.register(Client)

View File

@ -1,13 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-01 12:43 # Generated by Django 1.10.5 on 2017-02-04 05:47
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('billard', '0001_initial'), ('billard', '0001_initial'),
] ]
@ -24,6 +26,7 @@ class Migration(migrations.Migration):
('phone', models.CharField(blank=True, max_length=64, null=True)), ('phone', models.CharField(blank=True, max_length=64, null=True)),
('email', models.EmailField(blank=True, max_length=254, null=True)), ('email', models.EmailField(blank=True, max_length=254, null=True)),
('url', models.URLField(blank=True, null=True)), ('url', models.URLField(blank=True, null=True)),
('users', models.ManyToManyField(related_name='locations', to=settings.AUTH_USER_MODEL)),
], ],
), ),
] ]

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-01 17:49 # Generated by Django 1.10.5 on 2017-02-04 05:48
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-01 19:08 # Generated by Django 1.10.5 on 2017-02-04 05:48
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
@ -24,5 +24,8 @@ class Migration(migrations.Migration):
('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Client')), ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Client')),
('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Location')), ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Location')),
], ],
options={
'ordering': ['-time_from'],
},
), ),
] ]

View File

@ -1,5 +1,6 @@
import uuid import uuid
from django.db import models from django.db import models
from django.contrib.auth.models import User
class LocationData(models.Model): class LocationData(models.Model):
@ -18,6 +19,7 @@ class LocationData(models.Model):
class Location(models.Model): class Location(models.Model):
users = models.ManyToManyField(User, related_name='locations')
code = models.CharField(max_length=16, unique=True) code = models.CharField(max_length=16, unique=True)
name = models.CharField(max_length=64, unique=True) name = models.CharField(max_length=64, unique=True)
street = models.CharField(max_length=64, blank=True, null=True) street = models.CharField(max_length=64, blank=True, null=True)