Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ProgrammingError at /sign-up/ relation "auth_user" does not exist LINE 1: SELECT (1) AS "a" FROM "auth_user" WHERE "auth_user"."userna
so i just hosted my django app on Heroku and everytime i try to create an account i keep getting this error my views.py register function def register(request): if request.user.is_authenticated: return redirect('home') form = registerform() if request.method == 'POST': form = UserCreationForm(request.POST) if form.is_valid(): user = form.save(commit=False) user.username = user.username.lower() user.save() login(request, user) return redirect('home') else: messages.error(request, 'User does not exist') return render(request, 'register.html', {'form' : form}) help, thanks -
Django AWS Elastic Beanstalk .ebextensions cronjob
I have successfully set up a cron in AWS extensions to run a Django command at a certain time. Although, I have unsuccessfully been able to run/add multiple commands at different times. Question: if I wanted to run multiple Django commands as cron jobs, would I add new duplicate config files (like below) within in my .ebextensions folder OR is it possible to add a new Django command (w/ different time) to the one below? .ebextensions -cron_job.config files: /usr/local/bin/cron_activity_use.sh: mode: "000755" owner: root group: root content: | #!/bin/bash source /opt/python/run/venv/bin/activate source /opt/python/current/env cd /opt/python/current/app docker exec `docker ps --no-trunc -q | head -n 1` python manage.py cron_activity_use /etc/cron.d/m_cron: mode: "000644" owner: root group: root content: | */10 * * * * root /usr/local/bin/cron_activity_use.sh commands: rm_old_cron: command: "rm -fr /etc/cron.d/*.bak" ignoreErrors: true -
How we use Recommendation System in Django?
I am working on a project (Recommendation for Clothes of E-commerce Site for Online Shopping) in which we almost done module 1 and in module 2 I use recommendation system. Requirements are : The system should be able to recommend the products to the user based on his/her buying history. For implementing the recommendation functionality in your Project you have to use AI (Machine Learning) based Approach. So how I'll perform this task ? -
DJANGO - Add/update/delete row in table with backup in sqlite database
Hi everyone :) (sry for my bad english you will have a french accent x) ) I'm stuck in my project because i need to update data already display by model (database objects). So, i need to add a row, delete a row with confirmation of user, and modify data ( i can already modify data but only into the table (with contenteditable="true" into the td ), it don't save it into the database). I really need you help to solve this problems, thanks in advance everyone :) Here my models (i use tableau): from django.db import models class Intervenants(models.Model): name = models.CharField(max_length=3, null=True) def __str__(self): return self.name class tableau(models.Model): Statut = models.CharField(max_length=1, null=True) Facturation = models.CharField(max_length=1, null=True) Commande = models.CharField(max_length=1, null=True) Num_d_affaire = models.CharField(max_length=100, null=True) Projet = models.CharField(max_length=120, null=True) Localisation = models.CharField(max_length=120, null=True) Descriptif = models.CharField(max_length=120, null=True) Archi = models.CharField(max_length=120, null=True) Date_Marqueur = models.CharField(max_length=10, null=True) BBIO_RT = models.CharField(max_length=10, null=True) DIAG_FAISA = models.CharField(max_length=10, null=True) APS = models.CharField(max_length=10, null=True) APD = models.CharField(max_length=10, null=True) PRO = models.CharField(max_length=10, null=True) DCE = models.CharField(max_length=10, null=True) ACT = models.CharField(max_length=10, null=True) VISA = models.CharField(max_length=10, null=True) DET = models.CharField(max_length=10, null=True) AOR = models.CharField(max_length=10, null=True) Charge_d_affaire = models.CharField(max_length=3, null=True) Second = models.CharField(max_length=3, null=True) Intervenant3 = models.CharField(max_length=3, null=True) Intervenant4 = … -
DRF: Share data between multiple SerializerMethodFields in ListSerializer
I have a DRF project with the following view: class AssetViewSet( mixins.ListModelMixin, mixins.RetrieveModelMixin, viewsets.GenericViewSet, ): queryset = Asset.objects.all() serializer_class = AssetSerializer def get_serializer_class(self): if self.action == "list": return AssetListSerializer if self.action == "retrieve": return AssetSerializer return AssetSerializer # For create/update/destroy My problem is within the AssetListSerializer: class AssetListSerializer(serializers.ModelSerializer): id = serializers.ReadOnlyField() name = serializers.ReadOnlyField() block_count = serializers.SerializerMethodField("get_block_count") requirement_count = serializers.SerializerMethodField("get_requirement_count") open_requirements = serializers.SerializerMethodField("get_open_requirements") in_progress = serializers.SerializerMethodField("get_in_progress") measure_count = serializers.SerializerMethodField("get_measure_count") All these methods call the same internal (expensive) method and then work with the result: def _get_asset_requirements(self, asset_id): req = do_some_expensive_method(asset_id) return req def get_requirement_count(self, instance): requirements = self._get_asset_requirements(instance.id) blablabla def get_open_requirements(self, instance): requirements = self._get_asset_requirements(instance.id) blablabla def get_in_progress(self, instance): requirements = self._get_asset_requirements(instance.id) blablabla So what I would like to do is to only to the expensive method once per object and then access the result from the SerializerMethodField-methods. I have found this part in the documentation: https://www.django-rest-framework.org/api-guide/serializers/#customizing-listserializer-behavior However I am clueless on how to implement it. My idea was something like: @classmethod def many_init(cls, *args, **kwargs): cls.req = cls._get_asset_requirements(cls.instance.id) return super().many_init(*args, **kwargs) but this does not work as I can't access the instance this way and the documentation is really incomplete here. Does anyone have an idea how to solve … -
python subprocess command (javac "Main.java") is not working on production
i am trying to compile java file from python(django). when i run my code on local sever then my java file compiled sucessfully but when i upload the files on heroku,Javac not found error showing def method1(request): code=request.data.get('code') len1=request.data.get('len') if os.path.isfile("Main.java"): os.remove("Main.java") f = open("Main.java", "x") f.write(code) f.close() file = 'Main.java' # codes[compile(file,len1)] std="" try: output = subprocess.check_output( "javac "+file, stderr=subprocess.STDOUT, shell=True, timeout=3, universal_newlines=True) except subprocess.CalledProcessError as exc: std="Status : FAIL", exc.returncode, exc.output else: # std="Output: \n{}\n".format(output) std="compiled sucess" context={ 'msg':'we got data', 'code':code, 'len':len1, 'std':std } return Response(context) This is my view.py file. response on local server "msg": "we got data", "code": "public class Main{\n public static void main(String[]args){\n \n System.out.println(\"HELLO Sid\");\n \n }\n}", "len": "java", "std": "compiled sucess" } response on heroku server "msg": "we got data", "code": "public class Main{\n public static void main(String[]args){\n \n System.out.println(\"HELLO Sid\");\n }\n}", "len": "java", "std": [ "Status : FAIL", 127, "/bin/sh: 1: javac: not found\n" ] }``` -
Chatting platform with django
I built a real-time chatting platform with Django framework using channels, but I don't understand why it's not saving the chat history to the database. So I added a few lines of codes, but now it showing undefined. Can anybody show me how to fix the code on my consumers.py? from django.contrib.auth import get_user_model from channels.generic.websocket import WebsocketConsumer from asgiref.sync import async_to_sync from .models import Message import json User = get_user_model class ChatConsumer(WebsocketConsumer): def fetch_messages(self, data): messages = Message.last_10_messages() content = { 'messages': self.messages_to_json(messages) } self.send_messages(content) def new_message(self, data): author = data['from'] author_user = User.objects.filter(username=author)[0] message = Message.objects.create( author=author_user, content=data['message']) content = { 'command': 'new_message', 'message': self.message_to_json(message) } return self.send_chat_message(content) def messages_to_json(self, messages): result = [] for message in messages: result.append(self.message_to_json(message)) return result def message_to_json(self, message): return { 'author': message.author.username, 'content': message.content, 'timestamp': str(message.timestamp) } commands = { 'fetch_messages': fetch_messages, 'new_message': new_message } def connect(self): self.room = self.scope['url_route']['kwargs']['room'] self.room_group_name = 'chat_%s' % self.room async_to_sync(self.channel_layer.group_add)( self.room_group_name, self.channel_name ) self.accept() def disconnect(self, close_code): async_to_sync(self.channel_layer.group_discard)( self.room_group_name, self.channel_name ) # Receive message from WebSocket def receive(self, text_data): data = json.loads(text_data) self.commands[data['command']](self, data) def send_chat_message(self, message): async_to_sync(self.channel_layer.group_send)( self.room_group_name, { 'type': 'chat_message', 'message': message } ) def send_messages(self, message): self.send(text_data=json.dumps(message)) def chat_message(self, event): message = event['message'] … -
DetailView in Django, keyword 'slug'
I recently started learning Django. I want to display one news item, but when I open on the link I get an error message: Cannot resolve keyword 'slug' into field. Choices are: NewsTitles, NewsContent, NewsSlug Request Method: GET Request URL: http://127.0.0.1:8000/news/nam-gravida-purus-non/ Django Version: 4.0 Exception Type: FieldError views.py from django.views.generic import DetailView from .models import News class GetNews(DetailView): model = News slug_url_kwarg = 'NewsSlug' template_name = 'news/single_news.html' context_object_name = 'single_news' allow_empty = False urls.py from django.urls import path from .views import GetNews urlpatterns = [ path('news/<str:NewsSlug>/', GetNews.as_view(), name='news'), ] models.py from django.db import models from django.urls import reverse_lazy class News(models.Model): NewsTitles = models.CharField(max_length=120) NewsContent = models.TextField(max_length=255) NewsSlug = models.SlugField(max_length=255) def __str__(self): return self.NewsTitles def get_absolute_url(self): return reverse_lazy('news', kwargs={'NewsSlug': self.NewsSlug}) What am I doing wrong? -
populate an excel with data from a django model
I populated a Django model with a pandas dataframe. In order to do this is had I used the to_dict() function in order for JSONField() Django model to accept the data. Is fine and works well. No what I am trying to do is to populate an excel file with this data. So I am accessing the data in the Django model and trying to use openpyxl to populate an excel with this data. However I am running into problems as I am getting the error saying that it cannot convert to excel. Anyway around this? My model: class myvalues(models.Model): items_list = models.JSONField() function that’s trying to populate excel: values_to_go_into_excel_obtained_from_model = myvalues.objects.values_list(“items_list”, flat=True) path = file_for_download.my_file.path wb = load_workbook(path) ws = wb["Sheet1"] pd.read_excel(path, engine='openpyxl', sheet_name="Sheet1") for row, v in enumerate(values_to_go_into_excel_obtained_from_model, 2): ws.cell(row, 4, v) wb.save(path) Any ideas why I am getting the error. Basically what Im trying to do is: Step 1: pandas df -> Django model of type Json Step 2: Access Django model values Step 3: put values from Django model into excel file I have step 1 and 2 but for cant get step 3. -
TypeError: Object of type Vehicle is not JSON serializable
when I try to filter my model I got this error TypeError: Object of type Vehicle is not JSON serializable my model class Vehicle(models.Model): driver_id = models.ForeignKey(Driver,on_delete=CASCADE,unique=True,null=True, blank=True) make = models.CharField(max_length=150) model = models.CharField(max_length=150) plate_number = models.CharField(max_length=10,validators = [validate_plate_numberLATIN,validate_plate_numberCYRYLLIC], unique=True) created_at = models.DateTimeField(default=NOW) updated_at = models.DateTimeField(default=NOW) def __str__(self): return self.make -
what causes Unhandled exception in wfastcgi.py: Traceback (most recent call last) in django +IIS
I create web app by django and IIS 10 web service on windows serevr 2019. I have problem in log file of wfastcgi log file that configured in web.config. text of log and problem is: 2021-12-10 16:26:35.568572: Unhandled exception in wfastcgi.py: Traceback (most recent call last): File "c:\python37\lib\site-packages\wfastcgi.py", line 774, in main record = read_fastcgi_record(fcgi_stream) File "c:\python37\lib\site-packages\wfastcgi.py", line 158, in read_fastcgi_record data = stream.read(8) # read record OSError: [Errno 22] Invalid argument 2021-12-10 16:26:35.615397: Running on_exit tasks 2021-12-10 16:26:35.646693: wfastcgi.py 3.0.0 closed 2021-12-10 16:59:42.309400: wfastcgi.py will restart when files in C:\inetpub\wwwroot\ are changed: .*((\.py)|(\.config))$ 2021-12-10 16:59:42.340650: wfastcgi.py 3.0.0 initialized each 1 hour wfastcgi raise OSError: [Error 22] and run exit task and after minutes restart again. I added follow line to web.config but no any impact on this error: <add key="SCRIPT_NAME" value="/Music_backend" /> whole web.config text is as bellow: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> </system.webServer> <appSettings> <add key="PYTHONPATH" value="C:\inetpub\wwwroot\Music_backend" /> <add key="WSGI_HANDLER" value="Music_backend.wsgi.application" /> <add key="DJANGO_SETTINGS_MODULE" value="Music_backend.settings" /> <add key="SCRIPT_NAME" value="/Music_backend" /> <add key="WSGI_LOG" value="c:\wfastcgi.log"/> </appSettings> <location path="" overrideMode="Deny"> <system.webServer> </system.webServer> </location> <location path="" overrideMode="Allow"> <system.webServer> <handlers> <add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="c:\python37\python.exe|c:\python37\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" /> </handlers> </system.webServer> </location> </configuration> in addition i active Django.server , Django.request, Django.db.Backend LOGGING … -
Django migration- How to fix uniqueness=True on migration (backwards)?
A field in my model used to have no constraints. But in order to avoid problems in the future i need to make the field unique=True. This will obviously raise a Key (field)=(foo) is duplicated What is the best practice to fix that migration backwards in order to not raise an error? -
comparing forloop variables to a number
<ul class="navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link" href="/">Home </a> </li> <li class="nav-item"> <a class="nav-link" href="{% url 'store' %}">Products</a> </li> {% for x in cat %} <li class="nav-item"> <a class="nav-link" href="#">{{x.name}}</a> </li> {% if forloop.counter >3%} <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">More</a> <div class="dropdown-menu"> <a class="dropdown-item" href="#">{{x.name}}</a> </div> </li> {% endif %} {% endfor %} </ul> So what i want here is the objects in the for loop counter be more that three then all should come in the dropdown menu which but it is not working as of now and giving me this error what is the best way to handle this problem Could not parse the remainder: '>3' from '>3' Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 4.0 Exception Type: TemplateSyntaxError Exception Value: Could not parse the remainder: '>3' from '>3' Exception Location: C:\Users\saran\OneDrive\Desktop\e-com-test\core\hienv\lib\site-packages\django\template\base.py, line 692, in __init__ Python Executable: C:\Users\saran\OneDrive\Desktop\e-com-test\core\hienv\Scripts\python.exe Python Version: 3.9.6 Python Path: ['C:\\Users\\saran\\OneDrive\\Desktop\\e-com-test\\core', 'C:\\Users\\saran\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip', 'C:\\Users\\saran\\AppData\\Local\\Programs\\Python\\Python39\\DLLs', 'C:\\Users\\saran\\AppData\\Local\\Programs\\Python\\Python39\\lib', 'C:\\Users\\saran\\AppData\\Local\\Programs\\Python\\Python39', 'C:\\Users\\saran\\OneDrive\\Desktop\\e-com-test\\core\\hienv', 'C:\\Users\\saran\\OneDrive\\Desktop\\e-com-test\\core\\hienv\\lib\\site-packages'] Server time: Fri, 10 Dec 2021 13:32:32 +0 -
How to relate multiple same models related_name in django
I have two models Movie and Actor class Actor(models.Model): id = models.UUIDField(default=uuid.uuid4, primary_key=True, editable=False) name = models.CharField(name="name", max_length=2000, blank=True, null=True) class Movie(models.Model): id = models.UUIDField(default=uuid.uuid4, primary_key=True, editable=False) name = models.CharField(name="name", max_length=2000, blank=True, null=True) actors = models.ManyToManyField(Actor, related_name='movie_actor') Now I would like to let the users to add their favourite actors like class MyUser(AbstractUser): actors = models.ManyToManyField(Actor, related_name='user_actor') Now, I would like to make the response for each movie so that the movie can tell that this movie has one/more of their favourite actors or not? -
how to send CSRF token using flutter http request
how to send CSRF token using flutter HTTP request I have a Django based project that uses django-rest-framework for API, when I send a POST request using Postman it works perfectly fine,, but when I send an HTTP.post request from my flutter application I get this response : Forbidden 403 CSRF verification failed. Request aborted. You are seeing this message because this HTTPS site requires a “Referer header” to be sent by your Web browser, but none was sent In django am using function based view to receive the requests: @api_view(['POST']) @permission_classes([AllowAny,]) @csrf_exempt def create_user(request): ...... ..... then in the URLS : path("api/v1/create_user/", api.create_user, name="create_user"), and am sending the request in flutter : http.post(Uri(myURL),header={ 'Content-Type': 'application/x-www-form-urlencoded', } ,body={ 'my_key':'my_value', }) -
Django and Python
Good afternoon, I am new to Django / Python and I am finding my way around things. I've been searching around on the internet but cant really find an answer to my question which is the following: I am trying to create a Django website that will have several pages. On each of these pages I am looking to create a Python task. One of these tasks on one of the pages might be for a user to enter an input such as a name John Smith and click search. I wish for the Python script to then go and search for all John Smith related material on the internet and return results. Firstly would the Python script be able to sit on the Django web page to do this ? Or am I misunderstanding what Django can do. Secondly will I just mix the script in with the HTML etc ? Thank you in advance. -
Accessing model data in python django
I have a a Django model: class Myvalues(models.Model): items_list = models.JSONField() I have populated this model in Django admin. I now want to access the data inside this model. However I am getting an error that says: 'Manager' object has no attribute ‘items_list' The way I am trying to access it is as follows: Print(Myvalues.objects.items_list.values()) I don’t understand why this is coming up as the class has that model in it. Out of interest I printed the all() result of Myvalues class, like so: print(Myvalues.objects.all()) this resulted in the following: <QuerySet [<Myvalues: Myvalues object (1)>]> How can I access the data that’s in my items_list model? -
Django Urls conflict
In my App urls.py i have a urls conflict, every one is pointing to a different View, they have same syntax but one have a urls.py path('dashboard/categories/<str:category_name>', views.CategoryProductsView.as_view(), name='category_products') path('dashboard/categories/add_category', views.AddCategoryView.as_view(), name='add_category'), When i disable (comment) the first one the second url works fine , that's why i think that the problem comes from a url conflict -
what kind of architecture pattern is my application?
I am trying to understand what kind of architecture my application has. I have a simple Django App which can create, read, update and delete from a MySQL database I have connected to it. This app is for one specific customer. now I would either say it is a monolithic architecture because it is all coded in the same application and if some component goes down(presentation, logic or data) the whole application will break. but I would maybe also say it was a layered(n-tier) architecture maybe? because Django it self is MVT architecture? So what is the right to say? -
django: customized primary key based on form template
I have the following model: UNIT = (("pounds","pounds"),("pcs","pcs"),("kg","kg"),("g","g")) CATEGORIES = (("finished good","finished good"),("raw material","raw material")) class Product_Hierarchy(models.Model): product_code = models.CharField(max_length=100, primary_key=True) parent_product_code = models.ForeignKey("self",on_delete=models.CASCADE) product_name = models.CharField(max_length=100) product_category = models.CharField(max_length=100,choices=CATEGORIES, default="finished good") stock_on_hand = models.FloatField(max_length=1000000) unit = models.CharField(max_length=100, choices = UNIT, default="pcs") and I am trying to set the product code to be build in accordance with the category in which the product belongs to. It does not seem possible to automatically build it after the product category selection. Because the product creation is rendered in two templates: finished good registration template and the other one is the raw material registration template. I am wondering if I could write something that detects from where the model is accessed and automatically generate the code corresponding to the category. Here is what my form look like: CATEGORY_CHOICES = [ ('finished good', 'finished good'),('raw material', 'raw material'), ] UNIT = [("pounds","pounds"),("pcs","pcs"),("kg","kg"),("g","g")] class UpdateProductForm(forms.ModelForm): product_category = forms.CharField(widget=forms.Select(choices=CATEGORY_CHOICES), label='Category') product_name = forms.CharField(label = 'Product Name') stock_on_hand = forms.CharField(label = 'Stock On Hand') unit = forms.CharField(widget=forms.Select(choices=UNIT), label='Unit') class Meta: model = Product_Hierarchy fields = ("product_name", "product_category", "stock_on_hand", "unit") I have not yet found a way to do that, the documentation does not cover it and my … -
How can we achive max of every stock valid date with foreign key name with ORM Django
model class stock(models.Model): id = models.AutoField(primary_key=True) symbol = models.CharField(max_length=30) name = models.CharField(max_length=50) sector = models.CharField(max_length=50,blank=True,null=True) validtill = models.DateTimeField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(blank=True,null=True) class quote(models.Model): id = models.AutoField(primary_key=True) stock = models.ForeignKey(stock, related_name='quote', on_delete=models.CASCADE) valid_till = models.DateTimeField() ... Current solution quote.objects.values('valid_till').annotate(max_date=Max('valid_till')).values('stock','valid_till','price','created_at') {'stock': 984, 'valid_till': datetime.datetime(2021, 12, 9, 19, 4, 16), 'max_date': datetime.datetime(2021, 12, 9, 19, 4, 16)} getting the result from above query but only thing I want is get the stock symbol from foreign key table instead of id I want foreign key table column value -
Multi-model RSS Feed in Django
I am trying to figure out how to have a multi-model RSS feed in Django. That is, I would like Django to serve updates of two different models under one RSS url. Here is what I have thus far class ArticleFeed(Feed): title = "Articles" link = "/articles/" description = "RSS feed of Articles" def items(self): return Article.objects.filter(is_published=1) def item_title(self, item): return item.title def item_description(self, item): return item.get_description() def item_link(self, item): return item.get_absolute_url() class VideoFeed(Feed): pass class atomFeed(Feed): feed_type = Atom1Feed In urls.py I have the following path path('rss/', ArticleFeed(), name="article_feed"), I would like rss/ to provide updates to both the Article and Video model. The Video model has similar fields but is non-verbatim. -
Django translation.override() not working
I literally copy-pasted this from the docs: class CustomerAdmin(ExportActionMixin, admin.ModelAdmin): def mail(self, request, queryset): with translation.override('nl'): print(_('Hello')) still prints Hello instead of Hallo Docs state this should work regardless of what settings or middleware you've got enabled. I tried nl, de, and dk, it's always English. I'm on Django 3.6 -
How to check if a request consists of session id and csref token in the cookie in Django rest framework?
my rest_framework authentication and permission classes "DEFAULT_PERMISSION_CLASSES": [ "rest_framework.permissions.IsAuthenticated", "rest_framework.permissions.IsAdminUser", "rest_framework.permissions.AllowAny", ], "DEFAULT_AUTHENTICATION_CLASSES": ( "rest_framework_simplejwt.authentication.JWTAuthentication", "rest_framework.authentication.SessionAuthentication", "rest_framework.authentication.BasicAuthentication" ), login view class UserLoginView(generics.RetrieveAPIView): """ View for a user to login through 1FA. The view provides a post request that accepts a email and password. Returns a jwt token as a response to authenticated user. """ throttle_scope = "login" permission_classes = (permissions.AllowAny,) serializer_class = UserLoginSerializer def post(self, request): """ POST request to login a user. """ #if session key is not present then create a session for the user serializer = self.serializer_class(data=request.data) serializer.is_valid(raise_exception=True) if not request.session.session_key: request.session.save() return Response("logged in") In my login view if user credentials are valid i am creating a user session if not created yet. For all other requests i need to ensure that user has a active session i.e. a session id in the cookie and csrf token to secure the application , is there method provided by rest framework to do that or i need to write my own permission classes for the views -
calling external API results in alert messages
I havwe a fine working script, that behaves odly: def get_info(self, env, limit = None): token = self.get_token()["access_token"] if limit == None: url = f"""{env}infos""" else: url = f"""{env}infos?limit={limit}""" payload = {} headers = {"Authorization": f"""Bearer {token}"""} response = requests.request("GET", url, headers = headers, data = payload) if response.status_code != 200: return False return json.loads(response.text) There is a simple view returning the data to the frontend: class TheView(TemplateView): template_name = "apihlp/index.html" def get_context_data(self, *args, **kwargs): context = super().get_context_data(**kwargs) data = get_data() context.update({"data": data}) return context with get_data looking like this: def get_data(): infos = get_infos("some_url", limit = 20) ORGADATA = [] counter = 0 for info in infos: name = f"""<h3 style="color:green">{counter}: {info["organization"]}</h3>""" try: owners = "".join([f"""<li>{info["mail"]}""" for info in infos["owner"]]) except: owners = "" ORGADATAHTML = f"{name}<h4>owners:</h4>{owners} ORGADATA.append({"counter": counter, "id": info["id"], "name": info["organization"], "HTML": ORGADATAHTML}) html part is even simpler: {% for item in data %} {{ item.HTML|safe }} {% endfor %} I know from doing the same call in postman, I can receive 50+ objects. When I set limit to 10 or 20 everyhing works fine (works fine in Postman with set to 10000 as well ...). But in Django I get: [![enter image description here][1]][1] and after …