Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
I am getting a weird error in running a django application
I am trying to run this app in my pc. https://github.com/Nidhintsajee/Django-Quiz-System I have activated virtual environment but i am getting an error on runserver, don't know what's wrong. Please help. -
How to optimize query set from duplicated query
1.(0.001) SELECT COUNT(*) FROM (SELECT COUNT(DISTINCT "entities_hero"."id") AS "_hero_count", COUNT(DISTINCT "entities_villain"."id") AS "_villain_count" FROM "entities_origin" LEFT OUTER JOIN "entities_hero" ON ("entities_origin"."id" = "entities_hero"."origin_id") LEFT OUTER JOIN "entities_villain" ON ("entities_origin"."id" = "entities_villain"."origin_id") GROUP BY "entities_origin"."id") subquery; args=() 2.(0.000) SELECT COUNT(*) FROM (SELECT COUNT(DISTINCT "entities_hero"."id") AS "_hero_count", COUNT(DISTINCT "entities_villain"."id") AS "_villain_count" FROM "entities_origin" LEFT OUTER JOIN "entities_hero" ON ("entities_origin"."id" = "entities_hero"."origin_id") LEFT OUTER JOIN "entities_villain" ON ("entities_origin"."id" = "entities_villain"."origin_id") GROUP BY "entities_origin"."id") subquery; args=() (0.001) SELECT "entities_origin"."id", "entities_origin"."name", COUNT(DISTINCT "entities_hero"."id") AS "_hero_count", COUNT(DISTINCT "entities_villain"."id") AS "_villain_count" FROM "entities_origin" LEFT OUTER JOIN "entities_hero" ON ("entities_origin"."id" = "entities_hero"."origin_id") LEFT OUTER JOIN "entities_villain" ON ("entities_origin"."id" = "entities_villain"."origin_id") GROUP BY "entities_origin"."id" ORDER BY "entities_origin"."id" DESC; args=() entities/models.py from django.db import models class Category(models.Model): name = models.CharField(max_length=100) class Meta: verbose_name_plural = "Categories" def __str__(self): return self.name class Origin(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Entity(models.Model): GENDER_MALE = "Male" GENDER_FEMALE = "Female" GENDER_OTHERS = "Others/Unknown" choice = ( (GENDER_MALE, GENDER_MALE), (GENDER_FEMALE, GENDER_FEMALE), (GENDER_OTHERS, GENDER_OTHERS), ) name = models.CharField(max_length=100) alternative_name = models.CharField(max_length=100, null=True, blank=True) category = models.ForeignKey(Category, on_delete=models.CASCADE) origin = models.ForeignKey(Origin, on_delete=models.CASCADE) gender = models.CharField(max_length=100, choices=choice) description = models.TextField() def __str__(self): return self.name class Meta: abstract = True class Hero(Entity): class Meta: verbose_name_plural = "Heroes" is_immortal = … -
Wagtail : Internal server error when DEBUG = False
When change my DEBUG to False django-dashboard and wagtail-dashbard work fine but other urls give me this error page Internal server error my logs: [15/Feb/2020 06:15:45] ERROR [django.request:228] Internal Server Error: / Traceback (most recent call last): File "/home/minetuts/.venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 145, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 143, in _get_response response = response.render() File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/response.py", line 106, in render self.content = self.rendered_content File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/response.py", line 83, in rendered_content content = template.render(context, self._request) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render return self.template.render(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/base.py", line 171, in render return self._render(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/base.py", line 163, in _render return self.nodelist.render(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/loader_tags.py", line 150, in render return compiled_parent._render(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/base.py", line 163, in _render return self.nodelist.render(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/templatetags/static.py", line 106, in render url = self.url(context) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/templatetags/static.py", line 103, in url return self.handle_simple(path) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/templatetags/static.py", line 118, in handle_simple return staticfiles_storage.url(path) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 153, in url return self._url(self.stored_name, name, force) File "/home/minetuts/.venv/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 132, in _url hashed_name … -
Bootstrap4 adjacent navbar columns
Here is my code: <nav class="navbar navbar-expand-lg navbar-light bg-light" role="navigation" id="navbar"> <div class="container"> <a class="navbar-brand mynav" href="{% url 'home' %}">Star Social</a> <ul class="navbar-nav navbar-right"> {% if user.is_authenticated %} <li><a href="">Posts</a></li> <li><a href="">Groups</a></li> <li><a href="">Create Group</a></li> <li><a href="{% url 'accounts:logout' %}">Logout</a></li> {% else %} <li><a href="">Group</a></li> <li><a href="{% url 'accounts:login' %}">Login</a></li> <li><a href="{% url 'accounts:signup' %}">Signup</a></li> {% endif %} </ul> </div> </nav> I have a code like this but when I run the server, I'm getting style like this. -
Forbidden 403 You don't have permission to access this resource. (mod_wsgi, wamp, django) on windows
i have installed everything properly and gone through all solutions related to this subject but still error remains, I'm new to Django and i would really appreciate your help I get this error in my error log file: [Fri Feb 14 21:52:16.916422 2020] [authz_core:error] [pid 4288:tid 1252] [client ::1:51391] AH01630: client denied by server configuration: E:/AppSource/eCommerce/src/ecommerce/wsgi_windows.py and when i try to reach 127.0.0.1:80 i get: Forbidden 403 and this is my wsgi_windows.py configuration: activate_this = 'CE:/AppSource/eCommerce/Scripts/activate_this.py' exec(open(activate_this).read(),dict(__file__=activate_this)) import os import sys import site from django.core.wsgi import get_wsgi_application site.addsitedir("C:/Python37/Lib/site-packages") sys.path.append('E:/AppSource/eCommerce') sys.path.append('E:/AppSource/eCommerce/src') sys.path.append('E:/AppSource/eCommerce/src/ecommerce') os.environ['DJANGO_SETTINGS_MODULE'] = 'ecommerce.settings' os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ecommerce.settings") application = get_wsgi_application() and this is hhtpd-vhosts.conf configuration: <VirtualHost *:80> ServerName localhost WSGIPassAuthorization On ErrorLog "E:/appSource/eCommerce/eCommerce.error.log" CustomLog "E:/appSource/eCommerce/eCommerce.access.log" combined WSGIScriptAlias / "E:/appSource/eCommerce/src/ecommerce/wsgi_windows.py" <Directory "E:/appSource/eCommerc/src/ecommerce/"> <Files wsgi_windows.py> Require all granted </Files> </Directory> Alias /static "E:/appSource/eCommerce/static_cdn/static_root" <Directory "E:/appSource/eCommerce/static_cdn/static_root"> Require all granted </Directory> Alias /media "E:/appSource/eCommerce/static_cdn/media_root" <Directory "E:/appSource/eCommerce/static_cdn/media_root"> Require all granted </Directory> </VirtualHost> i have tried everything that i know Please help to solve this Thanks -
using python variable in django sql query
@staticmethod def getdata(backdays): cursor = connections['MMY'].cursor() query ="Select * from temp WHERE DAY_OF_MONTH=TO_CHAR(sysdate-?,'DD')" cursor.execute(query,(backdays)) rdict = namedtuplefetchall(cursor) return rdict i am getting attribute error , I can see this value is getting printed when i am using print but above is failing can any one please help . it is python . Value is being passed using axios in javascript . -
How to send emails from Gmail without turning off "allow less secure apps" setting?
Is there any way to send an email in a Django project without turning on the "allow less secure apps" feature? Is using OAuth2 a must or can I send it using Google's API? So far, I just use: EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = '587' EMAIL_HOST_USER = 'myemailaddress' EMAIL_HOST_PASSWORD = 'password' EMAIL_USE_TLS = True EMAIL_USE_SSL = False But this gives me an SMTPAuthenticationError, which only works when I turn on "allow less secure apps" in Google. Is there any way to circumvent this without using OAuth2 and allow multiple users to login to that account easily? -
django SearchFilter is displaying all the data when the search field is empty?
I have implemented search feature using django SearchFilter DRF which is perfectly working but the issue is i don't want to display all the query when i pass nothing in the search field .It is by default returning all the query.I don't know how to handle it, here is my code views.py class EventSearchView(generics.ListAPIView): permission_classes = (AllowAny,) queryset = Event.objects.all() search_fields = ["name", "description","content"] filter_backends = (filters.SearchFilter,) serializer_class = EventSearchSerializer pagination_class = LargeResultsSetPagination when i search for fields "name", "description" it is working fine but when i search nothing and hit the url without search fields by default it is returning all the query , but i want to display nothing , how will i achieve that, any help would be appreciated -
How do you call a view from a template(django)
I have an index.html that has three tabs: <div class="tab"> <button class="tablinks" onclick="openCity(event, 'London')" id="defaultOpen"$ <button class="tablinks" onclick="openCity(event, 'Paris')">Paris</button> <button class="tablinks" onclick="openCity(event, 'Tokyo')">Tokyo</button> </div> <div id="London" class='progress-wrapper'> <div id='progress-bar' class='progress-bar' style="background-color: #68a9ef$ </div> <div id="progress-bar-message">Waiting for progress to start...</div> <div id="Paris" class="tabcontent"> <span onclick="this.parentElement.style.display='none'" class="topright">&times</span> <h3>Paris</h3> <p>Paris is the capital of France.</p> </div> <div id="Tokyo" class="tabcontent"> <span onclick="this.parentElement.style.display='none'" class="topright">&times</span> <h3>Tokyo</h3> <p>Tokyo is the capital of Japan.</p> </div> <script> function openCity(evt, cityName) { var i, tabcontent, tablinks; tabcontent = document.getElementsByClassName("tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getElementsByClassName("tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } document.getElementById(cityName).style.display = "block"; evt.currentTarget.className += " active"; } // Get the element with id="defaultOpen" and click on it document.getElementById("defaultOpen").click(); </script> </body> <div class='progress-wrapper'> <div id='progress-bar' class='progress-bar' style="background-color: #68a9ef; width: 0%;">&nbsp;</div> </div> <div id="progress-bar-message">Waiting for progress to start...</div> <script src="{% static 'celery_progress/celery_progress.js' %}"></script> <script> document.addEventListener("DOMContentLoaded", function () { var progressUrl = "{% url 'celery_progress:task_status' task_id %}"; CeleryProgressBar.initProgressBar(progressUrl); }); </script> This index.html is loaded by the following in views.py: def index(request): # return HttpResponse('Hello from Python!') # okdood() something = progress_view() #pprint(something) return render(request, "index.html", something) basically what progress_view() does is it … -
Find data inside the nested ORM in Django
class Post(models.Model): POST_TYPE =( ("video","video"), ("pic","pic"), ) upload_by = models.ForeignKey(User,on_delete=models.CASCADE) caption = models.TextField() post_type = models.CharField(max_length=100,choices=POST_TYPE) media = models.FileField(upload_to='posts/') created_at = models.DateTimeField(auto_now_add=True) class PostLikes(models.Model): post = models.ForeignKey(Post,on_delete=models.CASCADE) like_by = models.ForeignKey(User,on_delete=models.CASCADE) created_at = models.DateTimeField(auto_now_add=True) This is My models.py file and i want to find that if current login user is liked the post or not like this in my templates. I'm doing this in my templates file {% if request.user in i.postlikes_set.all%} but i know it's wrong can anybody solve this problem? I want to do this in my templates <a class="post-like-btn" href="#" {% if request.user in i.postlikes_set.all%} style="color: #e16a70;" {% else %} style="color:#b2b2b2 !important;" {% endif %}> -
How to get the local API url in custom command
I want to call the local API I can access this from wget wget http://localhost:8000/api/item So the code below works get_url_info = requests.get('http://localhost:8000/api/items') print(get_url_info) However, url could be changed depending on server (ex http://localhost:8000/ -> http://localhost/ How should I access to the local API??? -
Module "django.template.context_processors" does not define a "custom_proc" attribute/class
def custom_proc(request): "A context processor that provides 'app', 'user' and 'ip_address'." return { 'app': 'My app', 'user': request.user, 'ip_address': request.META['REMOTE_ADDR'] } above code is my code. a request Context. i write this code in a file context_processors.py. and follow code is in settings.py file: 'context_processors': [ 'django.template.context_processors.custom_proc', how to use the context processor in the view.py file? return render(request,'template1.html', {'message': 'I am view 1.'})``` enter code here -
ValidationError (User:None) (Value must be one of ['U', 'L']: ['qty']) with mongodbforms when using grouped choices
I have a problem with mongodbforms which i've used for mongoengine to generate forms in django Actually i used grouped choices in forms.py from .models import * from mongodbforms import * class UserForm(DocumentForm): gch = ChoiceField(choices=Q_CHOICES, initial='Li') class Meta: document = User fields = ['name', 'email', 'age', 'is_major', 'gch'] If i use like normal choices its working. Q_CHOICES = (('N', 'Num'), ('C', 'Cnt'), ('Li', 'Lit'), ('ML', 'MiL')) This is my model class in models.py Q_CHOICES = ( ('U', (('N', 'Num'), ('C', 'Cnt')) ), ('L', (('Li', 'Lit'), ('ML', 'MiL')) ) ) class User(Document): name = StringField(max_length=50) email = StringField(required=True) is_major = BooleanField(choices=BOOL_CHOICES) age = IntField() gch = StringField(choices=Q_CHOICES) def __str__(self): return self.name What could be the problem ? -
Creating a calendar functionality
I want to create a calendar type functionality in django, where the authenticated user will click on the date of the calendar and he can then write an event or to-do. I want to know about the model making and URL routing. -
How to set the log file size limit for basic config?
In my django, i have create log by using logging.basicConfig(). The output of the log i wish to set the file size limit, after reach the file size limit, it will auto create a new log file, anyone have idea? -
Multiple forms in single forms in Django?
I wanted to build signup form for Student User Where User Can Select Multiple Branches(Model) and select Subjects inside one subject can have multiple books. all this in single form. I have been looking at the documentation and thought maybe inline-formsets would be the answer. But I am not entirely sure. How can i do this in single signup page? I hope you get my point. What I want is I have Total five models class User(AbstractUser): created_date = models.DateTimeField(auto_now_add=True) modified_date = models.DateTimeField(auto_now=True) is_student = models.BooleanField(default=False) is_teacher = models.BooleanField(default=False) class Student(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) age = models.IntField(max_length=100) dob = models.DateField(max_length=12) address = models.CharField(max_length=200) def __str__(self): if (self.user.first_name != None): return self.user.first_name else: return self.user.username class StudentBranch(BaseModel): student = models.ForeignKey(Student, on_delete=models.CASCADE) branch = models.ForeignKey(Branch, on_delete=models.CASCADE) class StudentSubject(BaseModel): student = models.ForeignKey(Student, on_delete=models.CASCADE) subject = models.ForeignKey(Subject, on_delete=models.CASCADE) class SubjectBook(BaseModel): subject_name = models.ForeignKey(StudentSubject, on_delete=models.CASCADE) book_name = models.CharField(max_length=100, blank=True) author = models.CharField(max_length=100, blank=True) publisher = models.CharField(max_length=100, blank=True) published_in = models.CharField(max_length=10, blank=True) I tried some examples with 2 models but in my case i have many models -
Accurate progress bars to load tweets from twitter
I'm trying to load tweets from the user timeline in twitter and display a progress bar while doing so. In order to use the progress bar, you have to know that amount of 'work' that needs to be done to complete the task. The problem is, the count that you specify in GetUserTimeline is not necessarily the number of tweets that is returned to the call(on account of deleted tweets and so forth the amount of tweets returned maybe less). This means that you can't calculate the number of calls that have to be made to the Twitter API to achieve your target number of retrieved tweets, without loading the tweets beforehand. Can anyone think of a solution?? -
Highcharts do not show in Django html
I am trying to show some data plot in web, the web framework is Django, I pass the json data form view to html, the json file is like below { 'my_data':[1, 2, 3, 10, 15, 18, 19] 'pointStart':1350230400 'pointInterval': 3600*1000*24 } and the html body part is below <body> <div id="container1" style="height: 400px; min-width: 310px"></div> <script> // Create a timer var start = +new Date(); // Create the chart Highcharts.stockChart('container1', { chart: { events: { load: function () { if (!window.TestController) { this.setTitle(null, { text: 'Built chart in ' + (new Date() - start) + 'ms' }); } } }, zoomType: 'x' }, rangeSelector: { buttons: [{ type: 'day', count: 3, text: '3d' }, { type: 'week', count: 1, text: '1w' }, { type: 'month', count: 1, text: '1m' }, { type: 'month', count: 6, text: '6m' }, { type: 'year', count: 1, text: '1y' }, { type: 'all', text: 'All' }], selected: 3 }, yAxis: { title: { text: 'Temperature (°C)' } }, title: { text: 'Hourly temperatures in Vik i Sogn, Norway, 2009-2017' }, subtitle: { text: 'Built chart in ...' // dummy text to reserve space for dynamic subtitle }, series: [{ name: 'Temperature', data: {{my_data}}, … -
Django Model with out auto generated id field
Model.py Image -- Migrate Query basically a "product(Rodamiento)" can have one, none or many "equivalents(Equivalente)" when i create the "equivalent" class, django auto generate an "id" field. ¿is there a way to avoid that?, i need to transfer data from another DB, that "id" field make it harder to do it im using SQLite DB and SQLiteStudio -
template rendering error and near ")": syntax error when i try to access polls app
My problem is I keep getting a weird error during template rendering error form my index.html template point at my {% if latest_question_list %} and I do not know what is triggering the ")" error in my index template except for the base.py and utils.py files. I don't know what is causing the problem and I appreciate any help as I try to step through this as well. I am have been learning Django for python and I have been trying to follow along with the tutorial. This is my first time posting on stackoverflow and I will try to show all my errors and the traceback. I tried googling the errors I get in the traceback of the code but all i get are errors related to sql migrations but I made no changes to my models. P.S: I can give more and edit if not clear or need more info. views.py from django.http import HttpResponseRedirect from django.shortcuts import render, get_object_or_404 from django.template import loader from django.urls import reverse from django.views import generic from django.utils import timezone from .models import Question, Choice class IndexView(generic.ListView): template_name = 'polls/index.html' context_object_name = 'latest_question_list' def get_queryset(self): """ Return the last five published questions.""" … -
How can I get a members list in a voice channel from my bot?
from django.shortcuts import render, redirect import discord import random from discord.ext import commands client = commands.Bot(command_prefix = '.') channel = None @client.event async def on_ready(): channel = client.get_channel(677999369642836037) async def members_list(request): curMembers = [] for member in channel.members: curMembers.append(member) return render(request, "discordTool/discordTool.html", { 'members_list': curMembers, }) client.run('my token') This is my views.py of an app that supposes to show active members in a voice channel in my django site. However this doesn't work, can anyone help me or know a discord server about discord's API? -
How to load CSS files and javascript files in Django?
When I am trying to extend the header and footer of base.html to index.html and about.html, I am unable to load CSS and javascript files. Here is my code. I have Included django.contrib.staticfiles in INSTALLED_APPS. Also, I have defined STATIC_URL setting.py INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'gadget/static') ] I am trying to extend the header and footer to index.html and about.html base.html {% load static %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link href="https://fonts.googleapis.com/css?family=Muli:300,400,500,600,700,800,900&display=swap" rel="stylesheet"> <!-- Css Styles--> <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css'%}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/font-awesome.min.css'%}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/themify-icons.css'%}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/elegant-icons.css'%}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/owl.carousel.min.css'%}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/nice-select.css'%}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/jquery-ui.min.css'%}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/slicknav.min.css'%}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/style.css'%}" /> <title>e-Gadget</title> </head> <body> <!-- Header Section Begin --> <header class="header-section"> <div class="container"> <div class="inner-header"> <div class="row"> <div class="col-lg-2 col-md-2"> <div class="logo"> <a href="./index.html"> <img src="img/logo.png" alt=""> </a> </div> </div> <div class="col-lg-7 col-md-7"> <div class="advanced-search"> <button … -
Reload table data in Django automatically
I am trying to solve an issue regarding reloading table data in Django without refreshing the page. I was experimenting with this example but I am having a difficult time to modify it to my needs. I liked the solution but I wonder if there is any other way? If not, I will need to try that approach, but it was harder than I thought to modify it. My view def test(request): data = data.objects.all().order_by('-created') context = { 'data':data } return render(request, 'app/html.html', context) My original HTML-table <table class="table table-sm table-hover table-striped" id="myTable"> <thead class="thead-dark"> <tr> <th scope="col">Column1</th> <th scope="col">Column2</th> <th scope="col">Column3</th> </tr> </thead> <tbody id="tableBody"> {% for product in data %} <tr> <td>{{ product.name }}</td> <td>{{ product.price }}</td> <td>{{ product.country }}</td> </tr> {% endfor %} </tbody> </table> Thanks in advance -
django-rest-auth redirects settings not working as expected
I am using django-rest-auth and django-allauth to handle user authentication in my rest api. The issue is the redirects are not working as expected. I expect that If the user is logged in, when I try to access the login or signup page it should redirect me to whatever the settings.LOGIN_REDIRECT_URL is. What actually happens is, the user does not get redirected I also expect, that when clicking the link to verify the email, when it validates, the website should redirect to a success page as specified in the settings.py as ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = "api/authsuccess" What actually happens is, the user the specified redirect link gets added to the end of the confirmation link as http://127.0.0.1:8000/api/signup/account-confirm-email/MTA:1j2lIk:T9uOHxOu395ZVvCDt41ylFnysIw/api/authsuccess. the api/authsuccess gets added to the end of the link which is not a behavior I expect. below are the major settings in my app OLD_PASSWORD_FIELD_ENABLED = True ACCOUNT_LOGOUT_ON_PASSWORD_CHANGE = False LOGOUT_ON_PASSWORD_CHANGE = False ACCOUNT_USER_MODEL_USERNAME_FIELD = None ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_USERNAME_REQUIRED = False ACCOUNT_AUTHENTICATION_METHOD = 'email' ACCOUNT_USER_EMAIL_FIELD = 'email' ACCOUNT_UNIQUE_EMAIL = True ACCOUNT_SESSION_REMEMBER = True ACCOUNT_LOGOUT_ON_GET = True ACCOUNT_EMAIL_VERIFICATION = "mandatory" ACCOUNT_CONFIRM_EMAIL_ON_GET = True ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS =True LOGIN_REDIRECT_URL = "api/user" ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = "api/authsuccess" ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2 ACCOUNT_EMAIL_CONFIRMATION_HMAC =True ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5 ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = … -
Margin left, right etc. not working for individual select options in bootstrap select
I have a bootstrap select field, with some options disabled, I would like to move all the disabled options to the left end except for the "Select" option. this is my html code: <div class="form-group"> <label class="col-md-6">VType</label> <select class="selectpicker col-md-6" name="veh" id="veh" onchange="hideShow()" required> <option value="" disabled selected>Select</option> <option disabled id="sl">SL</option> <option id="ve2" value="A">A</option> <option id="ve3" value="B">B</option> <option id="ve4" value="C"> C </option> <option id="ve5" value="D">D</option> <option id="ve6" value="E"> E </option> <option id="ve7" value="F">F</option> <option disabled id="ll"><b>LL</b></option> <option id="ve8" value="G">G</option> <option id="ve9" value="H">H</option> <option id="ve10" value="I">I</option> <option id="ve11" value="J">J</option> <option id="ve12" value="K">K</option> <option disabled id="tat"><b>TAT</b></option> <option id="ve13" value="L">L</option> <option id="ve14" value="M">M</option> <option id="ve15" value="N">N</option> <option disabled id="BS"><b>BS</b></option> <option id="ve16" value="O">O</option> <option id="ve17" value="P">P</option> <option id="ve18" value="Q">Q</option> <option disabled id="sut"><b>SUT</b></option> <option id="ve19" value="R">R</option> <option disabled id="ct"><b>CT</b></option> <option id="ve20" value="S">S</option> <option id="ve21" value="T">T</option> </select> </div> This is my CSS #sl{ margin-left: -10%; } I've also tried with the select id and option id as follows: #veh #sl{ margin-left: -10%; } How do I make this possible?