Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix event name length crashing #683

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.25 on 2024-09-22 10:59
# Generated by Django 3.2.25 on 2024-09-22 11:50

from django.db import migrations, models

Expand All @@ -12,7 +12,7 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name="event",
name="headline",
field=models.CharField(blank=True, max_length=50, verbose_name="tittel"),
name="slug",
field=models.CharField(blank=True, max_length=100, null=True),
),
]
5 changes: 1 addition & 4 deletions nablapps/events/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.core.exceptions import ValidationError
from django.db import IntegrityError, models
from django.urls import reverse
from django.utils.text import slugify

from nablapps.core.models import TimeStamped, WithPicture
from nablapps.jobs.models import Company
Expand All @@ -30,7 +29,7 @@ class Event(
Dukker opp som nyheter på forsiden.
"""

headline = models.CharField(blank=True, max_length=50, verbose_name="tittel")
slug = models.CharField(blank=True, null=True, max_length=100)

# Penalty_rules is a dict where key is an integer and value is
# a tuple with the name of the rule as first element and
Expand Down Expand Up @@ -127,8 +126,6 @@ def get_short_name(self):
)

def save(self, *args, **kwargs):
if not self.slug:
self.slug = slugify(self.headline)
super().save(*args, **kwargs)
self.move_waiting_to_attending()

Expand Down
Loading