Commit a0d22bdc authored by Luuk Scholten's avatar Luuk Scholten
Browse files

Add model and admin for vacancy categories

parent 42528bec
from django.contrib import admin
from partners.models import Partner, PartnerImage
from utils.translation import TranslatedModelAdmin
from partners.models import (
Partner,
PartnerImage,
VacancyCategory,
)
class PartnerImageInline(admin.StackedInline):
......@@ -25,3 +31,9 @@ class PartnerAdmin(admin.ModelAdmin):
)
inlines = (PartnerImageInline,)
@admin.register(VacancyCategory)
class VacancyCategoryAdmin(TranslatedModelAdmin):
prepopulated_fields = {"slug": ("name_en",)}
fields = ['name', 'slug']
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-10 17:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('partners', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='VacancyCategory',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.SlugField()),
('name_en', models.CharField(max_length=30, verbose_name='name (EN)')),
('name_nl', models.CharField(max_length=30, verbose_name='name (NL)')),
],
options={
'verbose_name_plural': 'Vanancy Categories',
},
),
]
from django.db import models
from django.core.validators import RegexValidator, URLValidator
from utils.translation import MultilingualField, ModelTranslateMeta
class Partner(models.Model):
is_active = models.BooleanField(default=False)
......@@ -64,3 +66,14 @@ class PartnerImage(models.Model):
def __str__(self):
return 'image of {}'.format(self.partner.name)
class VacancyCategory(models.Model, metaclass=ModelTranslateMeta):
name = MultilingualField(models.CharField, max_length=30)
slug = models.SlugField()
def __str__(self):
return self.name
class Meta:
verbose_name_plural = 'Vanancy Categories'
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