Commit 7ca4a4de authored by Tom van Bussel's avatar Tom van Bussel Committed by Sébastiaan Versteeg
Browse files

Improve vacancy validation

parent eda83c33
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-11-07 20:41+0100\n"
"PO-Revision-Date: 2018-11-07 20:42+0100\n"
"POT-Creation-Date: 2018-11-07 20:54+0100\n"
"PO-Revision-Date: 2018-11-07 20:56+0100\n"
"Last-Translator: Sébastiaan Versteeg <>\n"
"Language-Team: \n"
"Language: nl\n"
......@@ -16,7 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2\n"
"X-Generator: Poedit 2.0.6\n"
#: templates/partners/index.html templates/partners/partner.html
msgid "Partners"
......@@ -53,6 +53,15 @@ msgstr "wordt niet getoond op de vacaturepagina"
msgid "Vacancies"
msgstr "Vacatures"
msgid "If no partner is used then both a company name and logo are required."
msgstr ""
"Wanneer je geen partner aangeeft, zijn de bedrijfsnaam en logo verplicht."
msgid "Either select a partner or provide a company name and logo."
msgstr "Selecteer of een partner of geef een bedrijfsnaam en logo."
msgid "title"
msgstr "titel"
# Generated by Django 2.0.8 on 2018-11-07 19:10
from django.db import migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('partners', '0012_auto_20180112_1005'),
operations = [
......@@ -91,7 +91,7 @@ class VacancyCategory(models.Model, metaclass=ModelTranslateMeta):
class Vacancy(models.Model):
title = models.CharField(max_length=255)
description = HTMLField(blank=True)
description = HTMLField()
link = models.CharField(
......@@ -143,6 +143,35 @@ class Vacancy(models.Model):
url = reverse('partners:partner', args=(self.partner.slug,))
return '{}#vacancy-{}'.format(url,
def clean(self):
errors = {}
msg = _('If no partner is used then both a company name and logo are '
if not self.partner and self.company_name and not self.company_logo:
errors.update({'company_logo': msg})
if not self.partner and not self.company_name and self.company_logo:
errors.update({'company_name': msg})
msg = _('Either select a partner or provide a company name and logo.')
if self.partner and (self.company_name or self.company_logo):
errors.update({'partner': msg})
if self.company_name:
errors.update({'company_name': msg})
if self.company_logo:
errors.update({'company_logo': msg})
if (not self.partner and not self.company_name and
not self.company_logo):
'partner': msg,
'company_name': msg,
'company_logo': msg,
if errors:
raise ValidationError(errors)
class PartnerEvent(models.Model, metaclass=ModelTranslateMeta):
partner = models.ForeignKey(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment