Translatable model fields for Django with admin integration
Project description
Translatable model fields for Django with admin integration. Uses PostgreSQL JSONField.
Installation
Add application
INSTALLED_APPS = (
...
'translatable_fields',
...
)
Add TranslatableField model fields
from django.db import models
from django.utils.translation import ugettext_lazy as _
from translatable_fields.models import TranslatableField
class Position(models.Model):
...
title = TranslatableField(
verbose_name=_('title')
)
description = TranslatableField(
verbose_name=_('description')
)
...
Create custom model admin form
from django import forms
from django.contrib.postgres.forms import JSONField
from ckeditor_uploader.widgets import CKEditorUploadingWidget
from careers.models.position import Position
from translatable_fields.widgets import TranslatableWidget
class PositionAdminForm(forms.ModelForm):
title = JSONField(widget=TranslatableWidget(widget=forms.TextInput))
description = JSONField(widget=TranslatableWidget(widget=CKEditorUploadingWidget))
class Meta:
model = Position
fields = (
...
'title',
'description',
...
)
Create custom model admin with custom form
from django.contrib import admin
from careers.forms.admin.position import PositionAdminForm
class PositionAdmin(admin.ModelAdmin):
form = PositionAdminForm
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-translatable-fields-0.0.1.tar.gz
.
File metadata
- Download URL: django-translatable-fields-0.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60364dfe7180537151aa30fedc6953271f91d4960c5d3e5287c606c7a7c76c57 |
|
MD5 | bf9ede213a4da724179824fa12cc2ec4 |
|
BLAKE2b-256 | 58a951c648432058522144c08b8e5c41cf424eaec71b4b3046590f89221ea16f |