-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add URL routing for catalog for courses/programs and department (#2140)
* add to urls.js * update for tab/dept * take state out of constructor * adding slug field * slug migration and adding to management command * fixing routing with new slug stuff and routes in order * successful introduction of slug to the page * FIxed routing to further pages and fake pages * tests and formatting * Test Fix * fixing migrations * fixed js test finally * well that was silly
- Loading branch information
1 parent
2c79e46
commit 0a8d37c
Showing
12 changed files
with
519 additions
and
131 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
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,20 @@ | ||
# Generated by Django 3.2.23 on 2024-03-27 14:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
# Running this migration across 3 files to support the unique field, per django docs: | ||
# https://docs.djangoproject.com/en/4.2/howto/writing-migrations/#migrations-that-add-unique-fields | ||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("courses", "0047_courses_and_programs_department_required"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="department", | ||
name="slug", | ||
field=models.SlugField(max_length=255, null=True), | ||
), | ||
] |
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,22 @@ | ||
# Generated by Django 3.2.23 on 2024-03-27 15:35 | ||
|
||
from django.db import migrations | ||
from django.utils.text import slugify | ||
|
||
|
||
def generate_slug(apps, schema): | ||
Department = apps.get_model("courses", "Department") | ||
for department in Department.objects.all(): | ||
department.slug = slugify(department.name) | ||
department.save(update_fields=["slug"]) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("courses", "0048_add_department_slug"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(generate_slug, reverse_code=migrations.RunPython.noop), | ||
] |
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,18 @@ | ||
# Generated by Django 3.2.23 on 2024-03-27 15:35 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("courses", "0049_populate_department_slug"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="department", | ||
name="slug", | ||
field=models.SlugField(max_length=128, unique=True), | ||
), | ||
] |
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
Oops, something went wrong.