Skip to content

Commit

Permalink
Adding language on TemplateType
Browse files Browse the repository at this point in the history
  • Loading branch information
ericosta-dev committed Sep 12, 2024
1 parent 2cd3cdd commit 01d639e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
3 changes: 1 addition & 2 deletions connect/api/v2/template_projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class TemplateTypeViewSet(ModelViewSet):
permission_classes = [IsAdminOrReadOnly]

def get_queryset(self):

queryset = self.queryset
queryset = self.queryset.filter(language=self.request.user.language)
id = self.request.query_params.get('id', None)
name = self.request.query_params.get('name', None)
category = self.request.query_params.get('category', None)
Expand Down
18 changes: 18 additions & 0 deletions connect/template_projects/migrations/0008_templatetype_language.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.23 on 2024-09-12 17:35

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('template_projects', '0007_auto_20230926_1231'),
]

operations = [
migrations.AddField(
model_name='templatetype',
name='language',
field=models.CharField(choices=[('en-us', 'English'), ('pt-br', 'Portuguese'), ('es', 'Spanish')], default='pt-br', max_length=10, verbose_name='language'),
),
]
9 changes: 7 additions & 2 deletions connect/template_projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.conf import settings
from .storage import TemplateTypeImageStorage


class TemplateType(models.Model):

language = models.CharField(
"language",
max_length=10,
choices=settings.LANGUAGES,
default='pt-br',
)
level_field = [("low", 1), ("medium", 2), ("high", 3)]
uuid = models.UUIDField(
"UUID", default=uuid4.uuid4
Expand Down Expand Up @@ -40,7 +46,6 @@ def get_template_code(self, template_name):


class TemplateFeature(models.Model):

features_types = [
("Flows", "Flows"),
("Integrations", "Integrations"),
Expand Down

0 comments on commit 01d639e

Please sign in to comment.