working django default admin

This commit is contained in:
Bossanyi Tibor 2020-07-16 07:53:35 +02:00
parent 2aca477859
commit 8983c7105b
8 changed files with 50 additions and 20 deletions

View File

@ -0,0 +1,7 @@
from django.contrib import admin
from .models import ExerciseType
from .models import ExerciseTypeImage
admin.site.register(ExerciseType)
admin.site.register(ExerciseTypeImage)

View File

@ -1,3 +1,6 @@
class BackofficeConfig:
config = 0
from django.apps import AppConfig
class BackofficeConfig(AppConfig):
name = "aitrainer_backoffice"

View File

@ -1,5 +1,5 @@
"""
ASGI config for dj1 project.
ASGI config for backoffice_aitrainer project.
It exposes the ASGI callable as a module-level variable named ``application``.

View File

@ -2,12 +2,32 @@ from django.db import models
class ExerciseType(models.Model):
exerciseTypeId: models.IntegerField(max_length=13)
name: models.CharField(max_length=100)
description: models.CharField(max_length=1000)
# video: models.
unit: models.CharField(max_length=50)
unitQuantity: models.IntegerField(max_length=4)
unitQuantityUnit: models.CharField(max_length=50)
menuImage: models.CharField(max_length=200)
active: models.IntegerField(max_length=1)
exercise_type_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100)
description = models.TextField(max_length=1000, blank=True, null=True)
unit = models.CharField(max_length=50, blank=True, null=True)
unit_quantity = models.BooleanField(default=0, blank=True, null=True)
unit_quantity_unit = models.CharField(max_length=50, blank=True, null=True)
active = models.BooleanField(default=0, blank=True, null=True)
class Meta:
managed = False
db_table = 'exercise_type'
class ExerciseTypeImage(models.Model):
class ImageTypes(models.TextChoices):
IMAGE = 'image'
VIDEO = 'video'
MENU = 'menu'
image_id = models.AutoField(primary_key=True)
exercise_type_id = models.IntegerField(blank=True, null=True)
name = models.CharField(max_length=50, blank=True, null=True)
type = models.CharField(choices=ImageTypes.choices, default=ImageTypes.IMAGE, max_length=50, blank=True, null=True)
url = models.CharField(max_length=200, blank=True, null=True)
class Meta:
managed = False
db_table = 'exercise_type_image'

View File

@ -77,9 +77,9 @@ WSGI_APPLICATION = 'aitrainer_backoffice.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.path.join(BASE_DIR, 'aitrainer'),
'USER': 'root',
'PASSWORD':'tbi6012',
'NAME': 'aitrainer2',
'USER': 'aitrainer',
'PASSWORD':'andio2009',
'HOST': '127.0.0.1',
'PORT':3306
}
@ -108,9 +108,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'hu-HU'
TIME_ZONE = 'CET'
TIME_ZONE = 'Europe/Budapest'
USE_I18N = True

View File

@ -1,4 +1,4 @@
"""dj1 URL Configuration
"""aitrainer_backoffice URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
@ -21,6 +21,6 @@ from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name = "index"),
#path('', views.index, name = "index"),
path('admin/', admin.site.urls),
]

View File

@ -1,5 +1,5 @@
"""
WSGI config for dj1 project.
WSGI config for backoffice_aitrainer project.
It exposes the WSGI callable as a module-level variable named ``application``.