feat(i18n): add possibility to set english description for services
This commit is contained in:
parent
20e623ea39
commit
d52eccd795
6 changed files with 25 additions and 4 deletions
|
@ -14,7 +14,8 @@ class ServicesAdmin(admin.ModelAdmin):
|
|||
"hidden",
|
||||
)
|
||||
fieldsets = [
|
||||
("Global", {"fields": ["name", "domain", "photo", "description"]}),
|
||||
("Global", {"fields": ["name", "domain", "photo"]}),
|
||||
("Descriptions", {"fields": ["description", "description_en"]}),
|
||||
("Types", {"fields": ["sources", "hosted"]}),
|
||||
("Misc", {"fields": ["hidden"]}),
|
||||
]
|
||||
|
|
18
apps/gnous_eu/migrations/0002_service_description_en.py
Normal file
18
apps/gnous_eu/migrations/0002_service_description_en.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.2 on 2020-05-16 12:28
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('gnous_eu', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='service',
|
||||
name='description_en',
|
||||
field=models.TextField(null=True),
|
||||
),
|
||||
]
|
|
@ -18,6 +18,7 @@ class Service(models.Model):
|
|||
id = models.AutoField(primary_key=True)
|
||||
name = models.CharField(max_length=150)
|
||||
description = models.TextField()
|
||||
description_en = models.TextField(null=True)
|
||||
photo = models.ImageField(upload_to="services")
|
||||
|
||||
sources = models.CharField(
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
{{ service.name }}
|
||||
<code>{{ service.domain }}</code>
|
||||
</h3>
|
||||
<p>{{ service.description }}</p>
|
||||
<p>{% get_current_language as LANGUAGE_CODE %}{% if LANGUAGE_CODE == 'en' and service.description_en != None %}{{ service.description_en }}{% else %}{{ service.description }}{% endif %}</p>
|
||||
<a href="https://{{ service.domain }}" class="uk-text-large">{% trans "Rejoindre !" %}</a>
|
||||
</div>
|
||||
<div class="uk-card-footer uk-card-media">
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from django.http import HttpResponse, HttpResponseNotFound, HttpRequest
|
||||
from django.http import HttpResponse, HttpRequest
|
||||
from django.shortcuts import render
|
||||
from django.core.paginator import Paginator
|
||||
from django.db.models import Q
|
||||
from django.utils import translation
|
||||
|
||||
from apps.gnous_eu.models import Service
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = "*0q64%2cb!f@w(o@b74yyi2#x1d2r#%uul+hc1=gne^8u+*3)k"
|
||||
SECRET_KEY = "*0q64%2cb!f@w(o@b74yyi2#xr1d2r#%uul+hc1=gne^8u+*3)k"
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
|
Loading…
Reference in a new issue