Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to implement SSO for our solution on Django/Vue.js?
We have a client/server app on Django + VueJS. Backend: Django (user models), django-rest-framework (api), django-oauth-toolkit (authorization, get access tokens). Frontend: VueJS How it works: Create a new oauth application in django admin panel. Copy the CLIENT_ID and SECRET_ID to a client application on Vue.js and use these credentials to get access token (login) and make other requests to get a data. Now I want to implement a SSO technology becuase we will have few HTML/JS clients for our Django API and they will be located on different domains. So I want to log in at domain1.com and when I go to domain2.com I need to login in automatically. The same for logout. What kind of work should I to do? What I'll need to rewrite? What about overall schema for SSO in current implementation? Thank you! -
django {% url %} NoReverseMatch at /
my urls.py from django.urls import path,include,re_path from . import views urlpatterns = [ path('', views.index,name='index'), re_path(r'(?P<title> [\w]+)/$',views.article_details,name='details')] my views.py def article_details(request,title): return render(request, 'guestbook/article_detail.html') my html: <html lang="en"> <head> <meta charset="UTF-8"> <h1><a href="{% url 'details' %}" > hello</h1> <title>Title</title> </head> <body> </body> </html> the error is NoReverseMatch at /guestbook/hello/ Error during template rendering Reverse for 'details' with no arguments not found. 1 pattern(s) tried: ['guestbook\/(?P[\w]+)/$'] What am I doing wrong here ? I can't seem to figure that out..please help -
Make a user profile accessible to current user ONLY
So I wanna make a page where the user can see some details of them. No one else can see this page. The url would be path('accounts/perfil/<int:pk>', views.Perfil.as_view()), So I need to check if the logged in user is the same as in the url. How can I do this with a class based view? -
Django 1.10 - Issue passing value from Template to View
I am having an issue when it cmoes to passing variables from templates to views. Even though I am able to pass variables from view to template, I canot seem to get it right. Template Below is my test HTML template where I am requesting input from the user. <div style="text-align:center;" <form method="POST" action="/details"> <input type="text" name="textfield"> <button type="submit">Enter tact time</button> </form> </div> View Below is my views.py script where I am trying to print the data entered by the user. def details(request): if request.method == 'POST': var = request.POST.get('textfield',None) print(var) print(var) yields no output. Why am I unable to pass a variable from template to view? -
How to write code such that only one of the radio button should be selected in models with django.?
#models.py from django.db import models from django.contrib.auth.models import User CHOICES = (('1','Earned Leave'),('2','Casual Leave'),('3','Sick Leave'),('4','Paid Leave')) class Leave(models.Model): employee_ID = models.CharField(max_length = 20) name = models.CharField(max_length = 50) user = models.ForeignKey(User, on_delete = models.CASCADE, null =True) department = models.CharField(max_length = 50) designation = models.CharField(max_length = 50) type_of_leave = models.CharField(max_length = 15, choices = CHOICES) from_date = models.DateField(help_text = 'mm/dd/yy') to_date = models.DateField(help_text = 'mm/dd/yy') reporting_manager = models.CharField(max_length = 50, default = None, help_text = '0001_manager, 0002_manager') reason = models.CharField(max_length= 180) accepted = models.BooleanField(('accept'), default= False) rejected = models.BooleanField(('reject'), default = False) if rejected == True: reason_reject = models.CharField(('reason for rejection'),max_length=50) // this didn't help me. def __str__(self): return self.name This is a leave request form, where only of the two fields (accepted, rejected) should be selected and if the field rejected field is not selected then the reason_reject should not be shown in the /admin panel. I've tried, putting the below code in the admin.ModelAdmin class in admin.py def reject_reason_field(self, request): if request.user.is_staff: readonly_fields = [f.name for f in self.opts.fields] if models.Leave.rejected == True: return readonly_fields[12] Where there are total 12 fields in models.py, where the 12th field is what I wanted to display upon rejected == True in the … -
How can i create a registration form in django which sent mail also
I am creating a registration form in Django which have first_name, last_name, email, password field. after registration, all the details stored in DB and meantime receive email all the details. I didn't understand how to execute this -
ImageField : how to handle the image file in django
django version: 2.08 MEDIA_ROOT in the settings files ImageField in the class Product when I add the product to database, the directory products is auto made by django, but it is under myshop directory, not under the media directory. when I use the python shell to read the product.image.url, it shows /media/products/2018/08/22/green_tea.jpg the green_tea.jpg stays in the products/2018/08/22/green_tea.jpg and in the templates file, I use the following code to get the image path: after that, I get the final result, the images can't be showed in the webpage. I can't figure it out. Could you give me some advice? Thank you very much in advance. Please read the image here -
Django rest framework views organization using generics
Taking my first steps in django here, building a simple crud api where i have two entities: device and property. my project urls.py looks like this: from django.contrib import admin from django.urls import include, path from devices.views import index urlpatterns = [ path('', index, name='index'), path('admin/', admin.site.urls), path('api/', include('devices.urls')), ] and my app urls.py as follows: from django.urls import path from . import views urlpatterns = [ path('device/create/', views.DeviceCreate.as_view()), path('device/update/<int:pk>/', views.DeviceUpdate.as_view()), path('device/delete/<int:pk>/', views.DeviceDelete.as_view()), path('device/', views.DeviceList.as_view()), path('device/<int:pk>/', views.DeviceDetail.as_view()), path('property/create/', views.PropertyCreate.as_view()), path('property/update/<int:pk>/', views.PropertyUpdate.as_view()), path('property/delete/<int:pk>/', views.PropertyDelete.as_view()), path('property/', views.PropertyList.as_view()), path('property/<int:pk>/', views.PropertyDetail.as_view()), ] which is somewhat repetitive but ok, the real problem is my views file is far more repetitive: from rest_framework import generics from .models import Device, Property from .serializers import DeviceSerializer, PropertySerializer from django.shortcuts import render def index(request): return render(request, 'index.html') class DeviceCreate(generics.CreateAPIView): queryset = Device.objects.all() serializer_class = DeviceSerializer class DeviceList(generics.ListAPIView): queryset = Device.objects.all() serializer_class = DeviceSerializer class DeviceUpdate(generics.UpdateAPIView): queryset = Device.objects.all() serializer_class = DeviceSerializer class DeviceDelete(generics.DestroyAPIView): queryset = Device.objects.all() serializer_class = DeviceSerializer class DeviceDetail(generics.RetrieveUpdateDestroyAPIView): queryset = Device.objects.all() serializer_class = DeviceSerializer class PropertyCreate(generics.CreateAPIView): queryset = Property.objects.all() serializer_class = PropertySerializer class PropertyList(generics.ListAPIView): queryset = Property.objects.all() serializer_class = PropertySerializer class PropertyUpdate(generics.UpdateAPIView): queryset = Property.objects.all() serializer_class = PropertySerializer class PropertyDelete(generics.DestroyAPIView): queryset = Property.objects.all() serializer_class = PropertySerializer … -
The average of the field values when creating the object of the model
How to calculate and add to field average of the field values when creating the object of the model example model: class Metrics(models.Model): user = models.ForeignKey(User, on_delete='', default='', null=True) upload_date = models.DateField(auto_now_add=True) city = models.CharField(max_length=200) agent_login = models.CharField(max_length=200) call_eq = models.IntegerField(null=True) zakaz_1 = models.IntegerField(null=True) otkaz_1 = models.IntegerField(null=True) zakaz_2 = models.IntegerField(null=True) otkaz_2 = models.IntegerField(null=True) zakaz_3 = models.IntegerField(null=True) otkaz_3 = models.IntegerField(null=True) zakaz_4 = models.IntegerField(null=True) otkaz_4 = models.IntegerField(null=True) zakaz_5 = models.IntegerField(null=True) total = models.IntegerField(null=True) in "total" need to calculate average value. How do it? -
Django API not uploading large json data from Android OkkHttp Client
I am trying to upload a large json data from android retrofit client to django rest api view. For example(Json Data): {'post_data': [{'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'}, {'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'}, {'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'}, . . . . {'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'}, {'x':'asdkdadlf fdsfsd','y':'This is a paragraph........ Ending paragraph', 'created_on':'2018-22-08'}, ]} API Response output: 08-22 13:21:12.964 15628-16104/com.mml.wapp D/Abhay: Group type: 1 group name: REAL ESTATE PROPERTYfrom:+234 818 230 9054 08-22 13:21:12.995 15628-16104/com.mml.wapp D/Abhay: Total messages in db before adding current message: 100 08-22 13:21:13.062 15628-16104/com.mml.wapp D/deleteMessage: Deleted all messages 08-22 13:21:13.200 15628-16109/com.mml.wapp D/OkHttp: --> POST https://api.multiplymyleads.com/api/upload_whatsapp_msgs/ http/1.1 Content-Type: application/x-www-form-urlencoded 08-22 13:21:13.204 15628-16109/com.mml.wapp D/OkHttp: Content-Length: 73304 08-22 13:21:13.211 15628-16109/com.mml.wapp D/OkHttp: postdata=%7B%22%E2%80%AA%2B234%20818%20230%209054%E2%80%AC%22%3A%5B%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A42%3A55.0%22%2C%22group_name%22%3A%22REAL%20ESTATE%20PROPERTY%22%2C%22msg%22%3A%22FOR%20SALE%20%40%20ORAL%20ESTATE%3A%20A%20plot%20of%20land%20corner%20piece%2C%20PRICE%2045m%2C%20title%20Lag%20Gazette%22%7D%2C%7om%5Cn%3C%20Master%20Bedroom%20and%20Madams%20Bedroom%20conveniently%20classified%5Cn%3C%20Tight%20Security%20within%20estate%20and%20surrounding%5Cn%3C%20Perimeter%20Fence%20wall%20incorporating%20Electric%20Security%20%5C%2FAnti%20Burglar%20wires%20around%20estate%5Cn%3C%2024hrs%20hours%20electricity%20supply%5Cn%5CnPrice%20%23250%20net%5C%2Funit%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A48%3A09.0%22%2C%22group_name%22%3A%22REAL%20ESTATE%20PROPERTY%22%2C%22msg%22%3A%22FOR%20SALE%20IN%20IKOYI%20_%5Cn%5Cn5%2C106%20sqm%20with%20Fed%20C%20of%20O%20water%20front%20parcel%20of%20land%20directly%20on %20Queen%20drive%20Ikoyi%20is%20offered%20for%20sale%20at%20%23450k%5C%2Fsqm%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A48%3A58.0%22%2C%22group_name%22%3A%22REAL%20ESTATE%20PROPERTY%22%2C%22msg%22%3A%22TO%20LET%20%40%20VICTORIA%20ISLAND%3B%203BEDROOM%20FLAT%20WITH%20A%20LOCK%20UP%20GARAGE%20AND%20BQ%20OFF%20ADEOLA%20ODEKU%20STR%20.%20PRICE%204M.%20NB%3A%20GOOD%20FOR%20RESIDENTIAL%20AND%20OFFICE%20USE.%20DIRECT%20INSTRUCTION%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A49%3A44.0%22%2C%22group_name%22%3A%22REAL%20ESTATE%20PROPERTY%22%2C%22msg%22%3A%22FOR%20SALE%20%40%20VICTORIA%20ISLAND%3A%202000sqm%20on%20Akin%20Adesola%20str%20Victoria%20island%2C%20PRICE%201bN%2C%20Title%20C%20of%20O%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A50%3A29.0%22%2C%22group_name%22%3A%22REAL%20ESTATE%20PROPERTY%22%2C%22msg%22%3A%22FOR%20SALE%20%40%20VICTORIA%20ISLAND%3A%20Two%20detached%20houses%2C%204bedroom%20each%20on%20a%20total%20land%20size%20of%204%2C000sqm%20on%20Adeleke%20Adedoyin%20str%20Victoria%20island%2C%20PRICE%20800m%20%2C%20Title%20C%20of%20O%22%7D%5D%2C%22%E2%80%AA%2B91%2098159%2015495%E2%80%AC%22%3A%5B%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A39%3A32.0%22%2C%22group_name%22%3A%22Krishna%20Real%20Estate%202%22%2C%22msg%22%3A%22Available%20500%20gaz%20plot%20in%20Sector%2088-89%20Mohali%20%5CnMaster%20Associates%20%5Cn9815915495%22%7D%5D%2C%22%E2%80%AA%2B91%2090599%2096968%E2%80%AC%22%3A%5B%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A38%3A45.0%22%2C%22group_name%22%3A%22Property%20Representatives%22%2C%22msg%22%3A%22Urjently%20required%20plots%20in%20Spring%20valley%20%2C%20Rolling%20Meadows%2C%20Shilpa%20layout%20in%20Kondapur...contact%20in%20PW%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A38%3A55.0%22%2C%22group_name%22%3A%22Real%20Estate%20Info%22%2C%22msg%22%3A%22Urjently%20required%20plots%20in%20Spring%20valley%20%2C%20Rolling%20Meadows%2C%20Shilpa%20layout%20in%20Kondapur...contact%20in%20PW%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A39%3A06.0%22%2C%22group_name%22%3A%22Hyderabad%20Home%20loans%22%2C%22msg%22%3A%22Urjently%20required%20plots%20in%20Spring%20valley%20%2C%20Rolling%20Meadows%2C%20Shilpa%20layout%20in%20Kondapur...contact%20in%20PW%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A39%3A28.0%22%2C%22group_name%22%3A%22Real%20estate%20mediators%22%2C%22msg%22%3A%22Urjently%20required%20plots%20in%20Spring%20valley%20%2C%20Rolling%20Meadows%2C%20Shilpa%20layout%20in%20Kondapur...contact%20in%20PW%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A39%3A35.0%22%2C%22group_name%22%3A%22Fortune9estates%22%2C%22msg%22%3A%22Urjently%20required%20plots%20in%20Spring%20valley%20%2C%20Rolling%20Meadows%2C%20Shilpa%20layout%20in%20Kondapur...contact%20in%20PW%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A39%3A38.0%22%2C%22group_name%22%3A%22Deccan%20Property%20Group%22%2C%22msg%22%3A%22Waiting%20for%20this%20message.%20This%20may%20take%20a%20while.%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A39%3A46.0%22%2C%22group_name%22%3A%22REAL%20ESTATE%20PROFESSIONALS%22%2C%22msg%22%3A%22Urjently%20required%20plots%20in%20Spring%20valley%20%2C%20Rolling%20Meadows%2C%20Shilpa%20layout%20in%20Kondapur...contact%20in%20PW%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A39%3A47.0%22%2C%22group_name%22%3A%22Deccan%20Property%20Group%22%2C%22msg%22%3A%22Urjently%20required%20plots%20in%20Spring%20valley%20%2C%20Rolling%20Meadows%2C%20Shilpa%20layout%20in%20Kondapur...contact%20in%20PW%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A40%3A11.0%22%2C%22group_name%22%3A%22Hyderabad%20REAL%20AGENTS%22%2C%22msg%22%3A%22Urjently%20required%20plots%20in%20Spring%20valley%20%2C%20Rolling%20Meadows%2C%20 Shilpa%20layout%20in%20Kondapur...contact%20in%20PW%22%7D%5D%2C%22%E2%80%AA%2B91%2096180%2045852%E2%80%AC%22%3A%5B%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A40%3A45.0%22%2C%22group_name%22%3A%22HIND%20REAL%20ESTATE%205%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A40%3A48.0%22%2C%22group_name%22%3A%22Rented%20prop%20for%20sale%20ADDA%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A40%3A50.0%22%2C%22group_name%22%3A%22Ram%20golkonda%20direct%20leads%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A40%3A52.0%22%2C%22group_name%22%3A%223.%20Re-guru.in%20consultants%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20 08-22 13:21:13.212 15628-16109/com.mml.wapp D/OkHttp: %20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A03.0%22%2C%22group_name%22%3A%22Meraj%20Bhai%20realtor%20group%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A08.0%22%2C%22group_name%22%3A%22RealEstate%20Pr%F0%9F%8C%8Dfessi%F0%9F%8C%8Fnals%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A14.0%22%2C%22group_name%22%3A%22Hyderabad%20Realestate%20%F0%9F%8F%AB%F0%9F%8F%A8%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20a ny%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A16.0%22%2C%22group_name%22%3A%22AP%20and%20TS%20Real%20Estate%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A27.0%22%2C%22group_name%22%3A%22Maheshwaram%20real%20Estate%20a%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A33.0%22%2C%22group_name%22%3A%22Real%20Estate%20Hitech%20city%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20 can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A39.0%22%2C%22group_name%22%3A%22Only%20Adibhatla%20RealEstate%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A49.0%22%2C%22group_name%22%3A%22VIJAYWADA%20HIGHWAYPROPERTY%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A51.0%22%2C%22group_name%22%3A%22KOTHUR%20MANDAL%20ONLY%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntres t%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A41%3A58.0%22%2C%22group_name%22%3A%22Karimnagar%20real%20estate%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A42%3A10.0%22%2C%22group_name%22%3A%22%F0%9F%92%B6%F0%9F%92%B5A%5EZ%20REAL%20ZONE%F0%9F%92%B7%F0%9F%92%B5%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A42%3A33.0%22%2C%22group_name%22%3A%22CITY%20DEVELOPMENT%20SITES%22%2C%22msg%22%3A%221%29%20Location%20in%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9F%91%89100%25%20sitting%20%5CnJenun%20Buyer%20%5CnIntrest%20off%20letar%20%26%20profile%20%5Cn%20%5CnNext%203%20days%20offter%20%20meeting%20owner%20to%20Buyer%22%7D%2C%7B%22group_type%22%3A%221%22%2C%22time%22%3A%222018-08-22%2007%3A42%3A36.0%22%2C%22group_name%22%3A%22BOMBAY%20HIGHWAY%20PROPERTIES%22%2C%22msg%22%3A%221%29%20Location%20i 08-22 13:21:13.213 15628-16109/com.mml.wapp D/OkHttp: n%20Bangalore%20%5Cn%20%20%20%20Manytha%20tek%20park%2Cembassy%20group%2C11acres%20Bangalore%20%5Cn2%29%201600cr%20is%20negotiable%20or%20not%20%5Cn%20%20%20%20%20Slightly%20negotiable%20%20%5Cn3%29%20In%20this%201600cr%20with%20media%20or%20without%5Cn%20%20%20With%20media%20%20%5Cn4%29%20Is%20there%20any%20loan%20be%20paid%20%5Cn%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn5%29%20How%20many%20Directors%20in%5Cn%20involved%20in%20this%20IT%20park%20property%5Cn%20This%20is%20one%20company%20property%20%20%5Cn6%29%20Seller%20owner%20how%20is%20wants%20the%20money%20means%20black%20or%20white%20%5Cn%20%20We%20can%20talk%20in%20face%20to%20face%20%5Cn7%29%20Tell%20us%20what%20r%20the%20companys%20in%20IT%20Park%5Cn%20%20%20%20%20%20%20That%20one%20i%20have%20to%20ask%5Cn8%29%20age%20of%20the%20building...%20year%20of%20cunstruction%5Cn%20Apeox%208%20yer%5Cn%5Cn%E2%98%9D%F0%9 As far as I understand , Data in above response seems huge, may be that's why its getting timeout error as its not able to upload all data in one API call in given timeout time in server side. What can we do to resolve above issue ? (Please read POST Script for more detail below) PS: It was … -
Executing a function rendered using python-django
I am working with django-allauth for Google authentication implementation. I have successfully implemented it. In my current implementation, the form is rendered using django and I have implemented the URL for Google login as follows: <a href="{% provider_login_url 'google' action='reauthenticate'%}">Login uisng Google</a> If I want my browser to execute the provider_login_url automatically on window load using JavaScript, how can I do so? I want to know how to execute such python functions using javascript. -
Docker image on Django app with Postgres returns django.db.utils.OperationalError
I wanted to create a Docker image for my Django project mysite that has two apps tracks and users. I used docker build -t mysite to build my docker image. I have written a Dockerfile like it says on dockerhub. Then i created docker-compose.yml file and bash script entypoint.sh that I use in docker-compose file. These are my files: Dockerfile: FROM django:onbuild COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh docker-compose.yml: version: '3' services: db: image: postgres container_name: postgres_container environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - POSTGRES_DB=postgres ports: - 5432:5432 web: image: mysite:latest build: context: . dockerfile: Dockerfile container_name: mysite_container ports: - "8000:8000" depends_on: - db entrypoint: /entrypoint.sh entrypoint.sh #!/bin/sh python manage.py makemigrations python manage.py migrate python manage.py runserver 0.0.0.0:8000 exec "$@" So when I wanted to start the whole container I used following commands docker build . docker-compose build docker-compose up And my postgres_containter starts successfully, but mysite_container throws the following error: mysite_container | Traceback (most recent call last): mysite_container | File "manage.py", line 22, in <module> mysite_container | execute_from_command_line(sys.argv) mysite_container | File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line mysite_container | utility.execute() mysite_container | File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 365, in execute mysite_container | self.fetch_command(subcommand).run_from_argv(self.argv) mysite_container | File "/usr/local/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv mysite_container … -
django default date to be in format %d-%m-%Y
I want default date but in '%d-%m-%Y' format. models.py date = models.DateField(default=datetime.date.today) what i have tried forms.py date = forms.DateField(input_formats='%d-%m-%Y') Trying the above is giving any default date in the form. -
Wagtail API - how to expose snippets
Imagine I have a Snippet and a Page containing it: @register_snippet class MySnippet(models.Model): content = models.CharField(max_length=255) class MyPage(Page): snippet = models.ForeignKey('MySnippet', null=True, blank=True, on_delete=models.SET_NULL, related_name='+') api_fields = [ APIFiled('snippet') ] Now in the wagtail API page endpoint this page will look like this: { "id": 1, "meta": { ... }, "snippet": { "id": 1, "meta": { "type": "my_module.MySnippet" } } } What can I do to make this endpoint displaying snippet's content? Also, how do I create a separate API endpoint only for snippets? -
Deploying Huge ML Models
I am trying to deploy couple of RF Classification Model in Ubuntu 16.04 using Django framework and Gunicorn+Nginx. There around 5-6 models each around 800MB-1.2GB pickled size. But my development machine has only 8GB of RAM and I am not able to run other dependent services due to Out of Memory error. I have to load these models at startup since unpickling would take time and it has to be a synchronous call with a acceptable response time(within 30 sec). I had a look a Django FileSystem Cache but I am not sure if that would help(suspect it to be also pickling and loading). I would need suggestion of how to deploy such models in Dev machines in optimized manner. -
docker exec sees changes in local files
I am playing with django project in docker and reality of the situation contradicts my limited understanding: after I change file tests.py and run docker exec {my_container} python manage.py test it knows these local changes that I've made (for example I can write new test and it will run). But I thought that docker containers are isolated and I need to recreate or at least copy updated file to one in order to update state of files. I read docker exec doc but found no info about its ability to update files in container. So, what do I need to know in order to understand what is happening? -
Django bad request (400) with DEBUG = True
I have the issue Bad request (400) on my site. However, I set ALLOWED_HOSTS = ['127.0.0.1'] and DEBUG = True. I don't understand why it returns a bad request... Can you help me please ? -
Serializing related fields in DRF
I have two models, a parent model and a child model, that I want to exist on separate tables in the database but represent them on the same object (flat) when I return to the client. I've tried a few options with this including SerializerMethodFields (SMF) and ReadOnlyFields but they both result in too many db queries. I've also tried nesting the object and then flattening it later which does work, but results in a lot more code due to the way Django's serializers work. It left me feeling that there should be a better way to accomplish this. Here's an example of a call to the serializer using the SMF approach: # in the view class ListFoo(APIView): def get(self, request): foo = Foo.objects.prefetch_related('bar').all() serializer = FooSerializer(foo, may=True) Response(serializer.data, status=status.HTTP_200_OK) # in the serializer class FooSerializer(ModelSerializer): employer = SerializerMethodField() position = SerializerMethodField() class Meta: model = Foo fields('id', 'name', 'employer', 'position') def get_employer(self, foo): # use related manager to access related object return foo.bar.employer def get_position(self, foo): # use related manager to access related object return foo.bar.position Now that code above works but if I'm querying many Foo objects, it will query +1 bar each attribute I need to access … -
Handling race condition in Google Sheets
I am using gspread library to access and edit google sheets via python. Is there a good way to handle race conditions ( not necessarily using gspread only ) when there may be multiple workers writing to the same sheet. I use a Django server which will accept requests to edit or update the sheet, in case multiple requests come, can I use some locking mechanism so that I have only one worker accessing the sheet at a time, while other will keep waiting to acquire the lock and get the access when the previous workers are done editing the sheet. -
Password_reset_email template rendering issue
I'm overriding the password_reset_email template. I"m getting an email with the new template with the parameter rendering. My problem is that the html tags are not rendered (I"m seeing and in the email) What can cause such an issue? I'm using Django 1.6 Thank you -
Configuring Celery on SourceLair
AIM I have a Django project on a Cloud IDE (SourceLair). Following a guide, I am attempting to config Celery as part of my app. CODE settings.py CELERY_BROKER_URL = 'amqp://localhost' ERROR [2018-08-22 16:03:43,059: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused. Trying again in 2.00 seconds... -
Django "Column 'email_id' cannot be null"
"Column 'email_id' cannot be null" This is the error I am getting when I try to fill the form when a user is logged in form will be accessible only to logged in users to update their day to day work. This is the model: class User(AbstractBaseUser): sys_id = models.AutoField(primary_key=True, blank=True) email = models.EmailField( verbose_name='email address', max_length=255, unique=True, ) first_name = models.CharField(max_length=50,blank=True,null=True) last_name = models.CharField(max_length=50,blank=True,null=True) address = models.TextField(max_length=300,blank=True,null=True) DOB = models.DateField('Date of Birth', blank=True, null=True) DOJ = models.DateTimeField(auto_now=True) active = models.BooleanField(default=True) staff = models.BooleanField(default=False) admin = models.BooleanField(default=False) class services(models.Model): taskid = models.AutoField(primary_key=True, blank=True) client = models.CharField(max_length=50,blank=True,null=True) project = models.CharField(max_length=50,blank=True,null=True) taskTime = models.DateTimeField('Task Time', blank=True, null=True) hours = models.TimeField(blank=True, null=True) minutes = models.TimeField(blank=True, null=True) Description = models.TextField(max_length=300,blank=True,null=True) email = models.OneToOneField(User, on_delete=models.CASCADE) This is Form: class ServiceForm(forms.ModelForm): class Meta: model = services fields = ('client','project','taskTime','hours','minutes','Description') This is View: @login_required def service(request): if request.method == 'POST': user_form = ServiceForm(data=request.POST) if user_form.is_valid(): user_form.email = request.user.email user_form.save() else: print(user_form.errors) else: user_form = ServiceForm() return render(request, 'service.html', { 'user_form':user_form}) My main Problem is that user login and tries to create a service or his work details user id should automatically be assigned to the service model. Pls help me to solve this problem. -
Django Import/Export in a table where foreign key is a string - constantly throws an error Column 'system': invalid literal for int() with base 10
I have explored a lot of examples django export/import. When I try importing in a table with foreign key with datatype string, I get this error - " invalid literal for int() with base 10", which I understand because the foreign key field has datatype 'int'. But for that before importing, do I have to edit the column in my csv with 'int' id values of the column being looked up for translating the foreign key value.Please share any working examples, I want to use a column of datatype string as foreign key and not the integer. -
blob files on sqllite using django
I asked a queston in in this link about how to store xml files and they said for small files you better use blob. how can I make models in django with blob in sqlite? I search django model fiels and just there was filefield that i guess it does not save the files in database and it just save on storage how can i store blob files in django with sqlite? can sqllite store blob files? -
How can I get all the vouchers
There is a need that when a user click "all my voucher",he want to get all the voucher he has. However, I can only find link between voucher and user in table 'basket ' and table 'voucher application'.And voucher application is for vouchers in an order,basket if for voucher in a basket. I just want to easily get all the vouchers but 'voucher' table doesn't link to 'login user' table, how to solve it ???