séparation des application pols et vehicles

This commit is contained in:
Ambulance Clerc
2021-12-18 18:56:14 +01:00
parent 46254605fc
commit 769078f261
20 changed files with 115 additions and 22 deletions

View File

@@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'polls.apps.PollsConfig',
'vehicles.apps.VehiclesConfig',
]
MIDDLEWARE = [

Binary file not shown.

View File

@@ -1,6 +1,7 @@
from django.contrib import admin
from polls.models import Question, Choice, Vehicles
from polls.models import Question, Choice
from vehicles.models import *
# Register your models here.

View File

@@ -0,0 +1,16 @@
# Generated by Django 4.0 on 2021-12-18 17:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0002_rename_questionid_choice_question'),
]
operations = [
migrations.DeleteModel(
name='Vehicles',
),
]

View File

@@ -1,31 +1,10 @@
import datetime
from django.db import models
from django.conf import settings
from django.utils import timezone
# Create your models here.
class Vehicles(models.Model):
sName = models.CharField (max_length=250)
bEnabled = models.BooleanField( default=0 )
class Vhc_problems(models.Model):
Vehicle = models.ForeignKey( Vehicles, on_delete=models.CASCADE)
sTitle = models.CharField( max_length=250)
sDesc = models.TextField()
bEnabled = models.BooleanField( default=1)
dtStart = models.DateTimeField()
dtEnd = models.DateTimeField()
sAuthor = models.CharField( max_length=120)
Author = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING )
dtUpdated = models.DateTimeField('date updated')
dtCreated = models.DateTimeField('date published')
class Question(models.Model):
question_txt = models.CharField( max_length=250)
pub_date = models.DateTimeField('date published')

0
rh/__init__.py Normal file
View File

3
rh/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
rh/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class RhConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'rh'

View File

3
rh/models.py Normal file
View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
rh/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
rh/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

0
vehicles/__init__.py Normal file
View File

3
vehicles/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
vehicles/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class VehiclesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'vehicles'

View File

@@ -0,0 +1,40 @@
# Generated by Django 4.0 on 2021-12-18 17:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='Vehicles',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sName', models.CharField(max_length=250)),
('bEnabled', models.BooleanField(default=0)),
],
),
migrations.CreateModel(
name='Vhc_problems',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sTitle', models.CharField(max_length=250)),
('sDesc', models.TextField()),
('bEnabled', models.BooleanField(default=1)),
('dtStart', models.DateTimeField()),
('dtEnd', models.DateTimeField()),
('sAuthor', models.CharField(max_length=120)),
('dtUpdated', models.DateTimeField(verbose_name='date updated')),
('dtCreated', models.DateTimeField(verbose_name='date published')),
('Author', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='auth.user')),
('Vehicle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='vehicles.vehicles')),
],
),
]

View File

23
vehicles/models.py Normal file
View File

@@ -0,0 +1,23 @@
import datetime
from django.db import models
from django.conf import settings
from django.utils import timezone
class Vehicles(models.Model):
sName = models.CharField (max_length=250)
bEnabled = models.BooleanField( default=0 )
class Vhc_problems(models.Model):
Vehicle = models.ForeignKey( Vehicles, on_delete=models.CASCADE)
sTitle = models.CharField( max_length=250)
sDesc = models.TextField()
bEnabled = models.BooleanField( default=1)
dtStart = models.DateTimeField()
dtEnd = models.DateTimeField()
sAuthor = models.CharField( max_length=120)
Author = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING )
dtUpdated = models.DateTimeField('date updated')
dtCreated = models.DateTimeField('date published')

3
vehicles/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
vehicles/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.