Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
WSR Website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sofiane Lasri
WSR Website
Commits
bd4e4587
Commit
bd4e4587
authored
2 years ago
by
Sofiane Lasri
Browse files
Options
Downloads
Patches
Plain Diff
Création des modèles pour le contenu du site.
parent
475c9cfb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
WSR/migrations/0001_initial.py
+86
-0
86 additions, 0 deletions
WSR/migrations/0001_initial.py
WSR/models.py
+61
-1
61 additions, 1 deletion
WSR/models.py
with
147 additions
and
1 deletion
WSR/migrations/0001_initial.py
0 → 100644
+
86
−
0
View file @
bd4e4587
# Generated by Django 4.2.1 on 2023-06-03 15:45
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'
Article
'
,
fields
=
[
(
'
id
'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'
ID
'
)),
(
'
titre
'
,
models
.
CharField
(
max_length
=
100
)),
(
'
contenu
'
,
models
.
TextField
()),
(
'
date_publication
'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
],
),
migrations
.
CreateModel
(
name
=
'
Course
'
,
fields
=
[
(
'
id
'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'
ID
'
)),
(
'
nom
'
,
models
.
CharField
(
max_length
=
100
)),
(
'
circuit
'
,
models
.
CharField
(
max_length
=
100
)),
(
'
image
'
,
models
.
ImageField
(
upload_to
=
'
course_images
'
)),
],
),
migrations
.
CreateModel
(
name
=
'
Pilote
'
,
fields
=
[
(
'
id
'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'
ID
'
)),
(
'
nom
'
,
models
.
CharField
(
max_length
=
100
)),
],
),
migrations
.
CreateModel
(
name
=
'
Saison
'
,
fields
=
[
(
'
id
'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'
ID
'
)),
(
'
nom
'
,
models
.
CharField
(
max_length
=
100
)),
(
'
annee
'
,
models
.
PositiveIntegerField
()),
],
),
migrations
.
CreateModel
(
name
=
'
Vehicule
'
,
fields
=
[
(
'
id
'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'
ID
'
)),
(
'
marque
'
,
models
.
CharField
(
max_length
=
100
)),
(
'
modele
'
,
models
.
CharField
(
max_length
=
100
)),
(
'
annee_fabrication
'
,
models
.
PositiveIntegerField
()),
],
),
migrations
.
CreateModel
(
name
=
'
Resultat
'
,
fields
=
[
(
'
id
'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'
ID
'
)),
(
'
position_arrivee
'
,
models
.
PositiveIntegerField
()),
(
'
position_depart
'
,
models
.
PositiveIntegerField
()),
(
'
course
'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
WSR.course
'
)),
(
'
pilote
'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
WSR.pilote
'
)),
],
),
migrations
.
AddField
(
model_name
=
'
pilote
'
,
name
=
'
vehicule
'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
WSR.vehicule
'
),
),
migrations
.
CreateModel
(
name
=
'
Participation
'
,
fields
=
[
(
'
id
'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'
ID
'
)),
(
'
course
'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
WSR.course
'
)),
(
'
pilotes
'
,
models
.
ManyToManyField
(
to
=
'
WSR.pilote
'
)),
(
'
saison
'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
WSR.saison
'
)),
],
),
migrations
.
AddField
(
model_name
=
'
course
'
,
name
=
'
saison
'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
WSR.saison
'
),
),
]
This diff is collapsed.
Click to expand it.
WSR/models.py
+
61
−
1
View file @
bd4e4587
from
django.db
import
models
# Create your models here.
class
Saison
(
models
.
Model
):
nom
=
models
.
CharField
(
max_length
=
100
)
annee
=
models
.
PositiveIntegerField
()
def
__str__
(
self
):
return
self
.
nom
class
Pilote
(
models
.
Model
):
nom
=
models
.
CharField
(
max_length
=
100
)
vehicule
=
models
.
ForeignKey
(
'
Vehicule
'
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
self
.
nom
class
Vehicule
(
models
.
Model
):
marque
=
models
.
CharField
(
max_length
=
100
)
modele
=
models
.
CharField
(
max_length
=
100
)
annee_fabrication
=
models
.
PositiveIntegerField
()
def
__str__
(
self
):
return
f
"
{
self
.
marque
}
{
self
.
modele
}
"
class
Course
(
models
.
Model
):
nom
=
models
.
CharField
(
max_length
=
100
)
circuit
=
models
.
CharField
(
max_length
=
100
)
saison
=
models
.
ForeignKey
(
Saison
,
on_delete
=
models
.
CASCADE
)
image
=
models
.
ImageField
(
upload_to
=
'
course_images
'
)
def
__str__
(
self
):
return
self
.
nom
class
Article
(
models
.
Model
):
titre
=
models
.
CharField
(
max_length
=
100
)
contenu
=
models
.
TextField
()
date_publication
=
models
.
DateTimeField
(
auto_now_add
=
True
)
def
__str__
(
self
):
return
self
.
titre
class
Resultat
(
models
.
Model
):
pilote
=
models
.
ForeignKey
(
Pilote
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
position_arrivee
=
models
.
PositiveIntegerField
()
position_depart
=
models
.
PositiveIntegerField
()
def
__str__
(
self
):
return
f
"
{
self
.
pilote
}
-
{
self
.
course
}
"
class
Participation
(
models
.
Model
):
saison
=
models
.
ForeignKey
(
Saison
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
pilotes
=
models
.
ManyToManyField
(
Pilote
)
def
__str__
(
self
):
return
f
"
{
self
.
saison
}
-
{
self
.
course
}
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment