Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Deleting custom Django permission
I'm new to Django. In attempting to upgrade the Python version of a Django app (from 2.7 to 3.7), I'm coming across the following error (on 3.7) when running ./manage.py migrate: (venv_3_7) MacBook-Pro-3:myapp brian$ ./manage.py migrate SystemCheckError: System check identified some issues: ERRORS: myapp.People: (auth.E005) The permission codenamed 'view_people' clashes with a builtin permission for model 'myapp.People'. This is due to a custom migration that explicitly creates a view_people permission, just as the error message indicates. The good people on Stackoverflow and other sites recommend removal or renaming of this permission. I've tried everything from dumping the database, renaming the permissions in the SQL dump file, and re-importing the data; to creating a migration and removing the offending custom permission--but of course this doesn't work, due to the error above. Where do these things live? All the tables in my database that have 'permission' in the table name are empty, and the problem persists. -
Check if all objects belong to a list django
Template {% for level in levels %} {% if level.todo_set.all in tasks %} <li> <a href="javascript:;"><img src="{{ level.badge.url }}" alt="" /></a> </li> {% else %} <li> <a href="javascript:;"><img src="{{ level.locked_badge.url }}" alt="" /></a> </li> {% endif %} {% endfor %} views.py: @login_required(login_url='/account/login/') def StudentPublicProfile(request,pk=None): student = User.objects.get(pk=pk) levels = Level.objects.all() todos=ToDo.objects.all() list=[] tasks=Task.objects.filter(student=student) for task in tasks: list.append(task.todo) context={ 'student': student, 'levels' : levels, 'tasks' : list, 'todos' : todos, } return render(request, 'student_public_profile2.html', context) Basically each level contains multiple todos.I want to check if all todos of the level are contained in the tasks list .This is what im doing in the template.But im not getting a correct result.What could be the issue here? -
Is there a way to share local PostgreSQL between computers?
I recently started working on some project with my friends. I'm working on backend with Django, and others do frontend. As they have no knowledge about Django, I was wondering if I can add the db file into the project folder, so that they can use the local db by just pulling the db file from Github repository. When I used to use sqlite3, I could do this simply having the sqlite3.db file in my project folder. However, PostgreSQL has me use its program to create database, I'm confused how I can get the db file. Is it possible to have a local PostgreSQL db file in my Django project so that my friends use the db by just cloning the project and installing PostgreSQL in their computers? Just so you know, I created my Django project with cookiecutter-django. -
Django testing: reuse `setUp` for multiple classes/files?
I have a growing set of classes used for testing. However, almost all of them use the same test scenario. To avoid duplication, I have created a superclass class CommonScenario(TestCase): def setUp(self): create_products create_customers ... class Test1(CommonScenario): class Test2(CommonScenario): Although this avoids code duplication, the superclass setUp method is called multiple times, creating and destroying the exact same rows. Is there any way to avoid that? -
Django: Initial in my CharField in a modelform is not working
I am trying to add a field in a form that has an initial value of '-' so that unless it is changed, that is passed to the form. I use this form in a formset. forms.py class ClinicallyReportedVariantForm(forms.ModelForm): report_germline = forms.CharField( label='Germline:', initial='-', ) class Meta: model = ClinicallyReportedVariant fields = ( 'id', 'report', 'report_annotation', 'report_evidence', 'report_germline', ) views: formset = modelformset_factory( ClinicallyReportedVariant, form=self.crvform, formset=BaseCRVFormSet, extra=0, ) self.formset = formset(queryset=crv_obj) for form in self.formset: print(form) The output for this field is: <label for="id_form-0-report_germline"> Germline:</label> </th><td><input type="text" name="form-0-report_germline" id="id_form-0-report_germline" /> why is value='-' not in field? -
Django: BASE_DIR not correct after the os.path.join(...) command
I am getting the following behavior in Django: BASE_DIR seems to change when I use the "os.path.join(...)" command on it. My settings.py file: BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) In the Python Shell: >>> import os >>> from django.conf import settings >>> base_dir = settings.BASE_DIR ***'C:\\Users\\gille\\timeless_wisdom'*** >>> file_path = os.path.join(base_dir, '/timeless_wisdom/UserData') ***'C:/timeless_wisdom/UserData'*** So: when I join a relative path with BASE_DIR, I don't get the expected result, but he starts from C:/ again... I have tried the following, but same result.: file_path = os.path.join(base_dir, '\\timeless_wisdom\\UserData') I have tried using PROJECT_ROOT instead of BASE_DIR, but same result. Anything I am missing? Thanks... -
Django Tables 2 - Printable version
Using Django-Tables2, I am looking for a way to correctly display (or send PDF to user as downloaded file) the entire table data. Export feature is nice but I'd like something a bit more user-friendly in a way that the user could litteraly print the version that would be displayed without any layout issue. -
filtering objects using custom template tags django
custom_tags.py: @register.filter def completed(student, level): return Task.objects.filter(student=student,level=level).count() @register.filter def alltodos(level): return ToDo.objects.filter(level=level).count() Template: # I load this at the top {% load custom_tags %} {% for level in levels %} {% completed student level as completed %} {% alltodos level as todos %} {% if completed == todos %} <li> <a href="javascript:;"><img src="{{ level.badge.url }}" alt="" /></a> </li> {% else %} <li> <a href="javascript:;"><img src="{{ level.locked_badge.url }}" alt="" /></a> </li> {% endif %} {% endfor %} Having trouble with custom template tags.If all todos returned and tasks number area same i want to display a certain kind of badge or else a locked badge.Its showing error with the custom template tags. Basically if a todo is completed it is saved as a task. Im checking if all todos of a particular level are completed -
Database not created using Django rest Docker with MySQL
I am trying to dockerize my existing Django Rest project. I am using MySQL database instead of default SqlLite. My Dockerfile FROM python:3.6 ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code COPY . /code/ RUN pip install -r requirements.txt My Docker-compose: version: '3' services: db: image: mysql environment: MYSQL_DATABASE: django-test MYSQL_ROOT_PASSWORD: root ports: - "3306:3306" web: build: . command: bash -c "python manage.py makemigrations && python manage.py migrate && python manage.py runserver 0.0.0.0:8000 " volumes: - .:/code ports: - "8000:8000" My setting.py 'ENGINE': 'django.db.backends.mysql', #django.db.backends.mysql 'NAME': 'libraries', #local: libraries #server: 'USER': 'root', #root #root 'PASSWORD': 'root', #local: root #server: 'HOST': 'db', #local: localhost #server: 'PORT': '3306', docker-compose build is successful. the database was not created. i don't know what was the mistake in it. -
How can I send images from Django Rest Api to a Vue SPA?
I am developing a Vue.js 2.0 single page aplication with DRF REST api on the backend. I have images stored in filesystem and one of my models has a field called "image" containing the adress of the image. My model: class Board(models.Model): name = models.CharField(max_length=100) description = models.CharField(max_length=400) image = models.FileField(upload_to='boards/') safe_for_work = models.BooleanField(default=True) created = models.DateTimeField(auto_now_add=True) Viewset: class BoardViewSet(viewsets.ViewSet): serializer_class = BoardSerializer def list(self, request,): queryset = Board.objects.filter() serializer = BoardSerializer(queryset, many=True) return Response(serializer.data) def retrieve(self, request, pk=None): queryset = Board.objects.filter() board = get_object_or_404(queryset, pk=pk) serializer = BoardSerializer(board) return Response(serializer.data) When i call my endpoint from my Vue SPA, instead of getting the image, I only get the local url, for example "/storage/boards/board1.jpg". How can I access the actual image on my Vue page? Ideally I would like to get a list of all the images from the endpoint and display them. -
DJANGO type eror module object is not callable
File "/home/mushfiqul/Mushfiqul/django_pro/simplesocial/posts/views.py", line 48, in form_valid self.object.save() File "/home/mushfiqul/Mushfiqul/django_pro/simplesocial/posts/models.py", line 24, in save self.message_html = misaka(self.message) TypeError: 'module' object is not callable def form_valid(self, form): self.object = form.save(commit=False) self.object.user = self.request.user self.object.save() return super().form_valid(form) -
TypeError: create_superuser() missing 1 required positional argument: 'username'
When creating a superuser through manage.py createsuperuser command i get the following error because in my user registration flow, username isn't required (i use the email instead): TypeError: create_superuser() missing 1 required positional argument: 'username' This is my code in models.py: from django.contrib.auth.models import AbstractUser, BaseUserManager from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils import timezone class CustomUser(AbstractUser): username = None email = models.EmailField(_('email address'), unique=True, blank=False) is_manager = models.BooleanField(default=False, blank=False) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [] def __str__(self): return self.email class CustomUserManager(BaseUserManager): def _create_user(self, email, password, is_staff, is_superuser,is_manager ,**extra_fields): now = timezone.now() if not email: raise ValueError(_(u'The given username must be set')) email = self.normalize_email(email) user = self.model(email=email, is_staff=is_staff, is_active=True, is_superuser=is_superuser,is_manager=is_manager , last_login=now, date_joined=now, **extra_fields) user.set_password(password) user.save(using=self._db) return user def create_user(self, email, password=None, **extra_fields): return self._create_user(email, password, False, False, False, **extra_fields) def create_superuser(self, email, password, **extra_fields): return self._create_user(email, password, True, True, True, **extra_fields) -
Django : set value to a form render field with button click
I want to set value on a render field in a Django form I have the field "desc": {% render_field form.desc class="form-control" maxlength="100" id="areasdescr" name="areasdescr" %} and I want to set a value in a button click Can you help me do this? Thanks a lot Kostas -
Django OAuth Toolkit Login Template
I'm trying to create an OAuth server using the following instructions: https://django-oauth-toolkit.readthedocs.io/en/latest/tutorial/tutorial_01.html Where can I find the login template with path registration/login.html? Is this a template I have to create inside directory /registration? The instructions are not clear but mention that this template should be changed. Another post, https://django.cowhite.com/blog/building-oauth2-services-in-django-with-django-oauth-toolkit/, says that when accessing http://localhost:8000/o/applications/, a screen like the following should show up: Any help would be appreciated. Thanks. -
how to scrap websites that using django
I wanted to create a robot to scrap a website with this address : https://1xxpers100.mobi/en/line/ But the problem is that when I wanted to get data from this website I realized that this website is using django because they are using phrases like {{if group_name}} and others there is a loop created with this kind of method and it creates table rows and the information that I want is there. when I am working with python and I download the html code I can't find any content but "{{code}}" in there, but when I'm working with chrome developer tools (inspect) and when I work with console I can see the content that is inside of the table that I want How can I get html codes that holds the content of that table like chrome tools to get the information that I want from this website? -
How to use Weasyprint with AWS Lambda? (Django & Zappa)
I have a simple Django app which has been pushed to AWS Lambda using Zappa. This process has worked properly, with one exception : cannot load library 'pango-1.0': pango-1.0: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'pango-1.0' I'm using Weasyprint to generate PDF files. Weasyprint needs Cairo and Pango. I don't know how to get Pango to work on my AWS Lambda install. What should I do to make it work ? -
Closing DB connections after they have been reused
this is the situation: I have a django service running in a serverless environment (AWS lambda) The serverless environment creates a docker image out of my django service Every few minutes it launches the container and executes whatever is in my service A docker image is createad as a snapshot of the service meaning database connections are put in the image as well. When a container is launched and it executes my code - previous connections are reused regardless the fact that they might be gone or reused by other services. I get Database Interface errors. So what i do - every time before executing my code logic, i close all connections (django will recreate new ones as needed) As it solves the problem for the current service - it completely destroys other services which might have reused the connection (through something called database connection pooling) When my django service closes it's connections - there is a possibility, that old previous connection is now reused by other service and my django service just destroys it. How do i make sure my django service does not kill a connection but rather returns to the connection pool and simply grabs any other … -
How to index in search engines html-markup stored in the database?
There is a project on Django with Postgresql and I want to try to store html-markup in the database, and when you access a specific link to open it. This is not a problem, but there is a question of indexing by search engines. How to make search engines index these html-markup in the database? -
Filter queries inside templates django
models: class Level(models.Model): number = models.IntegerField() badge = models.ImageField() locked_badge = models.ImageField() timestamp = models.DateTimeField(auto_now_add=True,auto_now=False,blank=True, null=True) unlock = models.CharField(max_length=10,default="A") def __str__(self): return str(self.number) def get_absolute_url(self): return reverse('student:level-detail', kwargs={'pk': self.pk}) class ToDo(models.Model): level = models.ForeignKey(Level, on_delete=models.CASCADE) name = models.CharField(max_length=150) description = models.TextField() timestamp = models.DateTimeField(auto_now_add=True,auto_now=False,blank=True, null=True) def __str__(self): return self.name class Task(models.Model): level = models.ForeignKey(Level, on_delete=models.CASCADE) todo = models.ForeignKey(ToDo, on_delete=models.CASCADE) student = models.ForeignKey(User, on_delete=models.CASCADE) title = models.CharField(max_length=150) content = models.TextField() timestamp = models.TimeField(auto_now=True) datestamp = models.DateField( auto_now=True) like = models.ManyToManyField(User,related_name='user_likes',blank=True) is_verified=models.BooleanField(default=False,blank=True) def __str__(self): return self.title def get_absolute_url(self): return reverse('student:dashboard') objects = PostManager() @property def comments(self): instance = self qs = Comment.objects.filter_by_instance(instance) return qs @property def get_content_type(self): instance = self content_type = ContentType.objects.get_for_model(instance.__class__) return content_type Template: {% for level in levels %} {% if tasks.filter(student=student,level=level).count == todos.filter(level=level).count %} <li> <a href="javascript:;"><img src="{{ level.badge.url }}" alt="" /></a> </li> {% else %} <li> <a href="javascript:;"><img src="{{ level.locked_badge.url }}" alt="" /></a> </li> {% endif %} {% endfor %} sample view: @login_required(login_url='/account/login/') def StudentPublicProfile(request,pk=None): student = User.objects.get(pk=pk) levels = Level.objects.all() todos=ToDo.objects.all() tasks=Task.objects.all() context={ 'student': student, 'levels' : levels, 'tasks' : tasks, 'todos' : todos, } return render(request, 'student_public_profile2.html', context) This might need a little explanation. I have 3 models- Level Todo and Task. Each level contains … -
ModuleNotFoundError: No module named 'users'
I am trying to import a table from my "users" app but it keeps failing. Prior to this moment I have imported tables from the app into different files in another app without errors. Here's the stacktrace when I try to run a script from within the app: Traceback (most recent call last): File "trending_tweets.py", line 9, in <module> from users.models import Country ModuleNotFoundError: No module named 'users' Here's the trending_tweets.py file: import yweather import tweepy from decouple import config # from django.apps import apps from users.models import Country # countries = apps.get_model('users', 'Country') class TrendingTweets: """ Class to generate trending tweets within bloverse countries """ def __init__(self): """ configuration settings to connect twitter API at the point of initialization. """ self.api_key = config('TWITTER_API_KEY') self.twitter_secret_key = config('TWITTER_SECRET_KEY') self.access_token = config('ACCESS_TOKEN') self.access_token_secret = config('ACCESS_TOKEN_SECRET') def twitter_api(self): """ authentication method to configure twitter settings. """ auth = tweepy.OAuthHandler(self.api_key, self.twitter_secret_key) auth.set_access_token(self.access_token, self.access_token_secret) api = tweepy.API(auth) return api # auth request object def generate_woeid(self): """ method to generate WOEID of each country on our platform """ client = yweather.Client() woeid_box = [] countries = Country.objects.all() for country in countries: woeid = client.fetch_woeid(country.name) woeid_box.append(woeid) return woeid_box if __name__ == '__main__': x = TrendingTweets() r = … -
Django : Aggregating a Sum results in zero
This are my models: class Purchase(models.Model): ref_no = models.PositiveIntegerField() Party_ac = models.ForeignKey(ledger1,on_delete=models.CASCADE,related_name='partyledger') purchase = models.ForeignKey(ledger1,on_delete=models.CASCADE,related_name='purchaseledger') Total_Amount = models.DecimalField(max_digits=10,decimal_places=2,blank=True, null=True) class Stock_Total(models.Model): purchases = models.ForeignKey(Purchase,on_delete=models.CASCADE,null=True,blank=True,related_name='purchasetotal') Quantity = models.PositiveIntegerField() rate = models.DecimalField(max_digits=10,decimal_places=2) Disc = models.DecimalField(max_digits=10,decimal_places=2,default=0) Total = models.DecimalField(max_digits=10,decimal_places=2,null=True,blank=True) class journal(models.Model): By = models.ForeignKey(ledger1,on_delete=models.CASCADE,related_name='Debitledgers') To = models.ForeignKey(ledger1,on_delete=models.CASCADE,related_name='Creditledgers') Debit = models.DecimalField(max_digits=10,decimal_places=2,null=True) Credit = models.DecimalField(max_digits=10,decimal_places=2,null=True) I want the journal model should be automatically created whenever the purchase model is created by user... So I have done this: @receiver(post_save, sender=Purchase) def create_purchase_journal(sender, instance, created, **kwargs): total1 = instance.purchasetotal.aggregate(the_sum=Coalesce(Sum('Total'), Value(0)))['the_sum'] if created: journal.objects.create(User=instance.User,Company=instance.Company,By=instance.Party_ac,To=instance.purchase,Debit=total1,Credit=total1) But when the aggregate function in "Debit" and "Credit" is coming 0.00 I have also tried using "instance.Total_Amount" in it...But the result is same... Can anyone plz tell me how to get the value of the aggregate function perfectly??? Thank you -
How to add custom Lookup field to the Model
In my project I had a model that used BooleanField to represent certain state. from django.db import models class Foo(models.Model): is_closed = models.BooleanField(default=False) After some time I need to add another state so I changed is_closed field to status, now being CharField with choices. class Foo: status = models.CharField(max_length=1, default='O', choices=[ ('O', 'opened'), ('H', 'on_hold'), ('C', 'closed'), ]) I can handle migrations, etc. but still, I have a lot of queries using foo__is_closed. Since the existing codebase extensively uses legacy field, I would have to change all occurrences of: is_closed=True to status='C', is_closed=False to status__in=('O', 'H') And of course upon adding new state, I would have to maintain all this code once again. Putting this another way I would like this: Foo.objects.filter(is_closed=True) to filter all Foo objects with status == 'C' and this: Foo.objects.filter(is_closed=False) to filter all Foo objects with status equal to 'O' or 'H'. I know there is the Lookup Registration API, I guess it is what I need but I cannot understand how I should use RegisterLookupMixin in my model. -
Cookies to store quiz answers information in Django
I'm trying to make a quiz app with Django as backend. The way I want to do it is by showing a multiple choice question to the user, where he/she will select whatever answer he/she wants. After that, the user will click on "Next question", and that question will disappear and the next one will show up. I was thinking about storing what questions and answers the user has already answered in a session cookie and once he/she answers the ten questions that would make up the quiz, the webpage shows the total score. How could I store session info of that kind? Is there an easy way to do the "Next question" button and show the next question in the same page? Thank you in advance! -
how to handle exception in django multiple database
error screenshot try: DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'jobstar', } } except: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'jobstar'), } } How can i handle exception with database settings in django . my primary database is mongodb as shown. i want when mongo is not running or not installed in system it will use sqlite (secondary) database. i am trying to do this in above way it is throwing me errors. please have a look into my code t__ self.loader = MigrationLoader(self.connection) File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__ self.build_graph() File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/django/db/migrations/loader.py", line 206, in build_graph self.applied_migrations = recorder.applied_migrations() File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 61, in applied_migrations if self.has_table(): File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 44, in has_table return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()) File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/django/db/backends/base/introspection.py", line 56, in table_names return get_names(cursor) File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/django/db/backends/base/introspection.py", line 51, in get_names return sorted(ti.name for ti in self.get_table_list(cursor) File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/djongo/introspection.py", line 46, in get_table_list for c in cursor.db_conn.collection_names(False) File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/pymongo/database.py", line 715, in collection_names nameOnly=True, **kws)] File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/pymongo/database.py", line 674, in list_collections read_pref) as (sock_info, slave_okay): File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1099, in _socket_for_reads server = topology.select_server(read_preference) File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/pymongo/topology.py", line 224, in select_server address)) File "/home/soubhagya/Desktop/worke/rmaze-partner/rmaze-partner-env/lib/python3.6/site-packages/pymongo/topology.py", line 183, in select_servers … -
Can't get django-social-auth to redirect to my custom urls after authentication
I would like django-social-auth to redirect to /?ref=twitter if user logs in through twitter, and /?ref=google if they login through google-oauth2. So far, the authentication works, but django-social-auth always redirects to / (which is 'home'). Here are my settings: LOGIN_URL = 'login' LOGOUT_URL = 'logout' LOGIN_REDIRECT_URL = 'home' # Used to redirect the user once the auth process ended successfully. The value of ?next=/foo is used if it was present SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/' SOCIAL_AUTH_TWITTER_LOGIN_REDIRECT_URL = '/?ref=twitter' SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_REDIRECT_URL = '/?ref=google' # URL where the user will be redirected in case of an error SOCIAL_AUTH_LOGIN_ERROR_URL = '/?err=true' SOCIAL_AUTH_TWITTER_LOGIN_ERROR_URL = '/?ref=twitter&err=true' SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_ERROR_URL = '/?ref=google&err=true' # Is used as a fallback for LOGIN_ERROR_URL SOCIAL_AUTH_LOGIN_URL = '/' SOCIAL_AUTH_TWITTER_LOGIN_URL = '/?ref=twitter' SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_URL = '/?ref=google' # Used to redirect new registered users, will be used in place of SOCIAL_AUTH_LOGIN_REDIRECT_URL if defined. # Note that ?next=/foo is appended if present, if you want new users to go to next, you'll need to do it yourself. SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/?user=new' SOCIAL_AUTH_TWITTER_NEW_USER_REDIRECT_URL = '/?ref=twitter&user=new' SOCIAL_AUTH_GOOGLE_OAUTH2_NEW_USER_REDIRECT_URL = '/?ref=google&user=new' # Like SOCIAL_AUTH_NEW_USER_REDIRECT_URL but for new associated accounts (user is already logged in). # Used in place of SOCIAL_AUTH_LOGIN_REDIRECT_URL SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/?assoc=true' SOCIAL_AUTH_TWITTER_NEW_ASSOCIATION_REDIRECT_URL = '/?ref=twitter&assoc=true' SOCIAL_AUTH_GOOGLE_OAUTH2_NEW_ASSOCIATION_REDIRECT_URL = '/?ref=google&assoc=true' It would be extremely helpful if …