init commit
init commit
This commit is contained in:
0
equipment/__init__.py
Normal file
0
equipment/__init__.py
Normal file
8
equipment/admin.py
Normal file
8
equipment/admin.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from django.contrib import admin
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
from .models import *
|
||||
|
||||
# Register your models here.
|
||||
@admin.register(Equipment)
|
||||
class EquipmentAdmin(ImportExportModelAdmin):
|
||||
list_display = ("name", "is_weight", "category",)
|
||||
6
equipment/apps.py
Normal file
6
equipment/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class EquipmentConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'equipment'
|
||||
25
equipment/migrations/0001_initial.py
Normal file
25
equipment/migrations/0001_initial.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 4.2.2 on 2023-06-11 22:00
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Equipment',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('is_weight', models.BooleanField(default=False)),
|
||||
('category', models.CharField(blank=True, max_length=64, null=True)),
|
||||
('name', models.CharField(blank=True, max_length=64, null=True)),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
equipment/migrations/__init__.py
Normal file
0
equipment/migrations/__init__.py
Normal file
12
equipment/models.py
Normal file
12
equipment/models.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
class Equipment(models.Model):
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
is_weight = models.BooleanField(default=False)
|
||||
category = models.CharField(null=True, blank=True, max_length=64)
|
||||
name = models.CharField(null=True, blank=True, max_length=64)
|
||||
|
||||
def __str__(self):
|
||||
return self.category + " : " + self.name
|
||||
7
equipment/serializers.py
Normal file
7
equipment/serializers.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from rest_framework import serializers
|
||||
from models import *
|
||||
|
||||
class EquipmentSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Equipment
|
||||
fields = '__all__'
|
||||
3
equipment/tests.py
Normal file
3
equipment/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
equipment/views.py
Normal file
3
equipment/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in New Issue
Block a user