djangoproject.com djangoproject.com

Plotly Dash - Pattern Matching Callbacks Not Working Properly

here is some sample code that i have been trying to run from plotly dash's 'pattern matching callbacks examples page'. For the life of me, i cannot see what is wrong - the only error i get in the browser is Syntax Error - unexpected end of JSON input. I can see that the problem only occurs when i try to register the last callback with the pattern matching syntax. If it helps, I am using DjangoDash, so i can integrate dash with Django....

djangoproject.com djangoproject.com

SQL Alchemy connection refused when trying to connect db and web containers

I am having problem when running docker-compose up with my django/postgres app(using sqlalchemy). Everything is fine when just running it localy but when i try to contenerise it(with Docker) I am having an error sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused. Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? For some reason...

djangoproject.com djangoproject.com

Updating a django view with values from a js addin: How to trigger a change event and pass the values back to the view

I've got a form that has a dropdown for selecting the reporting period with the finish always being the current day and start determined by the dropdown selection of week, month, quarter or year. When the period form updates, it has an on change event that submits the form, the page recalculates with the new start date and refreshes. I want to replace this with something more precise and I've got xdsoft's period picker...

djangoproject.com djangoproject.com

Why won't the urls.py file in my Django project let me import this file?

I'm trying to import a function from a file in another directory into my urls.py file. I have included the directory in the settings.py file, ran the ./manage.py makemigrations & the ./manage.py migrate Django commands, and imported the function and the file into the urls.py file. Here is my current code: urls.py: from django.contrib import admin from django.urls import path from apps.accounts.urls import...

djangoproject.com djangoproject.com

Profile() got an unexpected keyword argument 'user'

Hi i working with Django . I'm trying to turn my user into a profile with signals When registering the user through a form I get the following error : TypeError at /Registro/ Profile() got an unexpected keyword argument 'user' and the user is created in 'AUTHENTICATION AND AUTHORIZATION' (ADMIN), but not in profiles. Models.py from django.db import models class Profile(models.Model): id = models.AutoField(primary_key=True) ...

djangoproject.com djangoproject.com

how to take input from form submission and use it to display an entry using django

I'm trying to take the input from a form in Django and to then search storage and display any matches here is the code I have so far. views.py def search(request): input = request.GET.get('q') return render(request, "encyclopedia/search.html", { "entry": util.get_entry(input) == None, "display": util.get_entry(input) }) search.html {% extends "encyclopedia/layout.html" %} {% block title...

djangoproject.com djangoproject.com

How to run django views.function() on everyday midnight 00:00 using scheduler or schedu

## below created scd.py import schedule import time from .views import * # Create your tests here. def job(): views.attendancetemplate() #a= urllib.request.urlopen(url='http://172.16.1.100:8000/tmp', ) ## this is working but still `enter code here` print("I'm working...") schedule.every().day.at("20:23").do(job) while True: schedule.run_pending() ...

djangoproject.com djangoproject.com

Reverse for 'posts' with keyword arguments '{'id': 106}' not found. 1 pattern(s) tried: ['posts/$']

I am building a BlogApp AND Everything is working fine BUT when i return redirect('mains:posts',id=post_id). It is showing me :- Reverse for 'posts' with keyword arguments '{'id': 106}' not found. 1 pattern(s) tried: ['posts/$'] views.py def post_like_dislike(request, post_id): post = get_object_or_404(Post, pk=post_id) # Like if request.GET.get('submit') == 'like': if request.user in...