Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Get EB Django site to work on single instance and application load balanced environment
I have a website that I have setup on code pipeline. It has a prod and test environment. To get https redirection to work I included a set of configuration files into the .ebextensions directory of my Django app and I will include a copy of these below. I have found that running two load balanced environments is expensive, so I would love to change my test environment to single instance. I tried this a couple of weeks ago and unfortunately the https redirection configuration file seems to create an error. I assume it is because the file has been written to configure an application load balancer, not a single instance. At present I am using an environment variable to specify if I am in test or production (EnvTyp='test' or EnvType='prod'), so I am wondering if there is a way to change which configuration files you use based upon an environment variable, however I have to say that I am relatively new to EB and AWS and so my knowledge of what these files do is almost non existent. Files: https://github.com/awsdocs/elastic-beanstalk-samples/tree/master/configuration-files/aws-provided/security-configuration/https-redirect/python I have also used some configuration files from the following area: https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-https-configuration/ (eg https-backendsecurity.config, https-lbsecuritygroup.config and https-reencrypt-alb.config) It would … -
CloudFoundry: How to use multiple buildpacks? (NGINX + Django/Gunicorn)
I have Django/Gunicorn + whitenoise (for static files serving) working as a single app in Cloud Foundry using the following manifest.yml file: --- applications: - name: mydjango instances: 1 command: src/tvpv_portal/bin/start_gunicorn_django.sh memory: 2048M disk_quota: 1024M buildpacks: - https://github.com/cloudfoundry/python-buildpack.git stack: cflinuxfs3 env: DJANGO_MODE: Production For learning/experimentation, I would like to remove whitenoise and setup Nginx using the nginx_buildpack to work with Django/Gunicorn. However, I am not sure how to use multiple buildpacks on a single app. I have created a nginx.conf, mime.types, and buildpack.yml in my project directory following the directions at https://docs.cloudfoundry.org/buildpacks/nginx/index.html. nginx.conf daemon off; error_log /home/vcap/app/nginx-error.log; events { worker_connections 1024; } http { log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent'; access_log /home/vcap/app/nginx-access.log cloudfoundry; default_type application/octet-stream; include mime.types; sendfile on; gzip on; tcp_nopush on; keepalive_timeout 30; port_in_redirect off; # Ensure that redirects don't include the internal container PORT - 8080 server { listen {{port}}; server_name localhost; # Serve static files. location /static/ { alias /home/vcap/app/src/tvpv_portal/static/; } # Serve media files. location /media/ { alias /home/vcap/app/src/tvpv_portal/media/; } # Reverse proxy to forward to main app. location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://127.0.0.1:8000; } } } I tried doing cf push mydjango -b … -
duplicate error in insert data by django model in database mongo
I have field mobile in customers model django and now remove it and next makemigrations and next migrate. But when i want create new data to customers' table but it error customers index: mobile dup key. once it store in database mongodb but for the next time, it gives error what's problem and its the solution? please help me my Model: class Customers(models.Model): firstName = models.CharField(max_length=50) lastName = models.CharField(max_length=50) userName = models.CharField(max_length=50,unique=True) email = models.EmailField(max_length=254,blank=True) birthDate = models.CharField(max_length=50,blank=True) fatherName = models.CharField(max_length=50, default='',blank=True) nationalCode = models.CharField(max_length=50, default='',blank=True) certificateId = models.CharField(max_length=50, default='',blank=True) job = models.CharField(max_length=50, default='',blank=True) education = models.CharField(max_length=50,blank=True) married_date = models.CharField(max_length=50, default='',blank=True) originality = models.ForeignKey(County, default=None, on_delete=models.CASCADE) sex = models.CharField(max_length=50,blank=True) marital_status = models.CharField(max_length=50,blank=True) state = models.ForeignKey(States, default=None, on_delete=models.CASCADE,blank=True) address_home = models.TextField(default='',blank=True) postalCode_home = models.CharField(max_length=50,default='',blank=True) fax_work = models.CharField(max_length=50,default='',blank=True) address_work = models.TextField(default='',blank=True) postalCode_work = models.CharField(max_length=50,default='',blank=True) financial_status = models.CharField(max_length=50, default='',blank=True) typeContact = models.CharField(max_length=50,blank=True) ranting_customer = models.CharField(max_length=50, default='',blank=True) relationship_code = models.CharField(max_length=50, default='',blank=True) instagram = models.CharField(max_length=50,blank=True) telegram = models.CharField(max_length=50,blank=True) filename = models.CharField(max_length=50,blank=True) url = models.CharField(max_length=100,blank=True) dateRegister = models.CharField(max_length=50,blank=True) persianDateRegister = models.CharField(max_length=50, blank=True) timeRegister = models.CharField(max_length=50,blank=True) nameRegistrant = models.CharField(max_length=50, blank=True) imageRegistrant = models.CharField(max_length=50, default='',blank=True) my views Customers.objects.create(firstName = firstName, lastName = lastName,userName = userName,email = email,education = education,birthDate = birthDate,instagram = instagram,address_home=address_home,address_work=address_work,nationalCode=national_code,postalCode_home=postal_code_home, telegram = telegram,typeContact = typeContact,sex … -
How to render label and placeholder in django UpdateView?
I've been trying to make a update profile view with UpdateView in Django. However, even though I make labels and placeholders separately, it doesn't work! Here is my code view.py: class UpdateProfileView(UpdateView): model = models.User template_name = "users/update-profile.html" fields = ( "username", "email", "departure", "order", "kakaotalk", ) def get_form(self, form_class=None): form = super().get_form(form_class=form_class) form.fields["username"].widget.attrs = {"placeholder": ""} form.fields["username"].label = "이름" form.fields["username"].help_text = "" form.fields["email"].widget.attrs = {"placeholder": ""} form.fields["email"].label = "이메일" form.fields["departure"].widget.attrs = {"placeholder": ""} form.fields["departure"].label = "부서" form.fields["order"].widget.attrs = {"placeholder": ""} form.fields["order"].label = "기수" form.fields["kakaotalk"].widget.attrs = {"placeholder": ""} form.fields["kakaotalk"].label = "카카오톡 ID" return form def get_object(self, queryset=None): return self.request.user users/update-profile.html: {% block content %} <div class="container lg:w-5/12 md:w-1/2 mx-auto my-10 flex flex-col items-center p-5 border border-gray-500 mt-24"> <form class="" method="post" action="{% url "users:updateprofile" %}" enctype="multipart/form-data"> {% csrf_token %} <span class="font-bold">{{form.username}}</span> <span class="font-bold text-red-600 text-center">{{form.username.errors}}</span> <button class="btn mt-10">수정하기</button> </form> </div> {% endblock content %} If I run server with these codes, it looks like This labels and placeholders are disappeared... And also, if I use {{form}} and {{form.errors}} instead of {{form.username}} and {{form.username.errors}} I can see labels and placeholders, but it looks like This I don't want to show the error message twice...! Therefore, in this case, how to fix these … -
Django use select for update to create an auto increment filed
Intro: I have mulitple mechants saving data in one db instance(postgres), now for merchantA, the id in his role list is: 1,3,4,5,8, for merchantB: 2,6,7,8,10 , in order to let each merchant get their own sequential increment ids,for example, in forntend merchant A's role list should like this: "merchant_id":1, "role":{ "id":1,"name":admin, "id":2,"name":dev, "id":3,"name":finance, } merchant B's role list is: "merchant_id":2, "role":{ "id":1,"name":admin, "id":2,"name":dev, "id":3,"name":finance, } Solution: I set up a ref_id field on Role model instead of using db's default id filed, and use a table to keep the counting result when a role object is created. class Role(BaseModel): name = models.CharField( null=True, blank=True, max_length=50 ) ref_id = models.IntegerField(null=True, blank=True) merchant = models.ForeignKey(Merchant, on_delete=models.CASCADE) # use pre_save to save the count returned from AutoIDService @receiver(pre_save, sender=Role) def update_ref_id(sender, instance: Role, **kwargs): instance.ref_id = AutoIDService.next('Role', instance.merchant.id) #IDTable used to save persist count class IDTable(BaseModel): key = models.CharField(max_length=255, null=True, blank=True) ref_id = models.IntegerField(null=True, blank=True) #do the count, return current class AutoIDService: @classmethod def next(cls, table_name, merchant_id): key = table_name + str(merchant_id) with transaction.atomic(): id_table, created = IDTable.objects.select_for_update().get_or_create(key=key, defaults={'ref_id': 1}) print('created', created) if not created: print('created false') id_table.ref_id += 1 id_table.save() print('return value', id_table.ref_id) return id_table.ref_id Problem #This is the very first record … -
how to create multiple objects with one request DRF
I have the following models class Product(models.Model): name = models.CharField(null=True, blank=True, max_length=500) category = models.CharField(null=True, blank=True, max_length=120) class SpecificationName(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE, null=True, related_name='specifications') name = models.CharField(max_length=125) class Attribute(models.Model): spec_name = models.ForeignKey(SpecificationName, on_delete=models.CASCADE, null=True, related_name='attributes') index = models.CharField(max_length=200, blank=True, null=True) value = models.CharField(max_length=250, blank=True, null=True) after saving objects in Django admin I have an example { "name": "Apple Smart Watch", "category": "IT", "specifications": [ { "name": "Test Data", "attributes": [ { "index": "test", "value": "test2" }, { "index": "test7", "value": "test8" }, { "index": "test9", "value": "test10" } ] }, { "name": "Test Data Continued", "attributes": [ { "index": "bla", "value": "bla1" }, { "index": "bla 2", "value": "bla 4" }, { "index": "test9", "value": "test10" } ] }, { "name": "Test Spec", "attributes": [] } ] } I need to save this kind of object with one request but I am failing to do this my serializer looks like this class ProductSerializer(serializers.ModelSerializer): specifications = SpecNameSerializer(many=True, read_only=True) class Meta: model = Product fields = ['name', 'category', 'specifications'] def create(self, validated_data): return Product.objects.create(**validated_data) I searched for many answers but I did not find or applied some of them, again it did not help me. I am using just ListCreateView in … -
Select multiple options in Django
In my web app. There is a Subscription model and it has 6 subscriptions. In a single order there is two subscription selected so I want to show the selected subscriptions which are there in a order from all subscriptions in frontend. I grab all the subscriptions and the order to frontend and trying this code to select. <div class="col-sm-8"> <select class="form-control" multiple> {% for subscription in subscriptions %} <option {% for sub in order.subscriptions.all %} {% if sub == subscription.title %} selected {% endif %} {% endfor %}>{{subscription.title}}</option> {% endfor %} </select> </div> But Its not working. It showing all the subscriptions in Subscription model. But I want to selected the sub which are there in a order. Here is the frontend. -
How do you write "SELECT ... WHERE id IN (SELECT ...)" in Django?
I have trouble following the reverse related relationship in a Django query: from django.db import models class Reporter(models.Model): name = models.CharField(max_length=100) class Article(models.Model): title = models.CharField(max_length=500) reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE) "Get the reporters who wrote an article about coronavirus": SELECT * FROM myapp_reporter WHERE id IN ( SELECT reporter_id FROM myapp_article WHERE title ILIKE '%coronavirus%' ) How do I write this in Django? -
creating url shortner in django using hash
I am trying to create url shortener in django using hash (16 byte) in django. My Model : class UrlShort(models.Model): hash_url = models.CharField(max_length=100) original_url = models.CharField(max_length=100) creation_date = models.DateTimeField() expiry_date = models.DateTimeField() How will my function look if I need to store hash_url in database which is hashed from original_url with expiry_date of 30 seconds from creation_date ? -
VarsityDView is missing a QuerySet. Define VarsityDView.model, VarsityDView.queryset, or override VarsityDView.get_queryset()
My code is very simple but I'm getting error and I can't find the solution. views.py -> views.py file models.py -> models.py file -
How to import root directory file inside application in django?
My Project structure is depicted below: ├── project_name ├── app1 │ ├──views.py #I've to access root file1.py which is kept with manage.py in this file. │ ├──file1.py # But If I'm trying to import this file is being imported but I need root one │ ├──models.py ├── app2 │ ├──views.py │ ├──file1.py │ ├──models.py ├── manage.py ├── file1.py I'm using "from file1 import " in app1/views.py but the app1/file1.py is getting imported. Rather than this file I've to import project_name/file1.py file inside app1/views.py. How Can I do this? -
How to fix TypeError __str__ returned non-string
My code it still gives the error of __str__ returned non-string (type Contact) despite the fact that i cast the return statement with str() My model: class Contact(models.Model): name = models.CharField("Contact Name", max_length=50) surname = models.CharField("Contact Surname", max_length=50) company = models.ForeignKey(Customer, verbose_name='Company',on_delete=models.CASCADE) department = models.ForeignKey(Department, verbose_name='Department',on_delete=models.CASCADE) position = models.CharField("Position", max_length=50, null=True, blank=True) birthday = models.DateField("Birthday", null=True, blank=True) remarks = models.TextField("Remarks", max_length=500, null=True, blank=True) skype = models.CharField("Spype", max_length=50, null=True, blank=True) def clean(self): for field in self._meta.fields: if isinstance(field, (models.CharField, models.TextField)) and getattr(self, field.name)!=None: setattr(self, field.name, getattr(self, field.name).strip()) class Meta: verbose_name = "Contact" #####Overide save method to store names and surnames in caps def save(self, *args, **kwargs): for attr_name in ['name', 'surname', 'position']: val = getattr(self, attr_name, False) if val: setattr(self, attr_name, val.upper()) super(Contact, self).save(*args, **kwargs) def __str__(self): return self.surname + " " + self.name I also used to write the str function like this: def __str__(self): return str(self.surname + " " + self.name) but still the code returns the same error. Here is my traceback Django Version: 2.2.6 Python Version: 3.5.2 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'adminactions', 'django.contrib.admin', 'intranet', 'daterange_filter', 'gunicorn', 'notifications') Installed Middleware: ('whitenoise.middleware.WhiteNoiseMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware') Template error: In template /usr/local/lib/python3.5/dist-packages/django/contrib/admin/templates/admin/edit_inline/tabular.html, … -
autosuggest multiple search jquery
how to make autosuggests multiple value search? my view: def index(request): ... results = [] if request.is_ajax(): q = request.GET.get('term', '') if len(q) > 2: results = list(Tag.objects.filter(name__istartswith=q).values_list(Lower('name'), flat=True)) results = [f'{i} ' for i in results] return JsonResponse(results, safe=False) ... html: <div id="search"> <form method="get" action="{% url 'main:home' %}"> {% csrf_token %} <input type="text" name="q" placeholder="Поиск по сайту" value="{{ request.GET.q }}"> <input type="submit" value="Найти"> </form> </div> <script> ... $('#search input[name="q"]').autocomplete({ 'source': '{% url "main:home" %}', 'minLength': 2, 'appendTo': "#search" }); </script> this works correctly with one exception: I was offered https://jqueryui.com/autocomplete/#multiple, but I don’t understand what to do with it. I am not good at js, jq. please any help will be helpful -
Can not connect to smtp.gmail.com in Django
I'm trying to send email using smtp.gmail.com in Django project. This is my email settings. settings.py # Email Settings EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_USE_TLS = True EMAIL_PORT = 587 EMAIL_HOST_USER = 'myaccount@gmail.com' EMAIL_HOST_PASSWORD = 'mygooglepassword' views.py ... send_mail( "message title", "message content", "myaccount@gmail.com", ["myaccount@hotmail.com"], fail_silently=False) Whenever I try to send email, I get this error gaierror at /contact-us/ [Errno-2] Name or service not known I tried the followings. I set my google account's less secure app access on. I unchecked avast antivirus setting 'Setting->Protection->Core Shields->Mail Shield->Scan outbound emails(SMTP)' Tried different ports in email settings. 587 and 25 Switched the ssl and tls in email settings. But it's not sending yet. When I use 'django.core.mail.backends.console.EmailBackend' instead of 'django.core.mail.backends.smtp.EmailBackend', it prints email on console. I double checked my gmail username and password on settings. Please help me. Thank you. -
how to create new user to login from different model?
i've try to create a system for student and teachers, create new user model to login from different model , not a OneToOneField from default User model , i want to make two different registration form for visitors (Student and Teacher) forms genders_selection = ( ('male','male'), ('female','female') ) class CustomUser(AbstractUser): is_student = models.BooleanField(default=False) is_teacher = models.BooleanField(default=False) email = models.EmailField() objects = UserManager() def __str__(self): return self.username class Student(models.Model): user = models.OneToOneField(CustomUser, on_delete=models.CASCADE) gender = models.CharField(choices=genders_selection,max_length=10) age = models.PositiveIntegerField() class Teacher(models.Model): teacher = models.OneToOneField(CustomUser, on_delete=models.CASCADE) gender = models.CharField(choices=genders_selection,max_length=10) age = models.PositiveIntegerField() def __str__(self): return self.user.username but this architecture wont allow similar idea , and it will required first to create User then select one of them as student or teacher !? thanks for helping -
How to import model of of 1 project to another project in django?
I have 2 different django projects.I am trying to import model of project2 to project1, i am using same database for both the projects.How will i achieve that, here is my project structure all_pro_folder /project1_folder/ /src_project1 /app1(application) + projectfolder containing settings.py models.py, views.py etc /project2_folder/ /src_project2/ /app2(application) + projectfolder containing settings.py models.py, views.py etc I want to import src_project2's model in src_project1 just like from src_project2.app2.models import * -
local variable 'mobile' referenced before assignment
I want that when the user logged in, the data from the database should be displayed on the page. Here is the view: def login_view(request): if request.method == 'POST': mobile= mobile.objects.all() form= AuthenticationForm(data=request.POST) if form.is_valid(): user=form.get_user() login(request,user) return render(request,'pages/store.html',{'mobile':mobile}) else: form= AuthenticationForm() return render(request, 'pages/login.html', {'form':form}) The HTML page: {% load static %} <html> <head><title>store</title></head> <body> Hi {{user}} <table> <thead> <tr> <th>Model</th> <th>Price</th> </tr> </thead> <tbody> {% for item in mobile %} <tr> <td>{{ item.Model }}</td> <td>{{ item.Price }}</td> </tr> {% endfor %} </tbody> </table> </body> </html> My model consists of mobile and Price as attribute. I have tried creating a view to display the database: def display_view(request): if request.method == 'GET': mobile= mobile.objects.all() return render(request,'pages/store.html', {'mobile':mobile}) But the error showing is the same: local variable 'mobile' referenced before assignment Can anyone help me out in displaying the data to the page? I don't think the error is because I have created the signup and login forms using django built-in form. -
How to send email from my G-Suite account using Django and OAuth 2?
How to send email from my G-Suite account using Django and OAuth 2 ? I am using Django to send email but its asking me to make my account enable for less secure app. I don't want to do that, I want to use OAuth 2 in my app and send email from my G Suite account. -
Vue vs React vs Angular with Django?
I'm a Django developer planning to learn a front end framework so I could easily scale my applications.The thing that is bothering me is Which is the most simpler and easier to use framework in Vue,react and Angular that I can get started within a day,build some projects and doesn't come up with a lot of confusing things to learn about and most important is easy to integrate with Django to build large scale applications.Which one is the most appropriate in this case? -
How to access Django Docker app in a Virtual Machine?
Currently, I'm trying to access a simple Django application, which I created in an Azure Virtual Machine. As the application is still simple, I only want to access the "The install worked successfully! Congratulations!" page from my local machine by accessing http://VM_IP:PORT/. I was able to do just that, but when I tried to Dockerized the project and then trying to access it again from my local machine, it didn't work. I've already made some setup in my Azure portal so that the Virtual Machine is able to listen to specific port; in this case is 8080 (so http://VM_IP:8080/). I'm quite new in Docker so, I'm assuming there was something missing in the Dockerfile I've created for the project. Dockerfile RUN mkdir /app WORKDIR /app # Add current directory code to working directory ADD . /app/ # set default environment variables ENV PYTHONUNBUFFERED 1 ENV LANG C.UTF-8 ENV DEBIAN_FRONTEND=noninteractive # set project environment variables # grab these via Python's os.environ# these are 100% optional here ENV PORT=8080 # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ tzdata \ python3-setuptools \ python3-pip \ python3-dev \ python3-venv \ git \ && \ apt-get clean && \ rm -rf … -
Django reading data from 2 models with foreignkey and make single list
I'm new to django. I've been coding with sql but django orm is hard for me to convert my knowledge of sql to orm models. I've client model class client(models.Model): c_id = models.AutoField(primary_key=True) name= models.TextField() age=models.IntegerField() and address model class address(models.Model): c_id = models.ForeignKey(client, on_delete=models.CASCADE) addr = models.CharField(max_lenght=20) city= models.CharField(max_lenght=20) This is my table --------------------------- | c_id|Name | age | --------------------------- | 1 | John | 23 | ---------------------------- | 2 | Rose | 20 | ---------------------------- ------------------------------ | c_id|addr | city | ------------------------------ | 1 | buspark | florida| ------------------------------ | 2 | homesquare| florida| ------------------------------ how to get allclient with address in list -
Django - database query optimisation - over 100 queries per request
models.py class Category: name = ... class SubCategory: name = ... category = models.ForeignKey(Category) class Item: name = ... category = models.ForeignKey(Category) subcategory = models.ForeignKey(SubCategory) class ItemImage: item = models.ForeignKey(Item) image = ... views.py def show_all(request): categories = Category.objects.all() return render(request, 'template.html), {'categories':categories}) template.html {% for cat in categories %} <!-- cat.name --> {% for subcat in cat %} <!-- subcat.name --> {% for item in subcat.item_set.all %} <!-- item.name --> <img src="{{item.itemimage_set.first.image.url}}"> Problem: The last iteration in html for itemimage_set causes extra query for each item rendered. I've got 300 items to render on the page, then over 300 queries for each request. Not sure where to add prefetch... or this is unavoidable? Please help! -
How to Setting Up Django Static Files?
So for settings up my django static files I added these code in settings.py STATIC_URL = '/static/' STATIC_DIRS = [ os.path.join(BASE_DIR, 'static') ] STATIC_ROOT = os.path.join(BASE_DIR, 'assets') So I created A static folder In Base Directory and then I created a folder named css inside of it and I added a file named nav.css into it. <link rel="stylesheet" href="{% static 'css/nav.css' %}"> But it's not working at all. It gives me error : Failed to load resource: the server responded with a status of 404 (Not Found) What I did wrong? -
Django summernotes model customize
I am currently working on django summernotes but facing trouble in form submission. I think it is due to the model models class htmlpage(models.Model): id= models.AutoField(primary_key=True) title = models.CharField(max_length=50) content = models.CharField(max_length=2000) thumbnail = models.ImageField(upload_to='images/blog') tags = models.CharField(max_length=50) ... def __str__(self): return self.title The content Field in the model is implemented with summernotes. forms.py class FormName(forms.Form): title = forms.CharField(required=True) thumbnail = forms.ImageField(required=True) content = forms.CharField(widget=SummernoteWidget(), required=True) tags = forms.CharField(required=True) How to save data in Django in-order to separate the media files inside the summernotes. Currently all the image files are getting stored as text in Charfield. This way works fine for retrieving and displaying but having trouble in validating the form created. is_valid() is becoming false for every form submit. You can submit the form without is_valid() but image is not uploaded in database. form = forms.FormName() if request.method == "POST": form_name = FormName(data = request.POST) title = form_name["title"].data thumbnail = form_name["thumbnail"].data content = form_name["content"].data tags = form_name["tags"].data instance = htmlpage(title=title, thumbnail=thumbnail, content= content, tags=tags, by=request.user) instance.save() -
Django RestFramework Elastic Search: Timeline API
I'm using django restframework along with elastic search to develop a backend application for a mobile app. I need to develop a timeline API that will load a timeline of posts from other users the user is following. Along with other related poststhat the people they're following may comment. What is the best implementation method for this problem?