-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add models and serializers to translations. Also add on Django Admin
- Loading branch information
1 parent
006db04
commit 89dfa98
Showing
6 changed files
with
169 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,33 @@ | ||
from django.contrib import admin | ||
from connect.template_projects.models import TemplateType, TemplateFeature, TemplateSuggestion | ||
from connect.template_projects.models import ( | ||
TemplateType, | ||
TemplateFeature, | ||
TemplateSuggestion, | ||
TemplateTypeTranslation, | ||
TemplateFeatureTranslation, | ||
) | ||
|
||
# Register your models here. | ||
admin.site.register(TemplateType) | ||
admin.site.register(TemplateFeature) | ||
admin.site.register(TemplateSuggestion) | ||
|
||
|
||
class TemplateTypeTranslationStackedInline(admin.StackedInline): | ||
model = TemplateTypeTranslation | ||
extra = 1 | ||
|
||
|
||
class TemplateFeatureTranslationStackedInline(admin.StackedInline): | ||
model = TemplateFeatureTranslation | ||
extra = 1 | ||
|
||
|
||
class TemplateTypeAdmin(admin.ModelAdmin): | ||
inlines = [TemplateTypeTranslationStackedInline] | ||
|
||
|
||
class TemplateFeatureAdmin(admin.ModelAdmin): | ||
inlines = [TemplateFeatureTranslationStackedInline] | ||
|
||
|
||
admin.site.register(TemplateType, TemplateTypeAdmin) | ||
admin.site.register(TemplateFeature, TemplateFeatureAdmin) |
38 changes: 38 additions & 0 deletions
38
...t/template_projects/migrations/0008_templatefeaturetranslation_templatetypetranslation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 3.2.23 on 2024-09-13 02:08 | ||
|
||
import connect.template_projects.storage | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('template_projects', '0007_auto_20230926_1231'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='TemplateTypeTranslation', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('language', models.CharField(choices=[('en-us', 'English'), ('pt-br', 'Portuguese'), ('es', 'Spanish')], default='en-us', max_length=10, verbose_name='language')), | ||
('description', models.TextField(blank=True, null=True)), | ||
('name', models.CharField(blank=True, max_length=255, null=True)), | ||
('setup', models.JSONField(blank=True, null=True)), | ||
('photo', models.ImageField(blank=True, null=True, storage=connect.template_projects.storage.TemplateTypeImageStorage(), upload_to='')), | ||
('photo_description', models.TextField(blank=True, null=True)), | ||
('template_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='template_projects.templatetype')), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='TemplateFeatureTranslation', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('language', models.CharField(choices=[('en-us', 'English'), ('pt-br', 'Portuguese'), ('es', 'Spanish')], default='en-us', max_length=10, verbose_name='language')), | ||
('description', models.TextField()), | ||
('name', models.CharField(max_length=255)), | ||
('template_feature', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='template_projects.templatefeature')), | ||
], | ||
), | ||
] |
18 changes: 0 additions & 18 deletions
18
connect/template_projects/migrations/0008_templatetype_language.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters