Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
object has no attribute 'get' in django views
I am using the django version 3.0.11. I am going to make rest api using rest_framework. I think there is no problem url router and other parts. class DemoAPI( mixins.ListModelMixin, mixins.CreateModelMixin, mixins.UpdateModelMixin, mixins.DestroyModelMixin ): model = Demo serializer_class = DemoSerializer def __init__(self, obj, **kwargs): obj = super().__init__(**kwargs) self.bUseDefaultGetParam = False return obj def list(self, request, *args, **kwargs): queryset = self.get_queryset() if self.request is dict: query = self.request.GET.get('q', None) if query: condition = Q(demo_name__icontains=query) | Q(api_number__icontains=query) queryset = self.model.objects.filter(condition) else: queryset = self.model.objects.all() serializer = DemoSerializer(queryset, many=True) context = super().get_context_data(**kwargs) null_api = "0000000000" null_apis = Demo.objects.filter(api_number=null_api) demos = Demo.objects.exclude(api_number=null_api) context["null_apis"] = null_apis context["mapbox_access_token"] = os.getenv('MAPBOX_ACCESS_TOKEN') context["well_markers"] = [] for demo in demos: if not demo.surface_hole_longitude or not demo.surface_hole_latitude: continue context["well_markers"].append( { 'name': demo.demo_name, 'location': [ float(demo.surface_hole_longitude), float(demo.surface_hole_latitude), ] } ) context['data'] = serializer.data print("demos: ", serializer.data) return Response(context) When I tried to call this api, an error is occured. AttributeError at /api/demos/ 'DemoAPI' object has no attribute 'get' Request Method: GET Request URL: http://localhost:8000/api/demos/ Django Version: 3.0.11 Exception Type: AttributeError Exception Value: 'DemoAPI' object has no attribute 'get' Exception Location: /usr/local/lib/python3.7/dist-packages/livereload/middleware.py in process_response, line 22 Python Executable: /usr/bin/python3 Python Version: 3.7.3 Python Path: ['/app', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages'] Server time: … -
Django. Group by. Annotating queryset with pre-modification one of the columns
I have two simple models: transaction and category. Each transaction has category and amount (money) Categories have hierarchical structure (each category has parent category, except for one root category) In Django model view I have: class Transaction: category = models.ForeignKey(Category, on_delete=models.PROTECT, null=True) amount = models.DecimalField('amount', decimal_places=2, max_digits=10) class Category: name = models.CharField('name', max_length=200, null=True) parent_category = models.ForeignKey('self', on_delete=models.CASCADE, null=True) I have category hierarchy like: Root -> Food -> Pizza -> Apple -> Transport -> Taxi -> Bus I need to collect spending statistics by categories for particular month, sum all amounts for each category under Root (including sub categories) To group by all categories I did: Transaction.objects.filter(date__month=date.today().month) .values('category_id') .annotate(total_amount=Sum('amount')) I got stats like: Pizza = 100; Apple = 20; Taxi = 50; Bus = 10; And I need: Food = 120; Transport = 60; Mb I can calculate parent categories for Pizza/Taxi inplace by queryset methods before grouping -
Django TypeError: argument of type 'datetime.datetime' is not iterable
When I try to add a new field or modify my model in any way I get the following error when I try to migrate to the database: File "C:\Users\uddin\Envs\web\lib\site-packages\django\db\models\fields\__init__.py", line 1913, in get_prep_value if value and ':' in value: TypeError: argument of type 'datetime.datetime' is not iterable This is what my model.py file looks like from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse from PIL import Image class Post(models.Model): title = models.CharField(max_length=100) title2 = models.CharField( max_length=100) content = models.TextField() content2 = models.TextField(default=None) post_image = models.ImageField(upload_to='post_pics') post_image2 = models.ImageField(upload_to='post2_pics') date_posted = models.DateTimeField(default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.title def get_absolute_url(self): return reverse('post-detail', kwargs={'pk': self.pk}) Any help would be appreciated -
Accessing User Location ( Only City Name ) ( NOT Map )
I am building a BlogApp and I am stuck on a Problem. What i am trying to do I am trying to access user location like :- City or State. I don't want to access in Map. I just want to access the city name of users. What have i tried I try through JavaScript and Google Apis to access location , It showed the location perfectly. BUT i didn't find any way to save the location of User in Database from FrontEnd to BackEnd. So i dropped down that method. The Below ↓ code is showing the FrontEnd Code of JavaScript. <script> let thisElement = $(this) $.ajax({ url: "https://geolocation-db.com/jsonp","/update_counter/", jsonpCallback: "callback", dataType: "jsonp", success: function(location) { $('#country').html(location.country_name); console.log('success') thisElement.parent().parent().fadeOut(); } }); </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <div>Country: <span id="country"></span></div> Then i tried MaxMind's GeoIP it also didn't work for me. Then i tried THIS BUT they are not connected to any model, so it may be difficult to save user location in DataBase. I don't know what to do. Any help would be appreciated. Thank You in Advance. -
NOT NULL constraint failed: api_student.author_id
I have 10 admin users, and each of them posts 20 posts. There will be 200+ posts in the Student API. I want to show admin only his own 20 posts. When I want to add a student I got IntegrityError. Exception Type: IntegrityError Exception Value: NOT NULL constraint failed: api_student.author_id Terminal ::: django.db.utils.IntegrityError: NOT NULL constraint failed: api_student.author_id Models.py Code = models.CharField(max_length=20, unique = True) fullName = models.CharField(max_length=200, blank = False) banglaName = models.CharField(max_length=200, blank = True) photo = models.ImageField(upload_to='facultyImages/', blank = True) author = models.ForeignKey(User, on_delete= models.CASCADE, default=None, null=True, editable=False) email= models.CharField(max_length=200, blank = True) Admin.py class StudentAdmin(admin.ModelAdmin): def get_queryset(self, request): qs = super(FacultyAdmin, self).get_queryset(request) return qs.filter(author=request.user) admin.site.register(Student, StudentAdmin) -
Django EMAIL ADDREAS field not in human readable form
I'm submitting a form and this is what appears to me on the admin page in the Email Address field: self.__class__.objects.normalize_email(self.email) How can I fix that I`m improving my English, be patient :D -
Realize a group by from a model having multiple foreign keys to the the same column of another table
following situation ModelA(django.db.models.Model): abc = ForeignKey('modelB', related_name="from abc") def = ForeignKey('modelB', related_name="from def") modelB(django.db.models.Model): Is there a way to achieve a GROUP_BY via ModelA.objects.values('some_magic_link_to_Model_B').annotate() instead of ModelA.objects.values('abc', 'def').annotate() (with the consequence to manually construct the result list because its results in grouped results of two keys) or do i have to consider adding a intermedia M2M transition? -
how to change the datetime format in admin panel?
I have an answer model with str method as defined below: class Answer(models.Model): created_at = models.DateTimeField(auto_now_add=True, null=True) def __str__(self): return "(" + str(self.created_at) + ")" I would like to show in this format Feb. 27, 2021, 6:55 p.m in the admin panel but it shows like this in admin panel How can i achieve the above format? Thanks for the help! -
Error while try to go forward or skip the videos in Django
I don't know if the problem is common or anyone faces this problem because I searched but I didn't find any solution for this problem, my problem is when I try to skip or go forward in any video it's didn't work or return me to the 0 s, so I tried a different video player to solve this problem but didn't work so the problem seems to come from Django, I tried to use a different database like Postgres from SQLite and it's didn't also work -
Show thumbnail in __str__ method in admin
I have an Image model where I have typically shown the filename in the __str__ method. I'd like to instead show a thumbnail of the image instead. Here's my model: class Image(models.Model): image = models.ImageField(upload_to='images/') def filename(self): return basename(self.image.name) def __str__(self): return self.filename() -
Initialize Model Class Global Variable At Runtime
I am trying to import student data from xlsx. I have to select column_name of StudentMasterResource class dynamically which is present in xlsx file. I got all column name in constants module has one dictionary which name column_name. When I do it for the first time, it works, then it fails resource.py from common_account import constants def getClassName(key): if key in constants.column_name: return constants.column_name[key] return key class StudentMasterResource(resources.ModelResource): organisation_id = fields.Field(column_name= getClassName('organisation_id'),attribute='organisation_id', widget = widgets.ForeignKeyWidget(OrganisationMaster, 'organisation_name'), saves_null_values=True) name = fields.Field(column_name= getClassName('Name'), attribute='name', saves_null_values=True, widget=widgets.CharWidget()) date_of_birth = fields.Field(column_name= getClassName('date'), attribute='date_of_birth', saves_null_values=True, widget=widgets.DateWidget()) -
Problem with passing dynamic data to Chart.js in Django
i want to use data that i get from an API (numbers) and generate a bar chart with it. This is my views.py : import requests import os import json from django.http import JsonResponse, HttpResponse from django.shortcuts import render def btc(request): query_url = [ 'https://api.blockchair.com/bitcoin/stats', 'https://api.blockchair.com/ethereum/stats', 'https://api.blockchair.com/litecoin/stats' ] headers = { } result = list(requests.get(u, headers=headers) for u in query_url) json_data1 = result[0].json() json_data2 = result[1].json() json_data3 = result[2].json() labels = ["Bitcoin", "Ethereum", "Litecoin"] data = [json_data1['data']['transactions'], json_data2['data']['transactions'], json_data2['data']['transactions']] context = { "labels": labels, "data": data, } return render(request, "index.html", context) and this is in my index.html : <script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js"></script><script> var config = { type: 'pie', data: { datasets: [{ data: {{ data|safe }}, backgroundColor: [ '#ff0000', '#0000ff', '#ff0080', '#73ffff', '#5c26ff', '#002db3', '#ffff26', '#4cff4c', '#ff00ff' ], label: 'Population' }], labels: ["Bitcoin", "Ethereum", "Litecoin"] }, options: { responsive: true } }; window.onload = function() { var ctx = document.getElementById('pie-chart').getContext('2d'); window.myPie = new Chart(ctx, config); }; </script> the problem is in {{ data|safe }} it works perfectly if i use Hardcoded data but when i try calling the data from the views.py i have an error. -
How to authenticate ngrok password automatically using Django and or Python?
I am using ngrok to expose my localhost on a raspberry pi, and ngrok is password protected. I am using Django on another computer outside my network to access a webpage(simple server) on this raspberry pi. I don't want to manually type in the username and password to ngrok. How can I automatically fill in the ngrok user/password? What I've tried: I first tried using JS in my template, just using a fetch request: https://user:password@myngrokdomain.ngrok.io but chrome threw an error in the console saying I can't pass in credentials in plain text like this, rightfully so... I then tried to use my Django view, and python requests: @login_required def cameraTest(request): UN= "myuser" PWD = "mypassword" loginURL = "https://myngrokdomain.ngrok.io" client = requests.session() client.get(loginURL) login_data = dict(username=UN, password=PWD,) header_data = dict(referer = loginURL) r = client.post(loginURL, data=login_data, headers = header_data) return TemplateResponse(request, 'cameraTest.html',) This didn't give an error, but it returned a 401 access denied from ngrok. Is there a simpler way to do this? I feel like javascript is probably the answer but I also can't seem to figure out a way to do it that doesn't involve passwords in plain text in the script. -
Install tailwindcss + svelte with webpack in django
How do we add Tailwindcss with webpack while I have Svelte (or any other js framework) already install with webpack in Django? Note: I want to install with Webpack not with any Django libs. -
Django reverse foreign key values aggregate
I have two models, class UploadedMedia(models.Model): owner = models.ForeignKey(Account, on_delete=models.CASCADE) media_url = models.URLField(blank=True, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Account(AbstractBaseUser, PermissionsMixin): email = models.EmailField( blank=False, unique=True, db_index=True, max_length=255, help_text="Designates the email address and user name of the account.", ) name = models.CharField( blank=True, unique=False, db_index=False, max_length=255, help_text="Designates the full name of the account.", ) I need to show max(created_at) for each record in Account model. Since it is a reverse foreign key I don't understand how can I achieve it. Please advise. -
Unable To Install Simple JWT in my Django Project
Here's my setup right now: Pip Freeze: asgiref==3.3.1 Django==3.0 djangorestframework==3.10.0 djangorestframework-simplejwt==4.6.0 PyJWT==2.0.1 pytz==2021.1 sqlparse==0.4.1 Settings.py from pathlib import Path INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'snippets.apps.SnippetsConfig', ] REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'PAGE_SIZE': 10, 'DEFAULT_AUTHENTICATION_CLASSES': ['rest_framework_simplejwt.authentication.JWTAuthentication',], 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.AllowAny','rest_framework.permissions.IsAuthenticatedOrReadOnly',) } When I run $ python manage.py runserver I get this error ImportError: Could not import 'rest_framework_simplejwt.authentication.JWTAuthentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ModuleNotFoundError: No module named 'rest_framework_simplejwt'. I have tried importing it at the top of settings.py like this import rest_framework_simplejwt and have tried adding it to my installed_apps. Nothing is working. Any help here would be greatly appreciated. Also, I'm following this guide: https://django-rest-framework-simplejwt.readthedocs.io/en/latest/getting_started.html -
Can I add a search box to a Django Admin Add page?
In a Django 3.0 app, I have a Donor Model with a foreign key to the donor's congressional district: # models.py class Donor(models.Model): """A class to represent an individual donor""" name = models.CharField( help_text = "Donor's name" ) district = models.ForeignKey( District, help_text = "Donor's congressional district" ) class District(models.Model): """A class to represent a U.S. congressional district""" dist_name = models.CharField( help_text = "District name" ) In the Admin Add page for Donor, there's a drop-down selection menu for District. The problem is that there are 435 congressional districts in the U.S. That's an awful lot to scroll through each time I add a Donor, so I'd like to add a search box. Django has the ability to define search fields. I tried to do so: # admin.py @admin.register(Donor) class DonorAdmin(admin.ModelAdmin): search_fields = ['district'] This did not affect the Donor Add page. 'District' still shows up as an enormous drop-down, and there are no search features anywhere on the page. The search_fields documentation says specifically Set search_fields to enable a search box on the admin change list page. Emphasis mine: search_fields seems to apply to only the Change List page, not the Add page. I assume this is why my … -
Django Unit Testing: AssertEqual Does not compare PermissionDenied with 403 and Terminates Prematuraly inside get_object()
I'm really hoping you may shed some light on a puzzling situation I am in with my unit testing of my post views. I am basically trying to test different post permissions depending on the user, ex: guest (anonymous), member (registered), and member who are mutually following each other (friends) When I run the unit test, it is erroring on the function that tests if a member (registered user) can view a post that is only meant to be visible to friends (mutually following each other): ====================================================================== ERROR: test_member_user_post_detail_friends_permission (journal.tests.test_views.TestPostDetailView) ---------------------------------------------------------------------- When I follow the line where the exception is taken place, it leads me to my get_object() of PostDetailView class where the testing seems to end prematurely (line marked below): def get_object(self, queryset=None): obj = super(PostDetailView, self).get_object(queryset=queryset) # Logged in user's friends ids (Users who they are following) my_friends = Follower.objects.filter(user_id=self.request.user.id).values( "follow_to" ) # Post owner's friends id (Users who the post owner is following) their_friends = Follower.objects.filter(user_id=obj.user.id).values("follow_to") if obj.permission == "friend": # viewable only by friends or staff/moderators if self.request.user.is_authenticated: if self.request.user.is_staff or self.request.user.is_moderator: return obj if self.request.user.id == obj.user.id: return obj # Check if they are following each other if self.request.user.id in [ i["follow_to"] for i in … -
Sizing Thumbnail using variable height and width in Cloudinary through Django
I have jpegs of paintings. The paintings have certain dimensions: Painting 1: 52cm x 40cm Painting 2: 30cm x 50cm The jpeg of these images may with various widths in pixels in similar dimensions and I have uploaded them into Cloudinary using CloudinaryField in Django. Jpeg of painting 1: 104px x 80px Jpeg of painting 2: 90px x 150px I want to display the thumbnails of these images by translating cm -> px, meaning I was to show the thumbnail in 52px x 40px. How can I use template tags to display them in the new sizes by passing a height and width as a variable, like height = variable height (=52). -
How do I serialize specific field in Django ManyToMany field?
So, I'm trying to use Django Rest Framework for my project. I have two models Category and Content to be serialized, as below: views.py class Category(models.Model): category_name = models.CharField(max_length = 20) def __str__(self): return self.category class Content(models.Model): category = models.ManyToManyField(Category) body = models.TextField(blank=True, null=True) created_at = models.DateField(auto_now_add=True, null=True) def __str__(self): return self.created_at serializers.py class CategorySerializer(serializers.ModelSerializer): class Meta: model = Category fields = ['category_name'] class ContentSerializer(serializers.ModelSerializer): class Meta: model = Content fields = [ 'category', 'body', 'created_at', ] Now the problem is, the JSON object returned has the id of each object in Category, NOT the category_name. So when I console.log in my front-end, I get (for example) [1, 4, 8] but what I need is (for example) ['Wine', 'Beer', 'Whiskey']. How do I make that possible? Thanks in advance :) -
Django keeps using the wrong project settings file
Django keeps trying to use the settings file of a previously deleted project (project-x) when I run python3 manage.py runserver for any newly created project resulting in the error ModuleNotFoundError: No module named 'project-x' when the settings module is initiating. The files/settings in my new project does not reference project-x at all so i'm not sure why this is happening... The error also occurs across different virtual environments. When I manually set the settings module environment variable using export DJANGO_SETTINGS_MODULE=newproject.settings everything works however I would like to find the root problem and fix it. Error File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'project-x' -
Sock file is not creating in my django project with gunicorn
I'm trying to deploy my django project properly with gunicorn. But i'm unable to do that. I'm doing the following process again and again... /etc/systemd/system/gunicorn.service [Unit] Description=gunicorn daemon After=network.target [Service] User=ubuntu Group=www-data WorkingDirectory=/home/ubuntu/dotescrow_main ExecStart=/home/ubuntu/dotescrow_main/dotescrow_env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/ubuntu/dotescro> [Install] WantedBy=multi-user.target then i run following commands in a sequence. sudo systemctl start gunicorn sudo systemctl enable gunicorn sudo systemctl status gunicorn it returns : ● gunicorn.service - gunicorn daemon Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2021-03-13 22:21:36 UTC; 15min ago Main PID: 563946 (gunicorn) Tasks: 4 (limit: 2372) Memory: 100.1M CGroup: /system.slice/gunicorn.service ├─563946 /home/ubuntu/dotescrow_main/dotescrow_env/bin/python /home/ubuntu/dotescrow_main/dotescrow_env/bin/gunicorn> after that when i check sock like in myproject by ls /home/ubuntu/dotescrow_main I dont get any sock file there. after that when i run sudo journalctl -u gunicorn i get following output: Jan 26 18:30:55 ip-172-31-11-244 systemd[1]: Started gunicorn daemon. Jan 26 18:30:55 ip-172-31-11-244 systemd[92397]: gunicorn.service: Failed to determine user credentials: No such process Jan 26 18:30:55 ip-172-31-11-244 systemd[92397]: gunicorn.service: Failed at step USER spawning /home/ubuntu/dotescrow/myprojecte> Jan 26 18:30:55 ip-172-31-11-244 systemd[1]: gunicorn.service: Main process exited, code=exited, status=217/USER Jan 26 18:30:55 ip-172-31-11-244 systemd[1]: gunicorn.service: Failed with result 'exit-code'. -
Django: Reverse for 'login' not found. 'login' is not a valid view function or pattern name
I'm working on my project for a course and I'm totally stuck right now. Login doesn't work. I using class-based views. When I`m logged in, everything works.The Logout View works too. The error is as follows: NoReverseMatch at / Reverse for 'login' not found. 'login' is not a valid view function or pattern name. Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 3.1.6 Exception Type: NoReverseMatch Exception Value: Reverse for 'login' not found. 'login' is not a valid view function or pattern name. Exception Location: /home/aleo/#HOME/.virtualenvs/znajdki/lib/python3.8/site-packages/django/urls/resolvers.py, line 685, in _reverse_with_prefix Python Executable: /home/aleo/#HOME/.virtualenvs/znajdki/bin/python3 Python Version: 3.8.6 My files: poszukiwania/urls.py from django.urls import path from . import views from django.contrib.auth import views as auth_views app_name = 'poszukiwania' urlpatterns=[ path('<slug:kategoria_slug>/', views.rzeczy_list, name='rzeczy_list_by_category'), path('<int:year>/<int:month>/<int:day>/<slug:rzecz_slug>/<int:id>', views.rzecz_detail, name='rzecz_detail'), path('login/', auth_views.LoginView.as_view(), name='login'), path('logout/', auth_views.LogoutView.as_view(), name='logout'), path('', views.rzeczy_list, name='rzeczy_list'), ] znajdki/urls.py from django.contrib import admin from django.urls import path, include from django.conf.urls.static import static from django.conf import settings urlpatterns = [ path('admin/', admin.site.urls), path('', include('poszukiwania.urls', namespace='poszukiwania')) ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.STATIC_URL) settings.py LOGIN_REDIRECT_URL = 'poszukiwania:rzeczy_list' LOGIN_URL = 'login' LOGOUT_URL = 'logout' templates/registration/login.html {% extends "poszukiwania/base.html" %} {% load static %} {% block title %}Logowanie{% endblock %} {% block content %} <h1>Logowanie</h1> {% if form.errors %} <p> … -
Unable to see verify value in DB from template
I'm a newbie at extracting values from the DB via views and templates but all of my attempts have failed so far. I've been looking at this for several hours now. I have the below model in my users app at models.py. This is an additional model to the "main one" with the regular name, email and password for my users. class WorkEmail(models.Model): user = models.ForeignKey(CustomUser, on_delete=models.CASCADE, null=True) work_email = models.EmailField(unique=False, null=True, blank=True) work_email_verified = models.BooleanField(default=False) work_email_active = models.BooleanField(default=False) verified_company_name = models.CharField(max_length=100, null=True, blank=True) company_url = models.URLField(max_length=100, null=True, blank=True) request_datetime = models.DateTimeField(blank=True, null=True, auto_now_add=True, auto_now=False) def __str__(self): return self.work_email I have this UpdateView in views.py that works perfectly (with the exception of being able to see whether the work email has been verified or not, i.e. from the line with work_is_verified, till the end. class UpdateProfileView(UpdateView): form_class = CustomUserChangeForm success_url = reverse_lazy('home') template_name = 'update_profile.html' def get_object(self, queryset=None): return self.request.user def work_is_verified(self, request): if request.work_email_verified==True and request.work_email_active==True: return True else: return False And I have the below, in my update profile template at update_profile.html {% extends 'base.html' %} {% load crispy_forms_tags %} {% block title %}Home{% endblock title %} {% block content %} {% if user.is_authenticated %} <h2>Profile</h2> <form method="post"> … -
What is the most simple way to generate dynamic charts using django?
beginner here ! can you answer my question please ? (my project consists on grabing 3 numeric values from an api (number of cryptocurrencies transactions) and generate a bar/pie chart, each bar to a a cryptocurrency). So, what is the most simple way to generate dynamic charts using django ?