Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
User should not be able to pay until he selects an address
I am Building an eccomerce webiste. So, the issue is that i wanna allow a user to pay only after he selects an address. I have tried required field of html but it seems like it didn't worked. When a user selects an address only then he will be able to pay. But currently when i click on pay button it directly redirects me to payment. This is buy now page {% extends 'app/base.html' %} {% load static %} {% block title %}Buy Now{% endblock title %} {% block main-content %} {% load humanize %} <div class="container"> <div class="row mt-5"> <div class="col-sm-4 offset-sm-1"> <h4>Select Shipping Address :</h4> <hr> <form action="/payment_done/"> {% if address %} {% for add in address %} <div class="card"> <div class="card-body"> <h5>{{add.name}}</h5> <p>{{add.locality}}, {{add.city}}, {{add.state}} - {{add.zipcode}}.</p> </div> </div> <div class="form-check mt-2 mb-5"> <input class="form-check-input" type="radio" name="custid" id="custadd{{forloop.counter}}" value="{{add.id}}" required> <label class="form-check-label fw-bold" for="custadd{{forloop.counter}}"> Address: {{forloop.counter}} </label> </div> {% endfor %} <!-- Paypal button --> <div class="text-end"> <div id="paypal-button-container"></div> </div> {% else %} <p class='mx-2 fw-bold'>Please add an <a href="/profile/">shipping address</a></p> {% endif %} </form> </div> </div> </div> {% endblock main-content %} {% block payment-gateway %} <!-- Include the PayPal JavaScript SDK --> <script src="https://www.paypal.com/sdk/js?client-id=test&currency=USD"></script> <script> // … -
No 'Access-Control-Allow-Origin' error - font-awesome
Within the past couple of weeks, I've started to get an error that I haven't seen before. My project has not materially changed and so I believe that this may be a change that font-awesome has implemented. Access to CSS stylesheet at 'https://use.fontawesome.com/releases/v5.3.1/css/all.css' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Any thoughts on which CORS settings in Django I have to change in order to prevent this from happening? When I hit Ctrl+F5 to refresh the page, the error goes away. When I visit another page in my project, I get the error again. Thanks! -
Use PixiJS with Django
I'm new to django and didn't have the time to fully understand it so I'm hoping someone can help me fix this. I am using this page: Generative UI - Orb Animation [pixi.js] + Frosty Elements ❄️ with the same Javascript file in it. I can use it properly without django by typing <script type="module" src="script.js"></script> in my html file but when it comes to django, I don't actually know what to do. I tried to put it in static folder and load it. It works, but there is no animation! I guess it has something to do with the applications in the script, but again I'm a newbie so I don't know what to do. Any suggestions? -
Django: Return all nested Sub Model from a given Model (which isn't directly linked to given model)
I have my models.py as shown below: from django.db import models # Create your models here. class Category(models.Model): categoryType = models.CharField(max_length=100,blank = False, unique = True, null = False) def __str__(self): return self.categoryType class SubCategory(models.Model): subcategoryType = models.CharField(max_length=100) categoryType = models.ForeignKey(Category,on_delete=models.CASCADE, null = True, related_name='category_type') def __str__(self): return f'{self.categoryType} :: {self.subcategoryType}' class Product(models.Model): productName = models.CharField(max_length=50,blank = False, null = False) subCategoryType = models.ForeignKey(SubCategory,on_delete=models.SET_NULL, null=True,related_name='product_subcategories') #categoryType = models.ForeignKey(Category,on_delete=models.SET_NULL, null=True,related_name='product_categories') def __str__(self): return f'{self.productName} : {self.subcategoryType}' I have created a serializer to get all products within a given category as shown below: class ProductSerializerSpecific(serializers.ModelSerializer): class Meta: model = Product fields = ('id','productName') class SubCategoryProductsSpecific(serializers.ModelSerializer): products = ProductSerializerSpecific(source='product_subcategories', many=True) class Meta: model = SubCategory fields = ['products'] class CategoryProducts(serializers.ModelSerializer): products = SubCategoryProductsSpecific(source='category_type', many=True) class Meta: model = Category fields = ('id','products') My View goes like this: class ListAllCategoryProducts(viewsets.ReadOnlyModelViewSet): queryset = Category.objects.all() serializer_class = CategoryProducts And finally I registered by route like this: router.register(r"category_products", views.ListAllCategoryProducts, basename="categories_products") When I do a GET request to get all products with a given ID as shown below: GET http://localhost:8000/category_products/1 HTTP/1.1 The output comes as shown below: { "id": 1, "products": [ { "products": [] }, { "products": [] }, { "products": [] }, { "products": [ { … -
How to save MultipointField in django rest framework using createAPI View
Im using django Rest framework to make an api at some point I would like to save a multipointfield , Im expecting the frontend to send an array of point but that format is not supported by django-restframework how am I supposed to do it? -
Django autocomplete-light ModelSelect2Multiple select a valid choice error
I keep getting "Select a valid choice. 'X' is not one of the available choices." where 'X' is the primary key of the profile when I submit the create team form after filling in team name, selecting game and team members. I have been trying to create a form for a model that has ManyToMany Relationship with Profile model. I decided to use django-autocomplete-light after trying django-select2 package. Here is my code so far models.py class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) dob = models.DateField(unique=False, null=True, blank=True) class Game(models.Model): name = models.CharField(max_length=128, unique=True) is_team_game = models.BooleanField(default=False) def __str__(self): return '{}'.format(self.name) class Team(models.Model): name = models.CharField(max_length=100) game = models.ForeignKey(Game, on_delete=models.CASCADE) players = models.ManyToManyField(Profile, related_name='player_profiles') views.py class ProfileAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = Profile.objects.all() if self.q: qs = qs.filter(user__username__istartswith=self.q) return qs urls.py from django.urls import path from . import views urlpatterns = [ path('autocomplete/profile/', views.ProfileAutocomplete.as_view(), name='profile-autocomplete'), ] forms.py from django import forms from .models import Game, Profile, Team from dal import autocomplete class TeamForm(autocomplete.FutureModelForm): players = forms.ModelMultipleChoiceField(label='Team Members', queryset=Profile.objects.none(), widget=autocomplete.ModelSelect2Multiple(url='profile-autocomplete')) class Meta: model = Team fields = [ 'name', 'game', 'players' ] def __init__(self, *args, **kwargs): super(TeamForm, self).__init__(*args, **kwargs) self.fields['game'].queryset = Game.objects.filter(is_team_game=True) create_team.html template {% extends "website/base.html" %} {% load crispy_forms_tags %} {% block … -
Django cron job error when pulling the new code
I'm running the Django website with some cron jobs. One of them is running every 3 mins. When I made an update, I will pull the new code: Example for my update code: # my_a.py class MyClass: pass # my_b.py from my_a import MyClass I just notice that sometimes I have an error on this cron job, some files have new code, some files do not. It raises an error: cannot import name MyClass. Does anyone face this problem? I guess the job is running at the time I pull the code but I'm not sure. -
CK-Editor in django not working in production
CK-editor works fine in development but its not working in production. In the console tab it shows error: Failed to load resource: the server responded with a status of 404 (Not Found) ckeditor.js -
Reusing old options from pagination and filter Django
view : def subcategory(request, category_url): category = get_object_or_404(Category, category_url=category_url) subcategories = Subcategory.objects.filter(category=category) products_list = Product.objects.filter(product_category=category) subcatid = request.GET.getlist('subcategory') print(subcatid) if subcatid: ids = [int(id) for id in subcatid] subcategories1 = Subcategory.objects.filter(category=category, id__in=ids) products_list = Product.objects.filter(product_category=category, product_subcategory__in=subcategories1) else: subcategories1 = None products_list = Product.objects.filter(product_category=category) page = request.GET.get('page', 1) paginator = Paginator(products_list, 12) try: products = paginator.page(page) except PageNotAnInteger: products = paginator.page(1) except EmptyPage: products = paginator.page(paginator.num_pages) if request.user.is_authenticated: wishlist = get_object_or_404(Wishlist, user=request.user.profile) else: wishlist = None reqget = request.GET.copy() reqget.pop('page', None) ctx = {'products':products, 'products_list':products_list, 'wishlist':wishlist, 'subcategories':subcategories, 'category':category, 'subcategories1':subcategories1, 'reqget': reqget, } return render(request, 'products/subcategory.html', ctx) template : {% extends "blog/base.html" %} {% load static %} {% load ratings %} {% load humanize %} {% block title %}ماهوت کالکشن | دسته بندی محصولات {% endblock title %} {% block content %} <main class="main"> <div class="page-header text-center"> <div class="container"> <h1 class="page-title">{{category.category_name}}<span>دسته بندی</span></h1> </div><!-- End .container --> </div><!-- End .page-header --> <nav aria-label="breadcrumb" class="breadcrumb-nav mb-2"> <div class="container"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="">{{q}} فروشگاه</a></li> <li class="breadcrumb-item"><a href="/products/">دسته بندی</a></li> <li class="breadcrumb-item active" aria-current="page">{{category.category_name}}</li> </ol> </div><!-- End .container --> </nav><!-- End .breadcrumb-nav --> <div class="page-content"> <div class="container"> <div class="row"> <div class="col-lg-9"> <div class="toolbox"> <div class="toolbox-left"> <div class="toolbox-info"> محصولات این دسته : <span>{{products_list.all|length}}</span> محصول </div><!-- End .toolbox-info … -
Django : Do you need to name a tag library (templates, static, etc) with a specific folder name?
So, I'm currently learning Django. And I got confused when I started creating, for example, 'templates' folder. So templates folder is where we can actually store templates for the web application. Do we actually need to name the folder 'templates'? Or could we name it something else? -
Django Queries for related models
I have these two models, product and comment. class Product(VoteModel, models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1, null=False, on_delete=models.CASCADE, related_name="%(class)s_listings") product_id = models.CharField(max_length=150, null=False, default=get_id, unique=True, editable=False) product_title = models.CharField(max_length=150, null=False) created_at = models.DateTimeField(auto_now=False, auto_now_add=True) updated_at = models.DateTimeField(auto_now=True, auto_now_add=False) product_description = tinymce_models.HTMLField() num_vote = models.IntegerField(default=0) The Comment Model class Comment(VoteModel, models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1, null=True, blank=True, on_delete=models.SET_NULL) created_at = models.DateTimeField(auto_now=False, auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) ip_address = models.GenericIPAddressField(_('IP address'), unpack_ipv4=True, blank=True, null=True) rating = models.CharField(max_length=3, default=1.0) # Content-object field content_type = models.ForeignKey(ContentType, verbose_name=_('content type'), related_name="content_type_set_for_%(class)s", on_delete=models.CASCADE) object_pk = models.TextField(_('object ID')) content_object = GenericForeignKey(ct_field="content_type", fk_field="object_pk") Then, I have a serializer, in which I am trying to get the rating for the comments to come out with an average rating for each Item class ProductSerializer(ModelSerializer): product_rating = SerializerMethodField(read_only=True) class Meta: model = Product fields = [ "product_rating" ] def get_product_rating(self, obj): comments = Comment.objects.filter(object_pk=obj.pk, content_type=ContentType.objects.get_for_model(obj)) .... return {'rating': str(float("%.1f" % average)), 'views': views} This seems to be creating duplicate queries comments = Comment.objects.filter(object_pk=obj.pk, content_type=ContentType.objects.get_for_model(obj)) How can I rewrite the query better to avoid duplicate queries? -
Why does my favicon and video not appear after I run build my react app?
When I build my react app, the video and favicon do not appear. This is my folder structure before npm run build: This is my folder structure after npm run build (frontend folder placed in django backend folder): This is my code when linking the favicon in index.html: <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> This is my code when linking the video in one of my components: <video src='/videos/video.mp4' autoPlay loop muted /> Images from products on my website load properly, but they are retrieved from the django backend. E.g. a product image url pattern is /images/scan1.jpg My Django url pattern: urlpatterns += static(settings.MEDIA_URL,document_root = settings.MEDIA_ROOT) My Django settings static file structures: STATIC_URL = '/static/' MEDIA_URL = '/images/' STATICFILES_DIRS = [ BASE_DIR /'static', BASE_DIR /'frontend/build/static' ] MEDIA_ROOT = 'static/images' The error im getting: Any help would be much appreciated, Thanks -
How to solve UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
I'm trying to use Black to format my Django code. It works fine in most directories. However, I get the Unicode decode error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte on the .py files in one directory in particular. The files are in UTF-8, but I have tried multiple different other encodings and have tried deleting and recreating files which hasn't resolved the issue. I'm working in an Anaconda environment, but deactivating that doesn't make any difference. I've also disabled most of my VS Code extensions. I have looked at many SO postings on this, but none of the suggestions thus far have helped. I'm using VS Code on a Mac and have a feeling it is something to do with the fact that in the past I have edited the same code on a Windows machine using VS Code with WSL (code synced with a GitHub repo), but can't figure out how to address it. I've put a sample Traceback call below. Any help would be much appreciated! (base) ➜ healthtic git:(master) ✗ black pages/views.py Traceback (most recent call last): File "/Users/jh/opt/anaconda3/bin/black", line 8, in <module> sys.exit(patched_main()) File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/black/__init__.py", line 1130, in patched_main … -
Sending a message to inclusion tag Django
Does anyone know how send a message from a main view to an inclusion tag . Application Main View: def post(self, request): name = request.POST.get('name', 'Anonymous') email = request.POST.get('email', 'Anonymous') subject = request.POST.get('subject', 'Anonymous') message = request.POST.get('message', 'Anonymous') contact = Contact.objects.create(name=name, email=email, subject=subject, message=message) contact.save() success(request,"Message Sent") return redirect(reverse('portfolio:home') + '#contact') Main Template with custom tags {% get_introduction_data %} {% get_about_data %} {% get_expertise_data %} {% get_client_data %} {% get_skill_data %} {% get_education_data %} {% get_experience_data %} {% get_work_data %} Supposing I wanted to pass my message from the view into my main template that is then redirected to one of my main view tags. How would I be able to pass the message considering that the message framework requires a request to store a message which is passed on to the next request . The main issue is inclusion tags do not possess their own individual request object and maybe there is a way to pass data from a main template to an included partial. Here is a github link to the opensource repo for further inspection: https://github.com/Munalula-Sikazwe/Django-Personal-Portfolio -
How to solve this strange error in the admin site?
I am working on a project with countries, regions, counties, municipalities and cities. Each of these has its own model and the model is registered using a ModelAdmin. Here's my admin.py. from django.contrib import admin from .models import Country, Region, County, Municipality, City @admin.register(Country) class CountryAdmin(admin.ModelAdmin): model = Country list_display = ["name", "continent", "capital", "area", "population", "regions"] list_filter = ["continent", "area", "population"] search_fields = ["name", "capital", "description"] @admin.register(Region) class RegionAdmin(admin.ModelAdmin): model = Region list_display = ["name", "country", "area", "population"] list_filter = ["country", "area", "population"] search_fields = ["name", "description"] @admin.register(County) class CountyAdmin(admin.ModelAdmin): model = County list_display = ["name", "capital", "area", "population", "abbreviation", "verbose_neighbours"] list_filter = ["region", "area", "population"] search_fields = ["name", "capital", "description", "abbreviation"] @admin.register(Municipality) class MunicipalityAdmin(admin.ModelAdmin): model = Municipality list_display = ["name", "county", "area", "population"] list_filter = ["county", "area", "population"] search_fields = ["name", "county", "description"] @admin.register(City) class CityAdmin(admin.ModelAdmin): model = City list_display = ["name", "county", "area", "population"] list_filter = ["county", "area", "population"] search_fields = ["name", "description"] And here are my models. from django.db import models from django.forms.models import model_to_dict from django.dispatch import receiver from django.db.models.signals import pre_save, post_save from django.utils.translation import gettext_lazy as _ class ModelDiffMixin(object): """ A model mixin that tracks model fields' values and provide some useful api … -
How to run SearchHeadline (a heavy function) only on the Paginated QuerySet result
I am using Django and Postgresql Full-Text Search to generate a paginated search result for my users. I rank and highlight my results. qs = ( self.filter(Q(title_vector=SearchQuery(search_term))) .annotate(rank=rank) .order_by("-rank", "pk") .annotate( title_snippet=SearchHeadline( "title", SearchQuery(search_term), highlight_all=True ) ) .distinct() ) In performance testing, I've identified that the SearchHeadline function is extremely heavy (as mentioned in the documentation) and is applied to every single row in the result - even if there are thousands of results being paginated in sets of 25. This makes the query take too long to complete. Another user on StackOverflow had the same issue as mine and discovered that only running ts_headline against the paginated results significantly improves performance (Relevant Question). I tested and confirmed that a similar approach would solve my problem. My question is how can I tweak my Django code to generate a SQL query against a query like the below example? After the Paginator applies a limit and offset to the result set, only then run ts_headline against those results only. SELECT id, ts_headline('italian', body, to_tsquery('italian', 'torino')) as headline, rank, title, location FROM ( SELECT id, body, title, location, ts_rank(body_tsvector, query) as rank FROM fulltextsearch.documents, to_tsquery('italian', 'torino') as query WHERE to_tsvector('italian', coalesce(body,'')) @@ … -
Multiple repeat error while validating email in django
i started learning Django a couple of days ago.Today i was learning forms with Django and everything was going well until i encountered the re repeat error during email validation.I tried multiple ways to solve this issue but failed. if anybody know how to fix this error,i'll be very thankful. below is my re code snippet import re regex = '^\w+(\.-]?\w+)*@\w+([\.-]?\w+*(\.\w{2,3})+$' if not re.search(regex,email): errorflag = True errormsg = "Not a valid email address" Errors.append(errormsg) if errorflag != True: dictionary["success"] = True dictionary["successmsg"] = "Form Submitted" -
What do I write in the views.py for my dashboard?
I am trying to create a system where users can register their complaints and view and edit them as well. They can also view other people's complaints but not edit them. This is how my dashboard should look. I need to show the number of complaints that are registered by the user so far in the white box but I don't know how. could someone please tell me how to do that? models.py: class Profile(models.Model): user = models.OneToOneField(User,null= True , blank = True, on_delete= models.CASCADE) profile_pic = models.ImageField(default = "msi.jpg", null = True, blank= True, upload_to= 'static/profileimages') first = models.CharField(max_length=500, null=True) last = models.CharField(max_length=500, null=True) email = models.CharField(max_length=500, null=True) mobile_number = models.IntegerField(null=True) location = models.CharField(max_length= 500, null= True) postal = models.IntegerField(null=True) def __str__(self): return self.first class Complaint(models.Model): user = models.ForeignKey(User, on_delete= models.CASCADE, null = True, blank=True) id = models.AutoField(blank=False, primary_key=True) reportnumber = models.CharField(max_length=500 ,null = True, blank= False) eventdate = models.DateField(null=True, blank=False) event_type = models.CharField(max_length=300, null=True, blank=True) device_problem = models.CharField(max_length=300, null=True, blank=True) manufacturer = models.CharField(max_length=300, null=True, blank=True) product_code = models.CharField(max_length=300, null=True, blank=True) brand_name = models.CharField(max_length = 300, null=True, blank=True) exemption = models.CharField(max_length=300, null=True, blank=True) patient_problem = models.CharField(max_length=500, null=True, blank=True) event_text = models.TextField(null=True, blank= True) document = models.FileField(upload_to='static/documents', blank=True, null=True) def … -
Django's sync_to_async and mypy
It seems that mypy doesn't really grok sync_to_async. For example, in the following code: @sync_to_async def get_point(...) -> Point: ... def other_func(): point = await get_point() I get the warning Class 'Point' does not define '__await__' so the 'await' operator cannot be used on its instance. What's the simplest way to add a correct type definition for sync_to_async? (Which is preferable to just ignoring the error) -
Get row separately for each category - django ORM
I have the following models: class Category(models.Model): name = models.CharField(max_length=100, null=False, blank=False) description = models.CharField(max_length=500, null=True, blank=True) class Website(models.Model): ... category = models.ManyToManyField('Category', related_name='website_category') ... Since each website can have multiple categories so I want to fetch each website multiple times for each category. For example: website 1 has categories: Category 1, Category 2 website 2 has categories: Category 2, Category 3 Required Output: Website Category website 1 category 1 website 1 category 2 website 2 category 2 website 2 category 3 I'm relatively new to Django ORM and unable to construct a query to fetch the desired results, so any help would be highly appreciable. -
How to access (previous or next) element and compare values in django template
I was working with a django app that built under a machine learning model and its pulling data from a joblib dump file. Everything was fine but I am getting error while accessing previous element in the template for loop. My views.py written as- Is there any way to access previous index and compare values for this particular problem? Please let me know. Thanks in advance :) -
django read mp3 file and send it as response
views.py from . import models, serializers from rest_framework import viewsets, status from rest_framework.response import Response from rest_framework.views import APIView class getSongData(APIView): serializer_class=serializers.SongSerializer def get(self, request, id, format=None): serializer = serializers.SongSerializer(models.Song.objects.get(id=id)) file_loc = serializer.data['audio_file'] # go below to see the data # read the mp3 file return Response(file_data) urls.py from django.urls import path from . import views urlpatterns = [ path('songs/audio/<int:id>', views.getSongData.as_view(), name='audio') ] serializers.py from rest_framework import serializers from . import models class SongSerializer(serializers.ModelSerializer): class Meta: model = models.Song fields = '__all__' models.py from django.db import models from datetime import datetime class Song(models.Model): title = models.CharField(max_length=64) audio_file = models.FileField() genre = models.CharField(max_length=64) created_at = models.DateTimeField(default=datetime.utcnow) The data [ { "id": 1, "title": "Kubbi | Cascade", "audio_file": "/media/Kubbi__Cascade.mp3", "genre": "Instrumental", "created_at": "2021-07-24T10:21:48Z" } ] When the user clicks on a song (lets say the song's id=1), a request gets sent to 'http://localhost:8000/api/songs/audio/1' then in views.py I extract the song's location via serializer.data['audio_file'] which is = "/media/Kubbi__Cascade.mp3", all i want to do is to read this audio file and send the data as a Response back to the frontend, I tried many solutions but they were throwing errors... -
Django changes is not reflecting on the browser
It's my second day of Django and everything seems to be going petty well. Though the installation process is a bit longer, I still find it friendly to get started with. I am currently learning how to pass data to static file from views.py. The problem I am having is that it is only showing the previous changes not the recent. I have hard-refresh but still not working. I don't know how to stop and rerun the server because I don't know how to combine both Ctr + BREAK. -
Static image in django not loading in browser
my image static file is not loading in browser. settings.py--- BASE_DIR = Path(__file__).resolve().parent.parent DEBUG = True INSTALLED_APPS = [ ---, 'django.contrib.staticfiles', --- ] STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR / 'static_dir'), ] STATIC_ROOT = os.path.join(BASE_DIR / "static_root") urls.py-- from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('',mainApp.views.home, name='home') ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) main.html-- {% load static %} <div> <p> <a href="#" class="btn btn-primary my-2">LinkedIn </a> <a href="mailto:xxxxxxx@gmail.com" class="btn btn-secondary my-2">Email Me</a> </p> <img scr="{% static 'me.JPG' %}" width='200' height='250'></img> </div> I have used similar .js and .css paths and they are working. The image is not loading in browser . but the image scr on inspecting the element shows <img scr="/static/me.JPG" width="200" height="250"> on loading 127.0.0.1:8000/static/me.JPG it is successfully showing the image. -
Using Smartsheet API: How do I access user data after a user is authenticated and taken to redirect url?
Context: I integrated a Node.js Smartsheet Oauth flow into my Django app by having the login button in django direct the user to the /auth url on the Node server. Once the flow is done and user logs in through Smartsheet, the redirect URL from the Smartsheet dev tools takes the user back to the Django website. Objective: I am trying to access the user data, so that before they log in a variable called user = undefined, and after they log in the variable called user is an object with a set of user data that comes from the smartsheet API. This object would include: id, email, first name, last name, etc... I have tried a few approaches: I tried to fetch data from the /callback url where the OAuth flow generates and saves token data, but I get rejections, maybe due to thoughtful security protocall Ive tried to play with "raw token requests" for current user, maybe accessing them from the Node.js server and then sending data back through a post request. I haven't get it working and it seems incorrect to post user data as it comes, and have the django app try to match the user …