mirror of
https://github.com/Rushilwiz/launchx.git
synced 2025-04-05 04:30:19 -04:00
feat: added competitor inline to team admin view
This commit is contained in:
parent
0e0214ebae
commit
0fd8396b36
|
@ -15,4 +15,14 @@ admin_site.register(User)
|
|||
admin_site.register(Group)
|
||||
|
||||
admin_site.register(Competitor)
|
||||
admin_site.register(Team)
|
||||
|
||||
class CompetitorInline(admin.TabularInline):
|
||||
model = Competitor
|
||||
|
||||
class TeamAdmin(admin.ModelAdmin):
|
||||
inlines = [
|
||||
CompetitorInline,
|
||||
]
|
||||
|
||||
|
||||
admin_site.register(Team, TeamAdmin)
|
19
innovate/migrations/0002_auto_20210208_1549.py
Normal file
19
innovate/migrations/0002_auto_20210208_1549.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.1.6 on 2021-02-08 15:49
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('innovate', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='competitor',
|
||||
name='team',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='competitors', to='innovate.team'),
|
||||
),
|
||||
]
|
|
@ -25,7 +25,7 @@ class Competitor(models.Model):
|
|||
email = models.EmailField(max_length = 254)
|
||||
is_leader = models.BooleanField(default=False)
|
||||
|
||||
team = models.ForeignKey(Team, on_delete=models.CASCADE)
|
||||
team = models.ForeignKey(Team, related_name="competitors", on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Competitor"
|
||||
|
|
Loading…
Reference in New Issue
Block a user