Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ValueError('dictionary update sequence element #0 has length 9; 2 is required',) is not JSON serializable
I have implemented the code below and would like to merge the dicts into one. I am getting the following logs when I make a GET request. ValueError('dictionary update sequence element #0 has length 9; 2 is required',) is not JSON serializable How do I merge two dicts into one JSON? class PayrollView(APIView): def get(self, request, pk, format=None): try: payslip = Payslip.objects.filter( id=pk).prefetch_related('user', 'employee').values( 'payment_mode__name', 'payslip_no', 'allowance_types', 'deduction_types', 'month_ending', 'basic_salary__salary_value', 'employee__user__last_name', 'employee__user__first_name', 'employee__user__id' ) result = payslip.aggregate( net_allowance=Sum('allowances__amount')) # context = {} # context.update(payslip) # context.update(result) context = dict(payslip, **result) except Exception as e: return Response(data=e, status=status.HTTP_400_BAD_REQUEST) return Response(data=context, status=status.HTTP_200_OK) -
django models getting queryset
how to get status_updation and status_date respect to the order_number class customer_database(models.Model): customer_id = models.CharField(max_length=20, unique=True) customer_name = models.CharField(max_length=20) customer_email = models.EmailField() def __str__(self): return self.customer_id class order_database(models.Model): order_number = models.CharField(max_length=10, unique=True, primary_key=True) order_timestamp = models.DateTimeField() order_consignment_number = models.CharField(max_length=20) order_customer = models.ForeignKey(customer_database, on_delete=models.CASCADE) def __str__(self): return self.order_number class track_database(models.Model): order_status = models.ForeignKey(order_database, on_delete=models.CASCADE) status_updation = models.CharField(max_length=30) status_timestamp = models.DateTimeField() def __str__(self): return self.status_updation -
The requested URL could not be found for Django project while running on httpd server?
This post is a bit long. Those interested kindly bear with me on this one. I am running a Django project on apache2 server. I have two images embedded in anchor tags in my index.html HTML page : <a id="pop1" href="#"> <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSuFkPwpxwXwgnnwvPHLxW1sCbtPKfqdpz6jApGYbEbeD99Ob-Z" width="30px" height="25px" style="margin-bottom:6px;"> </a> and <a align="right" id="pop2" href="#"> <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSuFkPwpxwXwgnnwvPHLxW1sCbtPKfqdpz6jApGYbEbeD99Ob-Z" width="30px" height="25px" style="margin-bottom:6px;"> </a> When I click on the images both open the same modal box. Below is the modal box code: <div id="alarmModal" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">Shutdown Machines with less than certain % CPU Utilization after N minutes</h4> </div> <div class="modal-body"> <p> Please fill in the specifics below:</p> <form id="alarm_form" action="/create_alarm/" method="POST">{% csrf_token %} <label for="period">Period of inactivity(in minutes):</label> <input type="number" id="period" min="0" max="60" step="5" required> <label for="cpu">CPU Utilization(in %):</label> <input type="number" id="cpu" min="0" max="100" step="1" required> <br> <div id="alarmresult"></div> </div> <div class="modal-footer"> <input class="btn btn-default" id="upload" type="submit" value="Optimize"></input> </form> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> My Ajax and Jquery code is pasted below : function alarmfunc(){ //$('#pop1,#pop2').on('click', function(event){ //$('#alarmModal').modal('show'); //Submit Post on Submit $('#alarm_form').on('submit', function(event){ event.preventDefault(); $('#optimize').attr("disabled",true); console.log("form submitted!"); var period = $("#period").val(); var cpu = $("#cpu").val(); console.log(period,cpu) //alert(form_data); $.ajax({ … -
How create unit test for function in django views
I'm just starting to create tests for Django views. In def product_detail , I output the product and the values of its attributes that are in the ProductDetail object. Help create a test for this function. It's my view def: def product_detail(request, pk): product = get_object_or_404(Product, pk=pk) product_det = ProductDetail.objects.filter(product=product) colors = [product_detail.color.name for product_detail in product_det] sizes = [product_detail.size.name for product_detail in product_det] materials = [product_detail.material.name for product_detail in product_det] return render(request, 'case/test.html', {'product': product, 'product_det': product_det, 'colors': list(set(colors)), 'sizes': list(set(sizes)), 'materials':list(set(materials)) }) my model: from django.db import models class Product(models.Model): name = models.CharField(max_length=200, db_index=True) class Meta: ordering = ['name'] verbose_name = 'Product' verbose_name_plural = 'Products' def __str__(self): return self.name class ProductAttribute(models.Model): name = models.CharField(max_length=50, db_index=True) def __str__(self): return self.name class Color(ProductAttribute): pass class Size(ProductAttribute): pass class Material(ProductAttribute): pass class ProductDetail(models.Model): product = models.ForeignKey(Product, related_name='productdetail', verbose_name='Product') color = models.ForeignKey(Color, related_name='colordetail', verbose_name='Color Product') size = models.ForeignKey(Size, related_name='sizedetail', verbose_name='Size Product') material = models.ForeignKey(Material, related_name='materialdetail', verbose_name='Material Product') price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='Price') my urls: urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^(?P<pk>\d+)/$', views.product_detail, name='test_detail'), -
django-permission AuthorPermissionLogic not working in function based view
Am using django-permission on simple test app (almost identical to the example used in the docs) to try to figure out how it works. I have read the documentation and tried to use the example app provided on this link. The issue is when the author of an article is not able to edit/ delete the article. The user in question has been granted all permissions in the admin section. Key code listed below - any help much appreciated test_app/models.py class Article(models.Model): created_by = models.ForeignKey(User) created = models.DateField(auto_now_add=True) modified = models.DateField(auto_now=True) title = models.CharField(max_length=100) content = models.TextField() class Meta: app_label = 'test_app' from permission import add_permission_logic from permission.logics import AuthorPermissionLogic add_permission_logic(Article, AuthorPermissionLogic( field_name='created_by', any_permission = False, change_permission = True, delete_permission = True, )) test_app/views.py @permission_required('change_article') def change_article(request, *args, **kwargs): pk = kwargs.pop('pk') template = 'test_app/edit.html' article = models.Article.objects.get(id=pk) if request.method == 'POST': form = forms.Article_form(request.POST, instance=article) if form.is_valid(): article = form.save(commit=False) article.created_by = request.user article.title = form.cleaned_data['title'] article.content = form.cleaned_data['content'] article.save() return HttpResponseRedirect('/test/') else: raise Http404 else: form = forms.Article_form(instance=article) return render(request, template_name=template, context={'form':form}) test_app/perms.py PERMISSION_LOGICS = ( ('test_app.Article', AuthorPermissionLogic()), ) -
Auto Deploy Elastic Beanstalk Changes
I'm having a problem with elastic beanstalk, in my application there is some piece of code that creates some files dynamically and now I want to persist these files for future use, so is there any way that I can push my dynamically created files to GitHub automatically, so in next deployment these changes will remain, as elastic beanstalk replace the old code with new code after each deployment, So How can I commit my changes and push them to GitHub repo from code, any suggestions? -
postgres database connection to visual studio
I am a beginner of Django framework. I am learning from Chris Hawk videos from youtube. He was setting up database connection between postgres database and visual studio. He had shown the setting in the video that we have to change but I am not getting these type of the setting.enter image description here [These are settings shown in the video] [Settings that I am getting] I am unable to upload more images in this question. I can upload more images you want help. -
social_auth_pipeline error when adding custom pipeline
i have added my custom pipeline SOCIAL_AUTH_PIPELINE = ( 'social_core.pipeline.social_auth.social_details', 'social_core.pipeline.social_auth.social_uid', 'social_core.pipeline.social_auth.auth_allowed', 'social_core.pipeline.social_auth.social_user', 'social_core.pipeline.user.get_username', 'social_core.pipeline.social_auth.associate_by_email', 'social_core.pipeline.user.create_user', 'social_core.pipeline.social_auth.associate_user', 'social_core.pipeline.social_auth.load_extra_data', 'social_core.pipeline.user.user_details', 'users.pipeline.return_token', <---- my custom pipeline// ) pipeline.py from django.http import JsonResponse, HttpResponse def return_token(backend, user, response, *args, **kwargs): if response is not None: data = {"token": response['access_token'], "backend": "google-oauth2"} return JsonResponse(data) else: return when the user signup/login the user is registered to database and the access token is returned with no error when i convert in http://localhost:8000/auth/convert-token it returns error AttributeError at /auth/convert-token 'JsonResponse' object has no attribute 'is_active' when i disable my pipeline there is no error how can i return access_token without getting error -
Django best way drawing line chart
I have two models: User and Data. Each user has multiple data, and one data belongs to a User. So I have the following code: class User(models.Model): id = models.CharField(max_length=10, primary_key=True) def __str__(self): return self.id class Data(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) timestamp = models.IntegerField(default=0) x = models.IntegerField(default=0) y = models.IntegerField(default=0) z = models.IntegerField(default=0) def __str__(self): return 'User : ' + self.user.id + ' | Time : '+ str(self.timestamp) On my web application, I have a landing page that shows up all users. Once clicked a user, it shows another empty page. I would like to draw a line chart showing the user x,y,z accelerations over the time on that page. What is the best way of doing this? -
fix unsupported operand type(s) for +: 'dict_items' and 'odict_items'?
I'm trying to implement the below answer in django 2.0, but get this error: unsupported operand type(s) for +: 'dict_items' and 'odict_items' How can I merge a normal dict and an ordered dict? -
Django & jQuery : load html of added form and execute some jquery on it
after adding a form , how can I load the HTML of the new form I added so I can execute some jquery on it. this is the initial form : I after clicking on ajouter une ligne : At the first time I execute some jquery on the fields. but after adding the new forms how can I execute the same jquery on the second row. here is my jquery I execute on my first row : $("#id_form-"+0+"-typeTiers").change(function () { x="<option>5</option>"; y="<option>0</option>"; $("#id_form-"+jax+"-tiers").html(x); $("#id_form-"+jax+"-numfacture").html(y); }); PS: The fields of the first row have as Id : id_form-0-typeTiers , id_form-0-tiers and id_form-0-numfacture . The second , third and so on have instead of 0 of 1, 2, 3. Any help please, I have been stucking for a long time here. THANK YOU for your help. -
Why django framework official site doesn't work?
Today learning the python framework,django i am unable to read the original documentation and it's official site does not work why???? -
How Can I Store and serve an image in Django Rest Framework using Mongoengine (Mongodb module for Django)
here is my models.py : models.py class Resource(Document): instruction = fields.StringField(required=True) picture = fields.ImageField(required=False) and my serializer : class ResourceSerializer(serializers.DocumentSerializer): class Meta: model = Resource fields = '__all__' and my views.py class ResourceViewSet(viewsets.ModelViewSet): lookup_field = 'id' serializer_class = ResourceSerializer def get_queryset(self): return Resource.objects() and this is the response that i get when im trying to list the pictures HTTP 200 OK Allow: GET, POST, HEAD, OPTIONS Content-Type: application/json Vary: Accept [ { "id": "5ac4886a91a48946801813c9", "instruction": "test", "picture": "5ac4886991a48946801813bf" } ] note : mongodb using gridfs to storing the imagefiles in case that mongodb using gridfs to storing the imagefiles , how can i send the images to client ? -
Django: Sum and Count annotations work separately but not together
For each Product I'm trying to annotate a count of the number of templates and a sum of the weight sold. Template and OrderLine are parent models. query = Product.objects.all() query_1 = query.annotate(template_count=Count('template_product')) query_2 = query.annotate(weight_sold=Sum('orderline_product__weight') query_3 = query.annotate(template_count=Count('template_product')).annotate( weight_sold=Sum('orderline_product__weight')) query_4 = query.annotate(template_count=Count('template_product'), weight_sold=Sum('orderline_product__weight')) For some reason query_1 and query_2 work properly separately but query_3 and query_4 do not work (the numbers for each are way too high). I can't figure out why they don't work together. -
Is my Django ModelForm unbound?
For the past days, I have been battling with a CreateView and a corresponding ModelForm: I can't get the form to process the POSTed data and save the object. When submitting the data, I get sent back to the same page with the form. {{ form.errors }} and {{ form.non_field_errors }} don't output anything in my template, so there do not seem to be any errors. What am I doing wrong? Do I have to manually bind the data to the form? views.py class CreateFlyerView(CreateView, CookLoginRequired): template_name = 'flyer/create.html' model = Flyer form_class = CreateFlyerForm success_url = reverse_lazy('flyer_start') def get_form_kwargs(self): kwargs = super(CreateFlyerView, self).get_form_kwargs() kwargs.update({'user': self.request.user}) return kwargs def get_context_data(self, **kwargs): context = super(CreateFlyerView, self).get_context_data(**kwargs) now = datetime.datetime.now() meals_as_host = MenuOffer.objects.filter(deleted=False, host=self.request.user).order_by('cdate') upcoming_meals_as_host = meals_as_host.filter(eating_time__gte=now).order_by('cdate')[:4] past_flyers = Flyer.objects.filter(host=self.request.user, cdate__lt=now) context.update({ 'upcoming_meals_as_host': upcoming_meals_as_host, 'past_flyers': past_flyers, 'user_images': Image.objects.filter(account=self.request.user), }) return context forms.py class CreateFlyerForm(forms.ModelForm): picture = forms.ModelChoiceField(widget=forms.RadioSelect, queryset=Image.objects.all()) meals = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple, queryset=MenuOffer.objects.all()) headline = forms.CharField(widget=forms.Textarea) class Meta: model = Flyer fields = ['headline', 'copy', 'avatar', 'style', 'greeting', 'picture', 'meals'] def __init__(self, *args, **kwargs): user = kwargs.pop('user') super(CreateFlyerForm, self).__init__() self.fields['headline'].initial = _(u'Some headline with {}').format(user.neighborhood if user.neighborhood else user.place) self.fields['copy'].initial = _(u'Some copy.') self.fields['avatar'].initial = user.image self.fields['style'].initial = 'MODERN' self.fields['greeting'].initial = user.first_name self.fields['picture'].queryset … -
Check if a model already has a FK
I have the following models: class Device(models.Model): id = models.CharField(max_length=10, primary_key=True) def __str__(self): return self.id class User(models.Model): id = models.CharField(max_length=10, primary_key=True) device = models.ForeignKey(Device, blank=True, null=True, on_delete=models.SET_NULL) def __str__(self): return self.id When I try to add a new User, I need to know that the device that is going to be added to that User is not already in use. How I can check if that device has already an User with it's FK? -
Django rest framework api with existing mysql database
class Author(models.Model): first_name = models.CharField(max_length=20) last_name = models.CharField(max_length=20) def __str__(self): return f'{self.first_name} {self.last_name}' Hi How can i create an django rest framework api that connect to already existing mysql tables instead of creating through model.py. my model.py is shows something like this? Instead of this, i need to take data directly from existing tables in mysql. -
How to append key and value after implementing prefetch_related() method
I have implemented a class based view with a GET method to get payslip details per id. How do I append the net_allowance in the payslip object so that JSON would look like this: { "employee__user__id": 2, "payslip_no": "GGT5698", "employee__user__first_name": "Nick", "basic_salary__salary_value": 80000.0, "net_allowances": 5400.0, "total_deductions": 2500.0, "payment_mode__name": "Bank", "month_ending": "2018-03-16", "employee__user__last_name": "Cannon" } class PayrollView(APIView): def get(self, request, pk, format=None): try: payslip = Payslip.objects.filter(id=pk).prefetch_related('user', 'employee').values( 'payment_mode__name', 'payslip_no', 'allowances__amount', 'deductions__amount', 'month_ending', 'basic_salary__salary_value', 'employee__user__last_name', 'employee__user__first_name', 'employee__user__id' ) net_allowance = payslip.aggregate( net_allowance=Sum('allowances__amount')) except Exception as e: # print(e) return Response(data=e, status=status.HTTP_400_BAD_REQUEST) return Response(data=payslip, status=status.HTTP_200_OK) -
Is there any more elegant way to display a django model instance at the html?
I powered a site by django, and use custom templatetags to show objects' detail page. The views, templatetags and template is as bellow: # views.py from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic.detail import DetailView class FlowDetailView(LoginRequiredMixin, DetailView): model = CardFlow template_name = 'servers/card_detail.html' # templatetags/model_fields.py from django import template register = template.Library() @register.filter def field_list(model): return [i for i in model._meta.fields if i.name != 'id'] @register.filter def display_attr(field, model): display = f'get_{field.name}_display' if hasattr(model, display): return getattr(model, display)() return getattr(model, field.name, '') # card_detail.html {% extends "base.html" %} {% load account %} {% load i18n %} {% load model_fields %} {% block title %}{{ object }}{% trans Detail %}{% endblock %} {% block content %} <ul class="nav navbar-nav pull-right"> {% for field in object|field_list %} {% with field|display_attr:object as value %} {% if value %} <p>{{ field.verbose_name }}: {{ field|display_attr:object }}</p> {% endif %} {% endwith %} {% endfor %} </ul> {% endblock %} Is there any way else to obtain the same result more pythonic? -
How to add Django Registrations Redux within another form
I wanted to create a form where user fills in information and at the end, if the user is not logged in he gets a form in that page itself before the submit buttom to register his account. I was using django-registrations-redux I want to add in form_template.html <form id="CurrentForm" action="" enctype="multipart/form-data" method="POST">{% csrf_token %} . . . //normal form content {% if not user.is_athenticated %} //display the registration form {% endif %} . <input type='submit' value='submit' /> Also, how do I write views.py for this above case. -
Django & Jquery : after adding forms with button jquery cannot work correctly
Let's say I have the following formsets. {% for form in formset %} <tr style="border:1px solid black;" id="{{ form.prefix }}-row" class="dynamic-form" > <td{% if forloop.first %} class="" {% endif %}></td> {% render_field form.choicefield1 class="form-control" %}{{form.typeTiers.errors}} </td> <td> {% render_field form.choicefield2 class="form-control" %}{{form.tiers1.errors}} </td> <td>{% render_field form.choicefield3 class="form-control" %}{{form.numfacture1.errors}} </td> </tr> {% endfor %} <td><input type="submit" name="ajoutligne" value="Ajouter une ligne" class="btn btn-primary" id="add-row" style="background-color: #8C1944; border-color: #8C1944; float:right;margin: 5px;" onclick="test()"></td></tr> the forms are added using dynamic-formset.js , which I call in the code bellow to create a new form when clicking on my button : $(function () { $('#add-row').click(function() { addForm(this, 'form'); }); }) and I need to applay jquery function on every row I add in my formset. That's why I created the function test called in onclickfunction: var jax= -1; function test(){ jax =jax+1; alert($('#id_form-'+jax+'-typeTiers').attr('name')); $("#id_form-"+jax+"-typeTiers").change(function () { alert($('#id_form-'+jax+'-typeTiers').attr('name')); x="<option>5</option>"; y="<option>0</option>"; $("#id_form-"+jax+"-tiers").html(x); $("#id_form-"+jax+"-numfacture").html(y); }); } what I need is to make my rows independent of each other, so if I change the field1 in my first row, only the second field in the same row changes, without affecting the other rows. however I have two problems : The first : when I load the page in the first place, … -
CreateView template with ManyToMany fields
I'm dabbling with Django and I'm facing a problem I cannot solve. I have a M2M relationship between three tables and I want to create a CreateView. For the sake of simplifying, let's say we have this three models: class Ingredient(models.Model): name = models.Charfield(max_length=20, unique=True) class Recipe(models.Model): recipe_name = models.Charfield(max_length=20, unique=True) ingredients = models.ManyToManyField(Ingredient, through=Units) class Unit(models.Model): recipe = models.ForeignKey(Recipe, .... ingredient_units = models.FloatField() ingredient = models.ForeignKey(Ingredient, ....) When creating the new recipe (in a CreateView template), the user should introduce the recipe name, then has to select one of the current ingredients (in a select HTML tag) and add the units of that ingredient (2). Also, I want to add a button that adds a new row with an Ingredient select and a Unit field to add as many rows the user wants, and save it. The problem is, I don't know how to add fields from a M2M relationship to a CreateView template, nor how to save the Recipe at the same time as the many Units tuples. This is already working on the Admin section: Admin example but I want the same for the users on the front end. The question then is: How I can add … -
Pyspark celery task : toPandas() throwing Pickling error
I have a web application to run long running tasks in pyspark. I am using Django, and Celery to schedule the tasks. I have a piece of code that works great when I execute it in the console. But I am getting quite some errors when I run it through the celery task. Firstly, my udf's don't work for some reason. I put it in a try-except block and it always goes in to the except block. try: func = udf(lambda x: parse(x), DateType()) spark_data_frame = spark_data_frame.withColumn('date_format', func(col(date_name))) except: raise ValueError("No valid date format found.") The error : [2018-04-05 07:47:37,223: ERROR/ForkPoolWorker-3] Task algorithms.tasks.outlier_algorithm[afbda586-0929-4d51-87f1-d612cbdb4c5e] raised unexpected: Py4JError('An error occurred while calling None.org.apache.spark.sql.execution.python.UserDefinedPythonFunction. Trace:\npy4j.Py4JException: Constructor org.apache.spark.sql.execution.python.UserDefinedPythonFunction([class java.lang.String, class org.apache.spark.api.python.PythonFunction, class org.apache.spark.sql.types.DateType$, class java.lang.Integer, class java.lang.Boolean]) does not exist\n\tat py4j.reflection.ReflectionEngine.getConstructor(ReflectionEngine.java:179)\n\tat py4j.reflection.ReflectionEngine.getConstructor(ReflectionEngine.java:196)\n\tat py4j.Gateway.invoke(Gateway.java:235)\n\tat py4j.commands.ConstructorCommand.invokeConstructor(ConstructorCommand.java:80)\n\tat py4j.commands.ConstructorCommand.execute(ConstructorCommand.java:69)\n\tat py4j.GatewayConnection.run(GatewayConnection.java:214)\n\tat java.lang.Thread.run(Thread.java:748)\n\n',) Traceback (most recent call last): File "/home/fractaluser/dev_eugenie/eugenie/venv_eugenie/lib/python3.4/site-packages/celery/app/trace.py", line 374, in trace_task R = retval = fun(*args, **kwargs) File "/home/fractaluser/dev_eugenie/eugenie/venv_eugenie/lib/python3.4/site-packages/celery/app/trace.py", line 629, in __protected_call__ return self.run(*args, **kwargs) File "/home/fractaluser/dev_eugenie/eugenie/eugenie/algorithms/tasks.py", line 68, in outlier_algorithm spark_data_frame = spark_data_frame.withColumn('date_format', func(col(date_name))) File "/home/fractaluser/dev_eugenie/eugenie/venv_eugenie/lib/python3.4/site-packages/pyspark/sql/udf.py", line 179, in wrapper return self(*args) File "/home/fractaluser/dev_eugenie/eugenie/venv_eugenie/lib/python3.4/site-packages/pyspark/sql/udf.py", line 157, in __call__ judf = self._judf File "/home/fractaluser/dev_eugenie/eugenie/venv_eugenie/lib/python3.4/site-packages/pyspark/sql/udf.py", line 141, in _judf self._judf_placeholder = self._create_judf() File "/home/fractaluser/dev_eugenie/eugenie/venv_eugenie/lib/python3.4/site-packages/pyspark/sql/udf.py", line 153, in … -
Django rest api validate data sent in the requests
I am trying to build a Django rest api to allow my clients to send requests with data, so that I can save them to a db. I have done that part but other than the format validation achieved through Serializers I also want check for data validation.... for example UnitOfMeasureName = ["Each", "Grams", "Ounces", "Pounds", "Kilograms", "Metric Tons"] UnitOfMeasureName should be one of the above in the list, So if a user sends {..., 'UnitOfMeasureName': 'invalid_one', ...} in request data I want to send a bad request. (This will pass the serializer as the type is string) Any ideas please, If you need any clarification please ask in the comments. And thanks in advance.. :) -
Sentry send notification SystemExit: 1
On web server I'm using Python3.6, Django with Gunicorn and Supervisor. After deploy to server I began to receive notifications from Sentry like this: Message SystemExit: 1 Last lines of log: File "rest_framework/serializers.py", line 1022, in get_fields source, info, model, depth File "rest_framework/serializers.py", line 1152, in build_field return self.build_standard_field(field_name, model_field) File "rest_framework/serializers.py", line 1176, in build_standard_field field_kwargs = get_field_kwargs(field_name, model_field) File "rest_framework/utils/field_mapping.py", line 77, in get_field_kwargs if model_field.verbose_name and needs_label(model_field, field_name): File "rest_framework/utils/field_mapping.py", line 52, in needs_label return capfirst(model_field.verbose_name) != default_label File "django/utils/functional.py", line 136, in __eq__ return self.__cast() == other File "gunicorn/workers/base.py", line 192, in handle_abort sys.exit(1) What can be reason of this?