mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-03 20:57:50 +02:00
Initial commit
This commit is contained in:
0
dcc/dcc/__init__.py
Normal file
0
dcc/dcc/__init__.py
Normal file
16
dcc/dcc/asgi.py
Normal file
16
dcc/dcc/asgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for dcc project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dcc.settings')
|
||||
|
||||
application = get_asgi_application()
|
129
dcc/dcc/settings.py
Normal file
129
dcc/dcc/settings.py
Normal file
@@ -0,0 +1,129 @@
|
||||
"""
|
||||
Django settings for dcc project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 4.0.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-1fgtf05rwp0qp05@ef@a7%x#o+t6vk6063py=vhdmut0j!8s4u'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'dcc',
|
||||
'roster',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'dcc.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'dcc.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
MEDIA_URL = 'media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
23
dcc/dcc/urls.py
Normal file
23
dcc/dcc/urls.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""dcc URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.0/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
7
dcc/dcc/utils.py
Normal file
7
dcc/dcc/utils.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.utils.html import format_html
|
||||
|
||||
|
||||
def get_image_preview(url):
|
||||
return format_html(
|
||||
'<img src="%s" style="max-width: 150px; max-height: 150px;'
|
||||
'background-color: #eee;" />' % url)
|
16
dcc/dcc/wsgi.py
Normal file
16
dcc/dcc/wsgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for dcc project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dcc.settings')
|
||||
|
||||
application = get_wsgi_application()
|
22
dcc/manage.py
Executable file
22
dcc/manage.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dcc.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
BIN
dcc/media/images/R33255.jpeg
Normal file
BIN
dcc/media/images/R33255.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
BIN
dcc/media/images/R33255_qDu1zPt.jpeg
Normal file
BIN
dcc/media/images/R33255_qDu1zPt.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
0
dcc/roster/__init__.py
Normal file
0
dcc/roster/__init__.py
Normal file
33
dcc/roster/admin.py
Normal file
33
dcc/roster/admin.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from django.contrib import admin
|
||||
from roster.models import Cab, Decoder, Manufacturer
|
||||
|
||||
|
||||
@admin.register(Cab)
|
||||
class CabAdmin(admin.ModelAdmin):
|
||||
readonly_fields = ('image_thumbnail', 'creation_time', 'updated_time',)
|
||||
list_display = ('identifier', 'manufacturer', 'address')
|
||||
list_filter = list_display
|
||||
search_fields = list_display
|
||||
|
||||
fieldsets = (
|
||||
(None, {
|
||||
'fields': ('identifier',
|
||||
'address',
|
||||
'manufacturer',
|
||||
'decoder',
|
||||
'epoch',
|
||||
'production_year',
|
||||
'purchase_date',
|
||||
'image',
|
||||
'image_thumbnail',
|
||||
'notes')
|
||||
}),
|
||||
('Audit', {
|
||||
'classes': ('collapse',),
|
||||
'fields': ('creation_time', 'updated_time',)
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
admin.site.register(Decoder)
|
||||
admin.site.register(Manufacturer)
|
6
dcc/roster/apps.py
Normal file
6
dcc/roster/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class RosterConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'roster'
|
37
dcc/roster/migrations/0001_initial.py
Normal file
37
dcc/roster/migrations/0001_initial.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# Generated by Django 4.0 on 2021-12-15 22:16
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Manufacturer',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=128, unique=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Cab',
|
||||
fields=[
|
||||
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('identifier', models.CharField(max_length=128)),
|
||||
('address', models.SmallIntegerField(default=3)),
|
||||
('creation_time', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_time', models.DateTimeField(auto_now=True)),
|
||||
('manufacturer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='roster.manufacturer')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['address', 'identifier'],
|
||||
},
|
||||
),
|
||||
]
|
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 4.0 on 2021-12-15 22:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='production_date',
|
||||
field=models.SmallIntegerField(null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='production_year',
|
||||
field=models.SmallIntegerField(null=True),
|
||||
),
|
||||
]
|
@@ -0,0 +1,22 @@
|
||||
# Generated by Django 4.0 on 2021-12-15 22:27
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0002_cab_notes_cab_production_date_cab_production_year'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='cab',
|
||||
name='production_date',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='purchase_date',
|
||||
field=models.DateField(null=True),
|
||||
),
|
||||
]
|
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 4.0 on 2021-12-15 22:28
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0003_remove_cab_production_date_cab_purchase_date'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='cab',
|
||||
name='manufacturer',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='roster.manufacturer'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='cab',
|
||||
name='production_year',
|
||||
field=models.SmallIntegerField(blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='cab',
|
||||
name='purchase_date',
|
||||
field=models.DateField(blank=True, null=True),
|
||||
),
|
||||
]
|
19
dcc/roster/migrations/0005_alter_cab_manufacturer.py
Normal file
19
dcc/roster/migrations/0005_alter_cab_manufacturer.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 4.0 on 2021-12-15 22:29
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0004_alter_cab_manufacturer_alter_cab_production_year_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='cab',
|
||||
name='manufacturer',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='roster.manufacturer'),
|
||||
),
|
||||
]
|
18
dcc/roster/migrations/0006_cab_image.py
Normal file
18
dcc/roster/migrations/0006_cab_image.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.0 on 2021-12-15 22:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0005_alter_cab_manufacturer'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='image',
|
||||
field=models.ImageField(blank=True, upload_to=''),
|
||||
),
|
||||
]
|
18
dcc/roster/migrations/0007_alter_cab_image.py
Normal file
18
dcc/roster/migrations/0007_alter_cab_image.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.0 on 2021-12-15 22:43
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0006_cab_image'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='cab',
|
||||
name='image',
|
||||
field=models.ImageField(blank=True, null=True, upload_to='images/'),
|
||||
),
|
||||
]
|
18
dcc/roster/migrations/0008_cab_epoch.py
Normal file
18
dcc/roster/migrations/0008_cab_epoch.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.0 on 2021-12-15 23:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0007_alter_cab_image'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='epoch',
|
||||
field=models.CharField(blank=True, max_length=32),
|
||||
),
|
||||
]
|
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 4.0 on 2021-12-16 09:11
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0008_cab_epoch'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='decoder_manufacturer',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_decoder', to='roster.manufacturer'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='decoder_model',
|
||||
field=models.CharField(blank=True, max_length=128),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='cab',
|
||||
name='manufacturer',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_manufacturer', to='roster.manufacturer'),
|
||||
),
|
||||
]
|
@@ -0,0 +1,31 @@
|
||||
# Generated by Django 4.0 on 2021-12-16 09:15
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0009_cab_decoder_manufacturer_cab_decoder_model_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='cab',
|
||||
name='decoder_manufacturer',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='cab',
|
||||
name='manufacturer',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='roster.manufacturer'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Decoder',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=128, unique=True)),
|
||||
('manufacturer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='roster.manufacturer')),
|
||||
],
|
||||
),
|
||||
]
|
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 4.0 on 2021-12-16 09:18
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('roster', '0010_remove_cab_decoder_manufacturer_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='cab',
|
||||
name='decoder_model',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cab',
|
||||
name='decoder',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='roster.decoder'),
|
||||
),
|
||||
]
|
0
dcc/roster/migrations/__init__.py
Normal file
0
dcc/roster/migrations/__init__.py
Normal file
82
dcc/roster/models.py
Normal file
82
dcc/roster/models.py
Normal file
@@ -0,0 +1,82 @@
|
||||
from uuid import uuid4
|
||||
from django.db import models
|
||||
# from django.core.files.storage import FileSystemStorage
|
||||
# from django.dispatch import receiver
|
||||
|
||||
from dcc.utils import get_image_preview
|
||||
|
||||
|
||||
# class OverwriteMixin(FileSystemStorage):
|
||||
# def get_available_name(self, name, max_length):
|
||||
# self.delete(name)
|
||||
# return name
|
||||
|
||||
|
||||
class Manufacturer(models.Model):
|
||||
name = models.CharField(max_length=128, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Company(models.Model):
|
||||
name = models.CharField(max_length=128, unique=True)
|
||||
country = models.CharField(max_length=128, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
|
||||
class Decoder(models.Model):
|
||||
name = models.CharField(max_length=128, unique=True)
|
||||
manufacturer = models.ForeignKey(
|
||||
Manufacturer,
|
||||
on_delete=models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return "{0} - {1}".format(self.manufacturer, self.name)
|
||||
|
||||
|
||||
class Cab(models.Model):
|
||||
uuid = models.UUIDField(
|
||||
primary_key=True, default=uuid4,
|
||||
editable=False)
|
||||
identifier = models.CharField(max_length=128, unique=False)
|
||||
address = models.SmallIntegerField(default=3)
|
||||
manufacturer = models.ForeignKey(
|
||||
Manufacturer, on_delete=models.CASCADE,
|
||||
null=True, blank=True)
|
||||
decoder = models.ForeignKey(
|
||||
Decoder, on_delete=models.CASCADE,
|
||||
null=True, blank=True)
|
||||
epoch = models.CharField(max_length=32, blank=True)
|
||||
production_year = models.SmallIntegerField(null=True, blank=True)
|
||||
purchase_date = models.DateField(null=True, blank=True)
|
||||
|
||||
image = models.ImageField(
|
||||
upload_to='images/',
|
||||
null=True,
|
||||
blank=True)
|
||||
notes = models.TextField(blank=True)
|
||||
|
||||
creation_time = models.DateTimeField(auto_now_add=True)
|
||||
updated_time = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ['address', 'identifier']
|
||||
|
||||
def __str__(self):
|
||||
return "{0} {1}".format(self.manufacturer, self.identifier)
|
||||
|
||||
def image_thumbnail(self):
|
||||
return get_image_preview(self.image.url)
|
||||
image_thumbnail.short_description = "Preview"
|
||||
|
||||
|
||||
# @receiver(models.signals.post_delete, sender=Cab)
|
||||
# def post_save_image(sender, instance, *args, **kwargs):
|
||||
# try:
|
||||
# instance.image.delete(save=False)
|
||||
# except Exception:
|
||||
# pass
|
3
dcc/roster/tests.py
Normal file
3
dcc/roster/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
dcc/roster/views.py
Normal file
3
dcc/roster/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
6
requirements-dev.txt
Normal file
6
requirements-dev.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
pip-review
|
||||
pdbpp
|
||||
ipython
|
||||
flake8
|
||||
pyinstrument
|
||||
django-debug-toolbar
|
8
requirements.txt
Normal file
8
requirements.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
pytz
|
||||
Django
|
||||
djangorestframework
|
||||
django-health-check
|
||||
# psycopg2-binary
|
||||
paho-mqtt
|
||||
# asyncio-mqtt
|
||||
# PyYAML
|
Reference in New Issue
Block a user