-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Many-to-one relationships e atributo _set
- Loading branch information
1 parent
f608d29
commit 3a97555
Showing
8 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
from django.contrib import admin | ||
from ordered_model.admin import OrderedModelAdmin | ||
|
||
from pypro.modulos.models import Modulo | ||
from pypro.modulos.models import Aula, Modulo | ||
|
||
|
||
@admin.register(Modulo) | ||
class ModuloAdmin(OrderedModelAdmin): | ||
list_display = ('titulo', 'publico', 'move_up_down_links') | ||
prepopulated_fields = {'slug': ('titulo',)} | ||
|
||
|
||
@admin.register(Aula) | ||
class AulaAdmin(OrderedModelAdmin): | ||
list_display = ('titulo', 'modulo', 'order', 'move_up_down_links') | ||
list_filter = ('modulo',) | ||
ordering = ('modulo', 'order') | ||
prepopulated_fields = {'slug': ('titulo',)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Generated by Django 4.2.6 on 2023-10-19 22:41 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("modulos", "0004_slug_unico_e_nao_nulo"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Aula", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"order", | ||
models.PositiveIntegerField( | ||
db_index=True, editable=False, verbose_name="order" | ||
), | ||
), | ||
("titulo", models.CharField(max_length=64)), | ||
("slug", models.SlugField(unique=True)), | ||
( | ||
"modulo", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.PROTECT, to="modulos.modulo" | ||
), | ||
), | ||
], | ||
options={ | ||
"ordering": ("order",), | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters