Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Javscript POST requests being saved to database in different order than sent
I'm sure there is a much more elegant way of writing this JS using a for loop (open to suggestions!). I am attempting to use JS to POST to my django database using django REST. The code below is achieving that, but is not written in order... The user inputs text into 10 different text boxes, then the script writes them to the database. The problem is that when it is written into the database, it is not in the order it was entered on the webpage. It seems to be random. Any ideas why? addAgendaItems.js function saveUpdates(id) { let ai1 = document.getElementById("item1").value let ai2 = document.getElementById("item2").value let ai3 = document.getElementById("item3").value let ai4 = document.getElementById("item4").value let ai5 = document.getElementById("item5").value let ai6 = document.getElementById("item6").value let ai7 = document.getElementById("item7").value let ai8 = document.getElementById("item8").value let ai9 = document.getElementById("item9").value let ai10 = document.getElementById("item10").value if (ai1 != ''){ changeData(id, ai1); } if (ai2 != ''){ changeData(id, ai2); } if (ai3 != ''){ changeData(id, ai3); } if (ai4 != ''){ changeData(id, ai4); } if (ai5 != ''){ changeData(id, ai5); } if (ai6 != ''){ changeData(id, ai6); } if (ai7 != ''){ changeData(id, ai7); } if (ai8 != ''){ changeData(id, ai8); } if (ai9 != ''){ changeData(id, … -
Connecting uwsgi with Nginx does not work
I'm trying to connetc my django app with nginx via uwsgi, but it seems that the passing of data to uwsgi does not happen. I've tested that the uwsgi server is running properly and do not get any log output on either end. uwsgi.ini [uwsgi] module = MyDjangoApp.wsgi:application master = True ;http-socket = :8001 #to run uwsgi on its one to ensure that it works socket = :8001 vacuum = True max-requests = 5000 plugin = python3 enable-threads = True /etc/nginx/sites-available file tree default serverDjango_nginx.conf serverDjango_nginx.conf: # the upstream component nginx needs to connect to upstream django { #server unix:///path/to/your/mysite/mysite.sock; # for a file socket server 127.0.0.1:8001; # for a web port socket (we'll use this first) } # configuration of the server server { # the port your site will be served on listen 8000; # the domain name it will serve for server_name 127.0.0.1; # substitute your machine's IP address or FQDN charset utf-8; # max upload size client_max_body_size 75M; # adjust to taste # Django media # location /media { # location /media { # alias /path/to/your/mysite/media; # your Django project's media files $ # } # location /static { # alias /path/to/your/mysite/static; # your Django project's … -
Django: can't able to import views in urls.py 'from pages import views'
from django.contrib import admin from django.urls import path, include from pages import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.index, name='index'), path('dashboard/', include(pages.urls)), ] I'm trying to import views from pages directory (which is a app in django) like this 'from pages import views' but this isn't working. See the image bellowAs shown in image the when i'm trying to import views from pages it gives me error saying no module pages -
Adding existing sqlite3 database to Django App
Trying to follow this tutorial: https://knivets.com/how-to-integrate-django-with-existing-database/ and this SO: Using existing database in Django My settings.py databases setup: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), }, # existing db I wan't to add 'articles': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'articles.sqlite3'), } } When I run: python manage.py inspectdb --database=articles It does detect and generates a model based on the table I'm interested in. I've added this model to models.py but this table is not reflected when I run python manage.py dbshell It does not appear. In Django /admin the table shows up but breaks when I try to add to it and none of the existing data appears. I appreciate any help ya'll can offer here. -
Django Custom user CustomUserManager won't save my extra data field
I have a issue with my custom user model, I am creating a api with DjangoRestFrameork, django-allauth and Django-restauth and when I create a new user with this Json for exemple to my API { "email": "user@email.com", "first_name": "jack", "last_name": "mister", "password1": "password123", "password2": "password123", "profile_type": "individu", "identite_number": "23ewfwewfwe234234" } it's save Only email and password and not my another field My Django Model : class CustomUser(AbstractUser): username = None email = models.EmailField(_('email address'), unique=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['profile_type', 'identite_number', ] objects = CustomUserManager() GROUPE = 'groupe' ASSOCIATION = 'association' INDIVIDU = 'individu' INDUSTRY = 'industry' USER_PROFILE_CHOICE = [ (GROUPE, 'groupe'), (ASSOCIATION, 'association'), (INDIVIDU, 'individu'), (INDUSTRY, 'industry'), ] identificator = models.CharField(blank=True, null=True, max_length=20) profile_type = models.CharField( max_length=12, choices=USER_PROFILE_CHOICE, default=INDIVIDU, ) identite_number = models.CharField(blank=True, null=True, max_length=20) identity_scan = models.FileField(blank=True) My Django manager class CustomUserManager(BaseUserManager): """ Custom user model manager where email is the unique identifiers for authentication instead of usernames. """ def create_user(self, email, password, **extra_fields): """ Create and save a User with the given email and password. """ if not email: raise ValueError(_('The Email must be set')) email = self.normalize_email(email) user = self.model(email=email, profile_type=extra_fields.get('profile_type'), identite_number=extra_fields.get('identite_number'), **extra_fields) user.set_password(password) user.save() return user def create_superuser(self, email, password, **extra_fields): """ Create and … -
Django 2.2 How to send a static input value to Database
I have created a ModelForm and i have created a Button with a value in html, but i cant send this value to my mssql database. It should send the value on a click on the button, but it does nothing. I want to submit the number 200 to the database in the field 'Bunkernumber' my form: class BunkerForm(ModelForm): class Meta: model = Bunker fields = 'all' (fields are: ID,Bunkernumber, Bunkername) my view: def Bunker_view(request): updatebunk = BunkerForm() if request.method == 'POST': updatebunk = BunkerForm(request.POST) if updatebunk.is_valid(): updatebunk.save() context = {'updatebunk': updatebunk} return render(request, "pages/bunker.html", context) my html: <form action="" method="POST"> {% csrf_token %} <div class="card text-center text-white mb-3" id="bunker1"> <div class="card-header"> <h5 class="card-title">Bunker 1</h5> </div> <div class="card-body"> <div class="col-md-12 text-center"> <input type="submit" class="btn btn-primary btn-lg " name="bunker2000" value="2000"> </div> </div> </div> </form> what can i do to save the value "2000" to my database? -
Django Rest Framework Multi Image Upload
This what my code currently looks so My problem is that when it try to upload multiple images to the API it only resolves one image and the other is never uploaded can anyone tell me why and how and assist me in a way that I can do multiple image uploads -
ModuleNotFoundError: No module named 'django.urls' Django 3.0.4
Whenever I try to run "python manage.py runserver" in cmd terminal of Visual Studio, I get an ModuleNotFoundError: No module named 'django.urls'. Can somebody help me please?! I'm using django 3.0.4 and python 3.8 IN URLS.PY: from django.contrib import admin from django.urls import path urlpatterns = [ django.urls.path('admin/', admin.site.urls), ] -
OperationalError at /admin/Product/product/
could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? I have created django application with three apps.Two of them belong to same database and third app i.e Product belongs to different database.Everything works fine locally but gives this error after deploying the app on heroku.I have deployed single apps with one database before but this is my first time deploying an application with three apps having different database connectivity.Using PostgreSQL as my database. settings.py ALLOWED_HOSTS = ['0.0.0.0', 'localhost', '127.0.0.1','evening-refuge-34732.herokuapp.com'] DATABASE_ROUTERS = ['Product.router.ProductRouter'] DATABASES = { 'default': { 'NAME': 'pg_def', 'ENGINE': 'django.db.backends.postgresql', 'USER': 'postgres', 'PASSWORD': '1234', 'HOST':'localhost' }, 'product_db': { 'NAME': 'product_db', 'ENGINE': 'django.db.backends.postgresql', 'USER': 'postgres', 'PASSWORD': '1234', 'HOST':'localhost' } } import dj_database_url db_from_env = dj_database_url.config(conn_max_age=600) DATABASES['default'].update(db_from_env) -
how to iterate though list of dictionaries in html
i am making a web application with django and i need to make table with few rows and columns. And i need to go though a list with 2 dictionaries and format is on a table in html file. questions = [ { 'description': 'Programming stuff', 'option_names': ['Disagree', 'Not sure', 'Agree'], 'quiz_questions': [ 'I like python', 'I like Java' ] }, { 'description': 'Country stuff', 'option_names': ['Hell no', 'No', 'Don\'t care', 'Yes', 'Hell yes'], 'quiz_questions': [ 'Australia exists', 'My backyard is a sovereign country' ] } ] i got this function that puts 2 list dictionaries in 2 rows def show_questions(request): return render(request, 'questions.html', context={'title': 'Emotion test', 'questions': questions}) i have a guess that i might need just to do some formatting in html file or or adjustments to show_questions function because this function was used for a list with no dictionaries. -
Google Ads Api TransportError exception
I try to develop a tool that uses google ads api aiming to campaign management and reporting for my company using Python. But I get TransportError exception like below Request Method: GET Request URL: http://127.0.0.1:8000/anasayfa/ Django Version: 3.0.4 Python Version: 3.8.0 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'musteri_bolumu'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback (most recent call last): File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\transport\http.py", line 67, in open return self.u2open(u2request) File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\transport\http.py", line 132, in u2open return url.open(u2request, timeout=tm) File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 531, in open response = meth(req, response) File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 640, in http_response response = self.parent.error( File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 569, in error return self._call_chain(*args) File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 502, in _call_chain result = func(*args) File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) During handling of the above exception (HTTP Error 404: Not Found), another exception occurred: File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\exception.py", line 34, in inner response = get_response(request) File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\contrib\auth\decorators.py", line 21, in _wrapped_view return view_func(request, *args, **kwargs) File "D:\projeler\google_adwords\musteri_bolumu\views.py", line 46, in anasayfa campaign_service = client.GetService('CampaignService') File "C:\Users\A.Orbey\AppData\Local\Programs\Python\Python38-32\lib\site-packages\googleads\adwords.py", line 303, in GetService client = … -
Shopping Cart total price problem in Django
Hi I'm trying to develop an online store website using Django and I don't know why, but my price counter is not working. It was working all fine before I added some pagination, and now it's not adding all the values.Can anyone please help me out? My views.py: def cart(request): cart = Cart.objects.all()[0] context = {"cart":cart} template = 'shopping_cart/cart.html' return render(request, template, context) def add_to_cart(request, slug): cart = Cart.objects.all()[0] try: product = Product.objects.get(slug=slug) except Product.DoesNotExist: pass except: pass if not product in cart.products.all(): cart.products.add(product) messages.success(request, mark_safe("Product added to cart. Go to <a href='cart/'>cart</a>")) return redirect('myshop-home') else: cart.products.remove(product) messages.success(request, mark_safe("Product removed from cart")) new_total = 0.00 for item in cart.products.all(): new_total += float(item.price) cart.total = new_total cart.save() return HttpResponseRedirect(reverse('cart')) My index.html(where I added pagination): {% extends 'base.html' %} {% block content %} <h1>Products</h1> <div class="container-md"> <div class="row"> {% for product in products %} <div class="col"> <div class="card-deck" style="width: 18rem;"> <img src="{{ product.image_url }}" class="card-img-top" alt="..."> <div class="card-body"> <a class="card-title text-dark" href="{% url 'detail-view' product.slug %}">{{ product.name }}</a> <p class="card-text">${{ product.price }}</p> {% if not product.cart_set.exists %} <a href="{% url 'add-to-cart' product.slug %}" class="btn btn-dark">Add to Cart</a> {% else %} <a href="{% url 'add-to-cart' product.slug %}" class="btn btn-dark">Remove from Cart</a> {% endif … -
Copying only data from model tables to new database
I have recently upgraded my django from 1.11 -> 3.0 and my python from 2.7 -> 3.6. During this process, I lost the abiltiy to use makemigrations and squashing without throwing an error about one of the previous migrations (of which i don't know which one is causing it.) During this process, I provisioned a new database and did a direct copy from the previous version using Heroku's CLI. I have data in the tables I still need and don't want to manually try to reinsert to a fresh database. To circumvent the issues with migrating, I deleted all of the migration files and did a new makemigrations call. It succeeded. The issue is now my migration status in my copied database don't match the migration numbers in the migration files, therefore cannot be executed via migrate. So the question is this: Is there a way to provision a blank database, apply the migrations, then copy only the data from the model tables into the new database; or Change the migration numbers in the copied database so they don't interfere with the updated number of migrations in the directory? -
How to remove ROWS column on django-rest-pandas
I have a django-rest-pandas viewset that exports an excel and csv, which works great, but I cant get rid of the rows column... here is my code if someone can help: from rest_pandas import PandasViewSet class FilteredCoursesView(PandasViewSet): queryset = models.XYZ.objects.all() serializer_class = serializers.CourseSerializer def filter_queryset(self, qs): qs = qs[:10] return qs def transform_dataframe(self, dataframe): columns = ['subject','begin_dt','name','description','department'] df = dataframe[columns] return df Here is my output: row,subject,begin_dt,name,description,department 0,TECH,2020-03-21,A,1A,2222 1,ABC,1900-01-01,ABC,Special AAA,AAA 2,ABC,1900-01-01,FCCC,TR,JJJJ -
Sending tokens out on coinpayments success payment using Web3py
I'm writing Django app and want to send out tokens using Web3 once Coinpayments sends me callback about successfull payment. The problem is that Coinpayments sends multiple callbacks at once and just in one case tokens are sending, other callbacks get replacement transaction underpriced error. I've already tried to use solutions like add +1 to nonce or remove this parameter, but that doesn't help me because transactions are still building with the same nonce. How can that be fixed or what am I doing wrong? class CoinpaymentsIPNPaymentView(BaseCoinpaymentsIPNView): def post(self, request, order_id, *args, **kwargs): status = int(request.POST.get('status')) order = Order.objects.get(id=order_id) order.status = request.POST.get("status_text") if not status >= 100: order.save() return JsonResponse({"status": status}) amount = Decimal(request.POST.get('amount1')) record = Record.objects.create( user=order.user, type='i', amount=amount, ) order.record = record order.save() gold_record = GoldRecord.objects.get(from_record=record) contract = w3.eth.contract(address=CONTRACT_ADDRESS, abi=ABI_JSON) transaction = contract.functions.transfer(order.user.wallet.address, int(gold_record.amount * 10 ** 18)).buildTransaction({ 'chainId': 1, 'gas': 70000, 'nonce': w3.eth.getTransactionCount(WALLET_ADDRESS) # address where all tokens are stored }) signed_tx = w3.eth.account.signTransaction(transaction, WALLET_PRIVATE_KEY) # signing with wallet's above private key tx_hash = w3.eth.sendRawTransaction(signed_tx.rawTransaction) print(tx_hash.hex()) tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash) return JsonResponse({"status": status}) P.S. I've already asked it on Ethereum StackExchange, but nobody answered or commented it: https://ethereum.stackexchange.com/questions/80961/sending-tokens-out-on-coinpayments-success-payment-using-web3py -
User is not logging in despite login() being called in Django
I am new to Django and I'm trying to implement a custom backend called PlayerBackend that is meant to be separate from the default Backend Django provides. Here is my view: def login_player(request): if request.method == 'POST': form = LoginForm(request.POST) if form.is_valid(): email = form.cleaned_data['email'] password = form.cleaned_data['password'] user = authenticate(request, email=email, password=password) if user is not None: pdb.set_trace() login(request, user) messages.success(request, "Successfully logged in!") else: messages.error(request, "Credentials were invalid") else: form = LoginForm() return render(request, 'users/login.html', {'form': form}) The success message is being displayed, but when I try to check if the user is authenticated... def view_player(request, player_id): return HttpResponse(request.user.is_authenticated) I get False. I did not extend the AbstractUser class and just added the last_login fields. Here is my model: class Player(models.Model): first_name = models.CharField(max_length=50, validators=[validators.RegexValidator(regex='^[A-Za-z]+$', message="Names can only contain letters")]) last_name = models.CharField(max_length=50, validators=[validators.RegexValidator(regex='^[A-Za-z]+$', message="Names can only contain letters")]) password = models.CharField(max_length=255) email = models.CharField(max_length=50, unique=True, validators=[validators.validate_email]) registered_date = models.DateTimeField(auto_now_add=True) last_login = models.DateTimeField() is_authenticated = False backend = None def __str__(self): return self.first_name + " " + self.last_name Am I required to do what the documentation says and specify a custom model, extend the abstract model, etc? I want to have both a login for admins and players. … -
Is there a way in Python to make an array with two elements in it and make it as a single index in a dictionary?
I just want to make the elements as one index. For example, array = ['a', 'b'] to array_of_dict = [{a,b}] -
ListFields not generating the right data output
I am new to Django, and I'm trying to generate a list of strings using my model and serializer. Model changes : ABC = ListTextField(max_length=64, base_field=models.CharField(max_length=32, blank=True, default=''),blank=True) Serializer code : class Test(serializers.Serializer): class Meta: fields = (ABC) associated_brands = fields.ListField( child=fields.CharField(max_length=64), max_length=64, allow_empty=True, required=False ) the output from the API get a response that I get us : {'ABC': ['15']} But when it print the drf.data {'ABC': ['1','5']} Any guidance as to what I'm doing wrong? -
Cannot access Django administrator site
Successfully created an admin user using py manage.py createsuperuser. Entered username, e-mail, password but whenever I try to access this link http://127.0.0.1:8000/admin/ it says "This site can’t be reached" and "127.0.0.1 refused to connect, " How do I fix this error and access the administrator site ? I'm using Windows 10 with the latest version of Django. -
Expression contains mixed types: SmallIntegerField, BigIntegerField. You must set output_field
i create a model in django i want to set monthly_wage as monthly_wage=working_days*daily_wage in annotation from django.db.models import F class AnnotationManager(models.Manager): def __init__(self, **kwargs): super().__init__() self.annotations = kwargs def get_queryset(self): return super().get_queryset().annotate(**self.annotations) class DetailsList(models.Model): month_list=models.ForeignKey('MonthList',on_delete=models.CASCADE,verbose_name='لیست ماهانه ') worker=models.ForeignKey('Workers',on_delete=models.CASCADE,verbose_name=' نام کارگر') working_days=models.SmallIntegerField('تعداد روز کارکرد') daily_wage=models.BigIntegerField('دستمزد روزانه') advantage=models.BigIntegerField('مزایای ماهانه') _monthly_wage=0 objects = AnnotationManager( monthly_wage=F('working_days') * F('daily_wage') ) but because working_days is smallinteger and daily_wage is biginteger this error raise: Expression contains mixed types: SmallIntegerField, BigIntegerField. You must set output_field. how can i fix this -
DJANGO: CustomUser model doesn't create objects
I have created a CustomUser model and it has a one to relationship with my two other models. ''' class User(AbstractUser): is_learner = models.BooleanField(default=False) is_teacher = models.BooleanField(default=False) class Teacher(models.Model): #teacher_name = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, primary_key=True) class Learner(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, primary_key=True) ''' They do not show up when I try to create learner and teacher objects in their respective databases, as shown: ''' class LearnerSignUpForm(UserCreationForm): email = forms.EmailField() class Meta(UserCreationForm.Meta): #User = CustomUser model = CustomUser fields = ["username", "email", "password1", "password2"] #fields = UserCreationForm.Meta.fields + ("username", "email", "password1", "password2") @transaction.atomic def save(self, *args, **kwargs): user = super().save(commit=False) user.is_learner = True user.save() learner = Learner.objects.create(user=user) return user ''' How do I get it to save in learner and teacher tables respectively? -
Django forms CheckboxSelectMultiple
Im trying to change a form from RadioSelect to MultipleChoice with this form, I can see and the form in my tempalte as RadioButtons and can fill and save. class TestForm(forms.Form): def __init__(self, question, *args, **kwargs): super(TestForm, self).__init__(*args, **kwargs) choice_list = [x for x in question.get_answers_list()] self.fields["answers"] = forms.ChoiceField(choices=choice_list, widget=RadioSelect) But, when I change to widget=CheckboxSelectMultiple Then I can see and select all Choices, but after saving the page is reloading without saving. class TestTake(FormView): form_class = TestForm template_name = 'question.html' result_template_name = 'result.html' single_complete_template_name = 'single_complete.html' def dispatch(self, request, *args, **kwargs): self.quiz = get_object_or_404(Quiz, url=self.kwargs['quiz_name']) if self.quiz.draft and not request.user.has_perm('quiz.change_quiz'): raise PermissionDenied if self.logged_in_user: self.sitting = Sitting.objects.user_sitting(request.user, self.quiz) else: self.sitting = self.anon_load_sitting() if self.sitting is False: return render(request, self.single_complete_template_name) return super(TestTake, self).dispatch(request, *args, **kwargs) How can I insert a Multiple Select checkbox here? -
In Django, filter a query set for two datetimes being within one day
I have a Django model like: from django.db import models class Person(models.Model): # ... last_login = models.DateTimeField(null=True, blank=True) date_created = models.DateTimeField(auto_now_add=True) I want to find all Persons where last_login is within one day of date_created. So far I have: from datetime import timedelta from django.db.models import F Person.objects.annotate( duration=F("last_login") - F("date_created") ).filter(duration__lte=timedelta(days=1)) But the tail end of the error when I do that is like: File ".../lib/python3.7/site-packages/django/db/models/fields/__init__.py", line 1316, in to_python parsed = parse_datetime(value) File ".../lib/python3.7/site-packages/django/utils/dateparse.py", line 107, in parse_datetime match = datetime_re.match(value) TypeError: expected string or bytes-like object I'm not sure what I'm doing wrong, probably with that timedelta(days=1). Also (and I don't think this is the immediate error), I'm not sure if that query will take account of the fact that last_login could be None. -
My heroku website looks empty and no html files are rendering
I was trying to deploy my django website to heroku. Basically I have done everything step by step and no errors in deploying as well. But there is nothing in my webpage just a side panel is showing nothing else. No navigation bars, no buttons, no html renderings ... nothing. But when I viewed the source code the html codes are there. I can access different urls as well but nothing renders in the webpage its weird really. The website works perfectly in localhost but not in heroku. I need a fix for this, thanks. Here is how the webpage looks right now, enter image description here -
Edit Session Variable in Javascript/JQuery
I have a session variable in my Django views: request.session['count'] = 0 I can access this variable in Javascript and log it to the console easily, but I'm wondering what the best way is to pass an updated version of the variable back to the views? I'd ideally like to edit the value in the Javascript of the HTML template and then have the updated value passed back to the Django view so that it could be called something like so: count=request.body['count'] print(count) I am able to pass the variable via the URL parameters but I am looking for a way to pass the value without modifying the URL if possible. Thanks in advance!