cj
Django has one of the best documentation out there, read it and you'll learn a lot of things
Aditya
I have made the models, created a custom authentication backend for them too, and a singular login view, but where i am stuck is this JWT auth of my models, it's making me rethink the whole design
cj
I have made the models, created a custom authentication backend for them too, and a singular login view, but where i am stuck is this JWT auth of my models, it's making me rethink the whole design
it depends on what library you're using for the JWT part... but in your assignment they don't mention anything about doing an API, isn't it enough to just make it using Django's templates system?
Aditya
Yeah but i get brownie points for using jwt or keycloak 😐
cj
Yeah but i get brownie points for using jwt or keycloak 😐
try with a couples of libraries, if your own auth system works, shouldn't take too much effort to make it work with JWT, as it's a separate layer and only using auth models to authenticate users the management of the token should rely completely in the JWT lib you're using
cj
That's exactly where i am stuck it makes use of auth_user_model but i have multiple so i can't decide
use another lib, most of them should have something to configure in the settings part to tell which model to use and that should be enough
Aditya
Hmm i might be on to something
Данил
Hi all, I'm new to this chat room. I have a problem. I'm trying to create a shopping cart system in my django project, and I'm implementing it based on a django session. There is one problem: when I add an item to the cart, nothing is added to the session dictionary, and it return {} (this I checked to print the session dictionary in the terminal). If you want to help, but you do not have enough information, I'm ready to provide it.
Sebastian
hello community. I have an error loading images in the template on localhost. I'm using django-tenants and the django-tenants media manager
Sebastian
there is really no error just that it doesn't find the image seun the path. I have followed the documentation.
Sebastian
COMPRESS_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_FINDERS = [ "django_tenants.staticfiles.finders.TenantFileSystemFinder", # Must be first "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder", "compressor.finders.CompressorFinder",] MULTITENANT_STATICFILES_DIRS = [ os.path.join(BASE_DIR, "tenants/%s/static"), ]STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles/') STATICFILES_STORAGE = "django_tenants.staticfiles.storage.TenantStaticFilesStorage"MULTITENANT_RELATIVE_STATIC_ROOT = "" MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') MEDIA_URL = '/media/'DEFAULT_FILE_STORAGE = "django_tenants.files.storage.TenantFileSystemStorage" MULTITENANT_RELATIVE_MEDIA_ROOT = ""
Sebastian
and the path: desde la raiz del proyecto: lola_soft/media/forma colombia/perfil/imagen.jpg
Sebastian
and the html tag: {{ employee.image.url }}
Ali
does pythonanywhere support websocket connection?
Pythonero
Sebastian
Nop
Pythonero
Nop
# Image handling DEFAULT_FILE_STORAGE = "django_tenants.files.storage.TenantFileSystemStorage" MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MULTITENANT_RELATIVE_MEDIA_ROOT = "%s/Files"
Pythonero
Sebastian
I think I have the configuration and the path of the files correct. It works because it creates the folder by tenant but does not show the images in the localhost template. I already cleared the cache and I have tried any way and it does not work. Could it be a package problem? or in development the configuration does not work. because static files work normally with django-tenants configuration.
Sebastian
No server deploy. Localhost
Pythonero
No server deploy. Localhost
Could u share the template on pastebin?
Сергей
Hello, everyone! Non-latin (non-ASCII?) mail subject turns into gibberish upon receiving, when using send_mail. As if due to some encoding problem. How can this fixed? Some folks say to add 'u' before subject string to denote unicode, but it's not working.
Сергей
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
I'm still gratefull, bc saying it's not Django-related was a big help for me and I've found the relevant information in 5 minutes😃
M. Hossein
I have two models: Question and Answer Each Question can have many Answer but each Answer is for only one Question Answer has a BooleanField called is_accepted Whenever an instance of Answer is saved, I want to check if is_accepted is True, then set is_accepted False for any other Answer for that Question I have written a signal but whenever call save method on Answer I get RecursionError This is my signal: @receiver(post_save, sender=Answer) def set_accepted_answer(sender, instance, created, **kwargs): if instance.is_accepted == True: question = Question.objects.get(pk=instance.question.pk) answers = question.answer_set.all() for answer in answers: print('setting False for answer', answer.body[:10]) answer.is_accepted = False answer.save()
Tamerlan
how can use this function in websocket
Tamerlan
I use in here StreamingResponse how can i use this response in websocket
Doragonsureiyā
I use in here StreamingResponse how can i use this response in websocket
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://linkode.org, https://nekobin.com (or your favorite one)
Ashish
Hi team I am working on Django framework my credentials are expose from repository, I have created config.ini file where all my credential store what a best approach to secure my credential at repositories as well as production server.pls help me out.
Tamerlan
how can use this function in websocket
https://linkode.org/#qSdspxT0QB1UYCkEaHXNJ7
Sagar
Can anyone guide me How to create different log file for different user in django
.
Please help me!! How to insert data into several models in the same time and one request I have two 2⃣ model A and B, and model A is foreign key to model B. In serializer I have prepared model serializer for each model, what I want is to insert data into both, model B and through B to model A, and insert the foreign key of A to B. (like nested) more I dont know how to do that . Any one guid me how to do it, how to handle the create and update method of multiple models
Anonymous
Hello Does anyone know of a free Django course?
Afshin👀
Hi there why I get this error in django(import django.urls could not be resolved from source)
Doragonsureiyā
Hello Does anyone know of a free Django course?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Charly
Im interested too
the read the same answer the op got
José Jorge
the read the same answer the op got
Do you know about some channel on YouTube to learn Django? (Advanced level)
The Inspired
Hi there why I get this error in django(import django.urls could not be resolved from source)
check your virtual environment. You probably have not activated it
anrays
i need how can deploy django project with channels and nginx? can anyone help me i have a few questions?
Web developer
i need how can deploy django project with channels and nginx? can anyone help me i have a few questions?
You should see deploy "django in ubuntu server" in digital ocean web site
anuprash
Looking for docker tutorial with django rest
Doragonsureiyā
Looking for docker tutorial with django rest
These single steps will help you a lot: Step 1️⃣: Open a browser Step 2️⃣: Write down https://google.com or https://duck.com and press Enter Step 3️⃣: In the search box, write down the same words you asked here Step 4️⃣: Read the first results
x
Hey guys.. I need some help working with Django Guardian I have a model that has field linked to the Django Group model via fk I want to give permission to the groups to only be able to access their corresponding objects from that model (by access I mean to give all CRUD permissions)
Doни
Hello everyone
Doни
NoReverseMatch at / Reverse for 'add_game' not found. 'add_game' is not a valid view function or pattern name.
Doни
What a mistake?
Mirco
What a mistake?
Wrong url patterns If you send your code we can help u quickly Via pastebin.org
Afshin👀
check your virtual environment. You probably have not activated it
I activated the virtual environment but I have the same error
Ab
Can anyone send Group link of Django, to learn from scratch to advanced
Doragonsureiyā
Can anyone send Group link of Django, to learn from scratch to advanced
Check out PythonRes, a channel for Python resources - video courses, pdf books, tutorials and other info to help you learn Python.
M. Hossein
I have a model called Article I want to track changes for Article objects Like 3 days ago admin changed title from A to B 1 year ago admin changed body from X to Y How should I do this? I myself want to use generic relationships so that I can track changes for every object Not only Article
Elvin
https://github.com/yeshwanthlm/django-on-ec2 Hi all . I have published as shown in this file, but now I have made some changes in my github account. How can I update the final version? you can help
The Inspired
I activated the virtual environment but I have the same error
check the interpreter used in that. virtual environment... make sure its the same interpreter that was set up by the environment. Also make sure you have Django installed by typing pip freeze in your active environment
Tim
can i send code here?
Doragonsureiyā
can i send code here?
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://linkode.org, https://nekobin.com (or your favorite one)
Eslam
guys why when i use (docker-compose up) in digitalocean i get ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information. If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).
Muhammadqodir
hi everyone have you ever meet this problem during loading the django from json to postgres: django.db.utils.DataError: Problem installing fixture '/var/www/turon/project/123test.json': Could not load home.AktUnVagon(pk=1): integer out of range I can't fix this issue
Hovhannes
Hi there! I am beginner Please tell me how to implementation permissions(Django Rest) when i have groups of users
King
https://docs.google.com/forms/d/e/1FAIpQLScmHY6lMPchSare3osRdr8mtU_OeMtXk8FtaNLwLM-7oAI4CQ/viewform Please fill this form for internship or Full time/Part time job opportunity.  those candidates looking internship or Full time job at pune location.
David H
Hi there! I am beginner Please tell me how to implementation permissions(Django Rest) when i have groups of users
I estabilished a field Role (homologous to your groups) on my user models and implemented the permission's access as decorators for the endpoints that I preferred
SzymBuram
i have a problem wiht my app, i deployed it to the aws, and now i want to connect the database(sqlite3) which is on the s3 with my app
Hovhannes
Maks
Hi friends I need to make dependent drop dawn list of products with Django, but I know that it only possible to do with Ajax and JavaScript May you tell me where to find how to do that ?
Partha
Hi friends I need to make dependent drop dawn list of products with Django, but I know that it only possible to do with Ajax and JavaScript May you tell me where to find how to do that ?
On the first dropdown create a js function using onchange event, from the onchange event trigger Ajax function to the urls.py, from there do your query based on the changed value which is passed as a parameter, get the response and send back as a response, back to the Ajax call if success you can update the dependent drop-down with the success results using the drop-down's ID.
Maks
Thank you 🙏 May be there is a video in YouTube detailed or some text instructions? Me to understand the way
Nikita
Is anyone knows how to use harshicop vault with django application for password management