Skip to content
Snippets Groups Projects
Verified Commit aacfe285 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Rename abbrev to short_name

Close #70
parent 7a5a3b64
No related branches found
No related tags found
1 merge request!53Resolve "Rename field "abbrev" to "short_name" (subject model, ...)"
......@@ -151,10 +151,10 @@ admin.site.register(Room, RoomAdmin)
class SubjectAdmin(admin.ModelAdmin):
def _colour(self, obj):
return colour_badge(obj.colour_fg, obj.colour_bg, obj.abbrev,)
return colour_badge(obj.colour_fg, obj.colour_bg, obj.short_name, )
list_display = ("abbrev", "name", "_colour")
list_display_links = ("abbrev", "name")
list_display = ("short_name", "name", "_colour")
list_display_links = ("short_name", "name")
admin.site.register(Subject, SubjectAdmin)
......
# Generated by Django 3.0.5 on 2020-04-27 13:52
from django.db import migrations, models
from django.db.models import F
class Migration(migrations.Migration):
dependencies = [
('chronos', '0014_extra_lesson'),
]
operations = [
migrations.RenameField(
model_name='subject',
old_name='abbrev',
new_name='short_name',
),
migrations.AlterModelOptions(
name='subject',
options={'ordering': ['name', 'short_name']},
),
]
......@@ -390,9 +390,7 @@ class TimePeriod(ExtensibleModel):
class Subject(ExtensibleModel):
abbrev = models.CharField(
verbose_name=_("Abbreviation of subject in timetable"), max_length=10, unique=True,
)
short_name = models.CharField(verbose_name=_("Short name of subject"), max_length=10, unique=True)
name = models.CharField(verbose_name=_("Long name of subject"), max_length=30, unique=True)
colour_fg = models.CharField(
......@@ -409,10 +407,10 @@ class Subject(ExtensibleModel):
)
def __str__(self) -> str:
return "{} ({})".format(self.abbrev, self.name)
return "{} ({})".format(self.short_name, self.name)
class Meta:
ordering = ["name", "abbrev"]
ordering = ["name", "short_name"]
class Room(ExtensibleModel):
......@@ -471,7 +469,7 @@ class Lesson(ExtensibleModel, GroupPropertiesMixin, TeacherPropertiesMixin):
def __str__(self):
return "{}, {}, {}".format(
format_m2m(self.groups),
self.subject.abbrev,
self.subject.short_name,
format_m2m(self.teachers),
)
......
<strong>
<span data-position="bottom" class="tooltipped" data-tooltip="{{ subject.name }}">{{ subject.abbrev }}</span>
<span data-position="bottom" class="tooltipped" data-tooltip="{{ subject.name }}">{{ subject.short_name }}</span>
</strong>
......@@ -4,15 +4,15 @@
{% if not el.lesson_period.lesson.subject and not el.subject %}
{% elif el.cancelled or el.cancelled_for_teachers %}
<span data-position="bottom" class="tooltipped" data-tooltip="{{ el.lesson_period.lesson.subject.name }}">
<s>{{ el.lesson_period.lesson.subject.abbrev }}</s>
<s>{{ el.lesson_period.lesson.subject.short_name }}</s>
</span>
{% elif el.subject and el.lesson_period.lesson.subject %}
<span data-position="bottom" class="tooltipped" data-tooltip="{{ el.lesson_period.lesson.subject.name }}">
<s>{{ el.lesson_period.lesson.subject.abbrev }}</s>
<s>{{ el.lesson_period.lesson.subject.short_name }}</s>
</span>
<span data-position="bottom" class="tooltipped" data-tooltip="{{ el.subject.name }}">
<strong>{{ el.subject.abbrev }}</strong>
<strong>{{ el.subject.short_name }}</strong>
</span>
{% elif el.subject and not el.lesson_period.lesson.subject %}
{% include "chronos/partials/subject.html" with subject=el.subject %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment