mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 21:27:49 +02:00
Add properties
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from django.contrib import admin
|
||||
from metadata.models import (
|
||||
Property,
|
||||
Decoder,
|
||||
Scale,
|
||||
Manufacturer,
|
||||
@@ -9,6 +10,11 @@ from metadata.models import (
|
||||
)
|
||||
|
||||
|
||||
@admin.register(Property)
|
||||
class PropertyAdmin(admin.ModelAdmin):
|
||||
search_fields = ("name",)
|
||||
|
||||
|
||||
@admin.register(Decoder)
|
||||
class DecoderAdmin(admin.ModelAdmin):
|
||||
readonly_fields = ("image_thumbnail",)
|
||||
|
@@ -0,0 +1,33 @@
|
||||
# Generated by Django 4.0.3 on 2022-04-07 09:03
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('metadata', '0007_alter_manufacturer_category'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Property',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=128, unique=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'Properties',
|
||||
'ordering': ['name'],
|
||||
},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='manufacturer',
|
||||
options={'ordering': ['category', 'name']},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='manufacturer',
|
||||
name='category',
|
||||
field=models.CharField(choices=[('model', 'Model'), ('real', 'Real')], max_length=64),
|
||||
),
|
||||
]
|
@@ -6,6 +6,17 @@ from django_countries.fields import CountryField
|
||||
from dcc.utils import get_image_preview, slugify
|
||||
|
||||
|
||||
class Property(models.Model):
|
||||
name = models.CharField(max_length=128, unique=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Properties"
|
||||
ordering = ["name"]
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Manufacturer(models.Model):
|
||||
name = models.CharField(max_length=128, unique=True)
|
||||
category = models.CharField(
|
||||
|
Reference in New Issue
Block a user