update data model
This commit is contained in:
parent
616fd63bfc
commit
48a912f04b
@ -10,8 +10,8 @@ class LocationAdmin(admin.ModelAdmin):
|
||||
|
||||
@admin.register(Client)
|
||||
class ClientAdmin(admin.ModelAdmin):
|
||||
list_display = ('desk1_name', 'desk2_name')
|
||||
fields = ['location', 'desk1_enable', 'desk1_name', 'desk1_prize_nt', 'desk1_prize_ht', 'desk2_enable', 'desk2_name', 'desk2_prize_nt', 'desk2_prize_ht', ]
|
||||
list_display = ('uuid', 'desk1_name', 'desk2_name')
|
||||
fields = ['location', 'uuid', 'desk1_enable', 'desk1_name', 'desk1_prize_nt', 'desk1_prize_ht', 'desk2_enable', 'desk2_name', 'desk2_prize_nt', 'desk2_prize_ht', ]
|
||||
|
||||
|
||||
@admin.register(LocationData)
|
||||
|
@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-01 12:48
|
||||
# Generated by Django 1.10.5 on 2017-02-01 17:49
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
@ -16,7 +17,8 @@ class Migration(migrations.Migration):
|
||||
migrations.CreateModel(
|
||||
name='Client',
|
||||
fields=[
|
||||
('id', models.UUIDField(editable=False, primary_key=True, serialize=False)),
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('uuid', models.UUIDField(default=uuid.uuid4, unique=True)),
|
||||
('desk1_enable', models.BooleanField()),
|
||||
('desk1_name', models.CharField(blank=True, max_length=32, null=True)),
|
||||
('desk1_prize_nt', models.DecimalField(blank=True, decimal_places=2, max_digits=4, null=True)),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import uuid
|
||||
from django.db import models
|
||||
|
||||
|
||||
@ -34,7 +35,7 @@ class Location(models.Model):
|
||||
|
||||
|
||||
class Client(models.Model):
|
||||
id = models.UUIDField(primary_key=True, editable=False)
|
||||
uuid = models.UUIDField(unique=True, default=uuid.uuid4)
|
||||
location = models.ForeignKey(Location)
|
||||
desk1_enable = models.BooleanField()
|
||||
desk1_name = models.CharField(max_length=32, blank=True, null=True)
|
||||
@ -46,7 +47,7 @@ class Client(models.Model):
|
||||
desk2_prize_ht = models.DecimalField(max_digits=4, decimal_places=2, blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
return self.location.name
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
return self.location.name
|
||||
|
Loading…
Reference in New Issue
Block a user