Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Not able to update a model with image field, with out passing an image file with dango rest framework
Using partial_update,trying to update the model with an image field, without giving an image file, no matter how much I try, I end up with this error. 'memoryview' object has no attribute '_committed' models.py class mymodel(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=200) image_file = models.ImageField(max_length=255, upload_to=/images/id, blank=True, null=True) is_production_ready = models.BooleanField(blank=True, null=True) Serializers.py class imageSerializer(serializers.ModelSerializer): class Meta: model = mymodel fields = '__all__' depth = 1 API.py class imageViewSet(viewsets.ModelViewSet): queryset = mymodel.objects.all() permission_classes = [permissions.AllowAny] serializer_class = imageSerializer parser_classes = ( MultiPartParser, FormParser, FileUploadParser, ) def partial_update(self, request, pk=None): ---instance = self.get_object() data = {} data['id'] = request.data['id'] data['is_production_ready'] = request.data['is_production_ready'] ---data['image_file'] = instance.image_file serializer = imageSerializer(instance, data=data, partial=partial) if serializer.is_valid(): print("serializer is valid...") print("serializer :: ", serializer) serializer.save() return JsonResponse(serializer.data, status=201) return JsonResponse(serializer.errors, status=400) -
psycopg2 installation Error in virtualenv(django_project)
Building a simple blog project with django Problem happened when deployment part. Help me to get rid of this situation advance Tnx Collecting psycopg2 Using cached psycopg2-2.8.6.tar.gz (383 kB) Building wheels for collected packages: psycopg2 Building wheel for psycopg2 (setup.py) ... error ERROR: Command errored out with exit status 1: command: '/home/sium/Documents/django/sample (another copy)/bin/python' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-reak32wu/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-reak32wu/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-onebo_jx cwd: /tmp/pip-install-reak32wu/psycopg2/ Complete output (40 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.8 creating build/lib.linux-x86_64-3.8/psycopg2 copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2 copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2 running build_ext building 'psycopg2._psycopg' extension creating build/temp.linux-x86_64-3.8 creating build/temp.linux-x86_64-3.8/psycopg x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120004 -DHAVE_LO64=1 -I/home/sium/Documents/django/sample (another copy)/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement In file included from psycopg/psycopgmodule.c:28: ./psycopg/psycopg.h:36:10: … -
ModuleNotFoundError: No module named 'account.apps.AccountConfigdjango'; 'account.apps' is not a package
from django.apps import AppConfig class AccountConfig(AppConfig): name = 'account' As a whole, I have two files the code above is from apps.py, but it does not work. What and where do I have to import the file apps.py to make my code run? -
Why is Django not displaying all attributes of an object?
I have the problem that I have a model with two fields, but only one is shown in the output. I have this code in my views.py class Update_Org(UpdateView): model = OrgKlass form_class = form_update_org template_name = templ_folder_name + 'update_org.html' success_url = reverse_lazy(url_app_name + 'list_org') def get_object(self, queryset=None): self.queryset = OrgKlass.objects.get(id = self.to_update) return self.queryset def post(self, request, pk): if self.request.POST.get('action', False) == 'update': self.to_update = pk self.object = self.get_object() print(self.object.ok_beschreibung) return super(Update_Org, self).post(request, pk) else: pass # because I do not need that right now The form looks like this: class form_update_org(forms.ModelForm): ok_bezeichnung = forms.CharField(required=True, label="Org-Bezeichnung", widget=forms.TextInput(attrs={'class':'form-control',})) ok_beschreibung = forms.CharField(required=False, label="Beschreibung des Tätigkeitsfeldes des Bereichs", widget=forms.Textarea(attrs={'class':'form-control',})) class Meta: model = OrgKlass fields = ('ok_bezeichnung', 'ok_beschreibung') And this is part of the html template: {% block content %} {% for label, value in object.get_fields %} label: {{label}}<br> value: {{value}}<br> {% endfor %} {% endblock %} The output however looks like this: label: ID value: 9 label: Org-Bezeichnung value: Company A label: Beschreibung des Tätigkeitsfeldes value: However, if you look at the print statement in the def post part, then this prints correctly the value of the ok_beschreibung field. Do you have any idea what is the problem with the html … -
best way to compare querysets against a queryset
Hello guys I have this problem I have been avoiding to post it here now I am back begging the god of stackoverflow; I have a queryset that I want to compare with querysets. say I have queryset like this: x = Thing.objects.get(user=request.user).thing_response.all() Then I have querysets that fetches every "Thing" and related response like this all = Things.objects.all() i = [x.id for x in all.thing_response.all()] I have built a list of ids with x and i now I want to get an exact match of i in x: it works for small data, but when data grows matching stops i use set for matching: if set(x) == set(i) in a loop but it doesn't work when the data gets large is there a better way to accomplish this? -
Why Django Is Not Accepting Data From A Form Even Data Is Valid? Django-python
I am Working With Modals And Forms In Django I Created A Comment Modal For My Post Modal I Used A ForeignKey To Associate My Comments With Posts, It Works All Fine By Manually Adding Comments To Posts From Admin Sections Of My Webpage, But As Soon As I Try To Do The Same Thing Using A Front-End Represtantion Of My Form So That User Could Add Comments To Posts, It Doesn't Work As Expected And I Am Also Unable To Automatically Associate My Posts With My Comments, I Have Been Changing The Things Form 2 Days Now And Still The Result Is Still Same. Can Anyone Help Me :{ This Is How My Modal Look Like: class Comment(models.Model): post = models.ForeignKey(Article, on_delete=models.CASCADE, related_name='comments') author = models.CharField(max_length=200) text = RichTextField() created_date = models.DateTimeField(auto_now_add= True) active = models.BooleanField(default=False) The Form: class CommentForm(forms.ModelForm): class Meta: model = models.Comment fields = ['author', 'text'] And This My View in Views.py: def article_detail(request, slug): article = Article.objects.get(slug = slug) articles = Article.objects.all() comment_form = CommentForm() post = get_object_or_404(Article, slug=slug) comments = post.comments.filter(active=True) if request.method == 'POST': form = forms.CreateArticle(request.POST, request.FILES) if form.is_valid(): # Create Comment object but don't save to database syet new_comment = form.save() … -
Add field to an user during creation django
I want to add a field "full_access" to an user when he register on my site. This default field is False, and when the user does a certain action (here, buy a product), he has acces on the full web site. The problem is, I can't add this field when i submit the form. Here is my code: all my code are in the app user user/forms.py: from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User class SignUpForm(UserCreationForm): username = forms.CharField(label="Pseudo", required=True, max_length=100, widget=forms.TextInput(attrs={ "class": "form-control", })) first_name = forms.CharField(label="Prénom", required=True, max_length=100, widget=forms.TextInput(attrs={ "class": "form-control", })) last_name = forms.CharField(label="Nom", max_length=100, required=True, widget=forms.TextInput(attrs={ "class": "form-control", })) email = forms.EmailField(label="Email", max_length=150, required=True, widget=forms.EmailInput(attrs={ "class": "form-control", })) password1 = forms.CharField(label="Mot de passe", required=True, widget=forms.PasswordInput(attrs={ "class": "form-control", })) password2 = forms.CharField(label="Confirmation mot de passe", required=True, widget=forms.PasswordInput(attrs={ "class": "form-control", })) full_access = forms.BooleanField(label="Accès total", required=True, disabled=True, initial=False) class Meta: model = User fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2', ) user/views.py def signup(request): if request.method == "POST": form = SignUpForm(request.POST) print(form) print(form.is_valid()) if form.is_valid(): print("here") form.save() username = form.cleaned_data.get('username') raw_password = form.cleaned_data.get('password1') user = authenticate(username=username, password=raw_password) if user is not None: login(request, user) return redirect(reverse("accueil")) else: form = SignUpForm() else: form … -
Get annotate sum with calculation in django
I've data like below. Need to get total value by calculating price - discount% and sum of all. How to use aggregate here models.py class Order(TimeStamp): code = models.CharField(max_length=255, null=True, blank=True) class OrderItem(models.Model): order = models.ForeignKey(Order, on_delete=models.CASCADE, null=True, blank=True, related_name='order_item') name = models.CharField(max_length=255, null=True, blank=True) discount = models.FloatField(null=True, blank=True) price = models.FloatField(null=True, blank=True) def __str__(self): return self.name -
Django/Celery - Object matching query does not exist only when using delay
I am working with Django and Celery to asynchronously send_mass_mail. When I call the view function that calls the task, I get the following error: [2020-09-08 17:47:49,148: ERROR/ForkPoolWorker-8] Task main_app.tasks.send_notice[244944f6-604c-47a0-901a-4c510563d76e] raised unexpected: DoesNotExist('Notice matching query does not exist.') This only happens when I am using delay. If I call send_notice_task(notice_id) instead of send_notice_task.delay(notice_id) it can find the notice, but with delay it keeps throwing that error. Any ideas? /views.py def notice_approve(request, notice_id): notice = Notice.objects.get(id=notice_id) notice.approve() # send_notice_task(notice_id) send_notice_task.delay(notice_id) return redirect('manage') /tasks.py def send_notice_task(notice_id): print(notice_id) notice = Notice.objects.get(id=notice_id) subscribers = Subscriber.objects.filter(approved=True) recipient_list = [] for sub in subscribers: recipient_list.append(sub.email) datatuple = (f'{notice.subject} - Notice', html_message, 'CONCERN Network <cnb@gmail.com>', recipient_list) send_mass_mail((datatuple,), fail_silently=False) -
How to display year-month costs summary for each category in django, DetailView?
I have a table with expenses categories and when I click on the certain category it redirects me to this DetailView page. Then I want to show the year-month costs summary for chosen category. How can I achieve that? I've managed to get e.g total costs of all categories etc. But the most confusing part about this problem for me is how can I retrieve this information only for chosen category and show it to user in DetailView? Thank you in advance for any help, have a good evening! DetailView class CategoryDetailView(DetailView): models = Expense def get_object(self, queryset=None): id_ = self.kwargs.get("id") return get_object_or_404(Category, id=id_) Models.py class Category(models.Model): name = models.CharField(max_length=50, unique=True) def __str__(self): return f'{self.name}' class Expense(models.Model): class Meta: ordering = ('date', '-pk') category = models.ForeignKey(Category, null=True, blank=True, on_delete=models.CASCADE) name = models.CharField(max_length=50) amount = models.DecimalField(max_digits=8, decimal_places=2) date = models.DateField(default=datetime.date.today, db_index=True) def __str__(self): return f'{self.date} {self.name} {self.amount}' -
pythonanywhere:Error code: Unhandled Exception
hi guys.when tried deploy my django site with pythonanywhere i get an error: here my WSGI configuration file:/var/www/cargoglobal_pythonanywhere_com_wsgi.py: import os import sys path = '/home/cargoglobal/CargoGlobal.net' if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'elansayti.settings' from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise application = DjangoWhiteNoise(get_wsgi_application()) and here my projects wsgi.py: """ WSGI config for elansayti project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'elansayti.settings') application = get_wsgi_application() please help me guys.i am a very helpless. -
get similar tasks in django
I have a model like class Tasks(models.Model): title = models.CharField(max_length=100,null=True,blank=True) Now I want to return a list of all tasks which are same . like Two tasks A and B are considered similar if all the words in the task A exist in task B or vice versa. how I can achive this in django orm or any other way to do this ? -
Django not null constraint failed when form is submitted
I use the basic user model, and i'd like to have a profile connected to it aswell. But when I submit my form i get this error: NOT NULL constraint failed: users_profile.user_id from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver # Create your models here. class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, unique=True) weight = models.FloatField(max_length=20, blank=True, null=True) height = models.FloatField(max_length=20, blank=True, null=True) goal = models.FloatField(max_length=20, blank=True, null=True) def __str__(self): return self.user.username @receiver(post_save, sender=User) def create_user_profile(sender,instance,created,**kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender,instance,**kwargs): instance.profile.save() Views: from django.shortcuts import render from django.contrib import messages from users import models from users.models import Profile from .forms import WeightForm # Create your views here. def home(request): form = WeightForm() if request.method == 'POST': form = WeightForm(request.POST) if form.is_valid: form.save() return render(request, 'Landing/index.html', {'form': form}) -
OperationalError at / no such table: main_tutorial
After delete my "migrations" folder from "main" folder and the splt3 file, and then run "python manage.py makemigrations" and "python manage.py migrate". I have this erro: OperationalError at / no such table: main_tutorial Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 3.0.4 Exception Type: OperationalError Exception Value: no such table: main_tutorial Exception Location: /home/jogabell/.virtualenvs/djangodev/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py in execute, line 396 Python Executable: /home/jogabell/.virtualenvs/djangodev/bin/python3 Python Version: 3.6.9 Python Path: ['/home/jogabell/Documentos/web_developing/django_first_app', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/jogabell/.virtualenvs/djangodev/lib/python3.6/site-packages'] Server time: Tue, 8 Sep 2020 17:32:41 +0000 What can I do? -
Why does this filter no longer work in Django?
I'm upgrading a project from Django 1.8 to Django 2.1.3 (yes, I know I should update more, but that's the client requirement at this point). The exact same models.py file and exact same Django ORM query in the views.py file are in both (Python3 updates notwithstanding), the Django 1.8 version works fine but with Django 2.1.3, this filter (which worked perfectly fine with Django 1.8): kwargs['car__carcategory__category__category_id'] = categoryId is now producing the following error with Django 2.1.3: raise FieldError('Related Field got invalid lookup: {}'.format(lookups[0])) django.core.exceptions.FieldError: Related Field got invalid lookup: car_category Here is the query: cars = CarModel.objects.only( 'car__car_id', 'car__cardate', 'car__title', 'car__location', 'car__quote', 'car__key', 'car__cartype_id', 'maker__lastname', 'maker__firstname', 'maker__middlename', 'maker__nickname', ).select_related( 'car', 'maker', ).extra( select={ 'is_position_paper': 'cartype_id = 7', 'is_null_date': 'cardate IS NULL', 'shorttitle': extra, }, ).filter(**kwargs).distinct(sort_order_for_distinct, 'car__car_id').order_by(sort_order, 'car__car_id') Here are the relevant models: class CarModel(models.Model): car_candidate_id = models.IntegerField(primary_key=True) car = models.ForeignKey(Car, on_delete=models.PROTECT) partsmanufacturer = models.ForeignKey(Manufacturer, on_delete=models.PROTECT) created = models.DateTimeField(blank=True, null=True) modified = models.DateTimeField(blank=True, null=True) class Meta: managed = False db_table = 'car_model' class Car(models.Model): car_id = models.IntegerField(primary_key=True) cartype = models.ForeignKey(Cartype, on_delete=models.CASCADE) title = models.CharField(max_length=255) cardate = models.DateField(null=True) db_table = u'car' class Carcategory(models.Model): car_category_id = models.IntegerField(primary_key=True) car = models.ForeignKey(Car, on_delete=models.CASCADE) category = models.ForeignKey(Category, on_delete=models.CASCADE) class Meta: db_table = u'car_category' Anybody know … -
Python Django - Customizing add user save method
I am pretty new to django framework . I am working on add user form in admin login .I need to send user details to third party API , On success from API call ,have to save in application database . Could you please guide me how to customize user save method to achieve this. -
Boolean field not getting updated after a celery task but gets updated without celery. How to make it work with celery?
Hey guys i have a celery task to encode videos and has a model field has_processed which should be set to True after the encoding. But the field is not getting updated with celery but gets updated when the function is run without celery. What can be the problem? models. class VideoPost(models.Model): has_processed = models.BooleanField(default=False, blank=True) encoding.py def encode_video_480p(video_id): video = VideoPost.objects.get(id=video_id) . . for i in range(1): new_video = subprocess.call([settings.VIDEO_ENCODING_FFMPEG_PATH, input_file_path, {processes} , output_file_path]) if new_video == 0: video.has_processed = True # Doesn't work with celery video.file = output_file_path video.save() video.temp_file.delete() else: raise ValidationError('Proceesing Failed.') # Just for now tasks @task(name= 'task_video_encoding') def task_video_encoding(video_id): logger.info('Video Processing started') return encode_video_480p(video_id) Can someone help? Thanks -
Django H14 Heroku error, how do i fix this?
2020-09-08T17:05:06.205027+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=uvdocdash.herokuapp.com request_id=f17ceaee-3e7c-4eba-aebf-19dd4b424eee fwd="70.39.71.29" dyno= connect= service= status=503 bytes= protocol=https I get this error in the logs, so far I havent been able to find out why my app isnt working. It's a django app, and the requirments.txt is correct as far as i know. asgiref==3.2.10 Django==3.1.1 gunicorn==20.0.4 pytz==2020.1 sqlparse==0.3.1 django-heroku >= 0.3.1 -
Connecting to django mysql without specifying database/schema
In normal circumstances, you run mysql -h and if you can connect to db as current user, you are in. Then you can select database and other operations. Now we move to django context. We do connection.cursor() but it defaults to database you specify in settings. As it happens it may or may not be yet created. But you know db is there and you want to perform some checks and whatnot. How to do it? -
Has anyone ever used django-plotly-dash to call an API every second and live plot the API data?
I am trying to create a page that calls an ISS locator API every second and then live updates a line plot every second with the latitude/longitude data from the API. I am using Django to create this page so I'm trying to use django-plotly-dash to do this. Does anyone have experience with this or something similar that could help? -
How to deploy django aplication on linux server with gunicorn and virtualenv?
I'm new to django and this is my first project, so I'm trying to understand how things work. Is it possible to run my app without port, as for example http://127.0.0.1/myapp/ not http://127.0.0.1:8000/? I was looking for some tutorials but the only ones that I have found are showing how to deploy the app with address + port. Is it possible to do this without sudo (because I'm not an admin on my server) and with virtualenv and gunicorn? And if it is possible then could you tell me how? -
How do I customize Django language switcher options?
I am building a multilingual dictionary website using Django. I am interested in building a language switcher that distinguishes, say, American English from British English. On Django's docs I found the following language switcher: {% load i18n %} <form action="{% url 'set_language' %}" method="post">{% csrf_token %} <input name="next" type="hidden" value="{{ redirect_to }}"> <select name="language"> {% get_current_language as LANGUAGE_CODE %} {% get_available_languages as LANGUAGES %} {% get_language_info_list for LANGUAGES as languages %} {% for language in languages %} <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}> {{ language.name_local }} ({{ language.code }}) </option> {% endfor %} </select> <input type="submit" value="Go"> </form> In my settings.py I have restricted the set of available languages to the following: LANGUAGES = [ ('en-us', _('English (U.S.)')), ('en-gb', _('English (U.K.)')), ] This results in the select menu having two options. I expected those two options to be: English (U.S.) (en-us) English (U.K.) (en-gb) However, I got: English (en) British English (en-gb) How can I turn the current behavior into my desired behavior (both in terms of language code and the name of the language itself)? -
How go display only values from query set? <QuerySet [<Matches: MUMBAI INDIANS (MI) VS CHENNAI SUPER KINGS (CSK),2020-09-19>]>
I am learning Django and I am not able to display only values from this query set. The template tags I am using is: {% for win in match_wins %} <td >{{ win.matchdetail.all }}</td> {% endfor %} Views.py file class MatchWinsView(ListView): context_object_name = 'match_wins' model = models.Wins template_name = 'match_wins.html' And my model looks like below: class Wins(models.Model): matchdetail = models.ManyToManyField(Matches) What should I fix to get only values? -
How to solve error with syncing PostgreSQL with Vercel
I have a database using PostgreSQL but the published site is Vercel and when deploying for production is gives the error below. The error doesn't happen for Heroku django.db.utils.OperationalError: FATAL: no pg_hba.conf entry for host "123.456.789.102", user "example_user", database "example_db", SSL off How do I solve this error, thank you. I have checked Google results aren't really helpful 😥😥 -
(Django) Problem installing fixture 'rules.json': 'NoneType' object has no attribute 'id'
I'm trying to populate my db with fixtures with the next command: python .\manage.py loaddata .\rules\fixtures\rules.json But I get the next error: AttributeError: Problem installing fixture 'C:\Users\Ángel - Trabajo\Documents\AVC.\rules\fixtures\rules.json': 'NoneType' object has no attribute 'id' This is my model: class Rule(LogsMixin, models.Model): """Definición de modelo para Reglas""" FIELDS = [ ('user_name', 'Nombre de usuario'), ('user_code', 'Codigo de usuario') ] string = models.CharField("Cadena de referencia", max_length=100, null=False, default="", blank=False) profile = models.ForeignKey(Profile, null=False, default=None, on_delete=models.DO_NOTHING) license = models.ForeignKey(License, null=False, default=None, on_delete=models.DO_NOTHING) field = models.CharField("Campo objetivo", max_length=50, default='nombre_usuario', choices=FIELDS) include = models.BooleanField("Incluye", null=False, default=True) order = models.IntegerField("Orden", null=True, default=None) uppercase_sensitive = models.BooleanField("Sensible a las mayúsculas", null=False, default=False) dateadded = models.DateTimeField("Fecha de inserción", default=datetime.datetime.now) And this is my json: [ { "model":"rules.rule", "pk":null, "fields":{ "string": "DINAMITZADORA", "profile": "1", "license": "1", "field": "user_name", "include": "1", "order": "0", "uppercase_sensitive": "0" } }, { "model":"rules.rule", "pk":null, "fields":{ "string": "adm", "profile": "1", "license": "1", "field": "user_name", "include": "1", "order": "0", "uppercase_sensitive": "0" } }, { "model":"rules.rule", "pk":null, "fields":{ "string": "admin", "profile": "1", "license": "1", "field": "user_name", "include": "1", "order": "0", "uppercase_sensitive": "0" } }, { "model":"rules.rule", "pk":null, "fields":{ "string": "alum", "profile": "1", "license": "1", "field": "user_name", "include": "1", "order": "0", "uppercase_sensitive": "0" } }, ] I've tried …