M
I put the site on hosting, the hosting itself requires all the paths to the static files, but I don’t know the paths to the static files of the admin application, how can I find them?
Qwerty
Zelalem
TypeError at /admin/ 'set' object is not reversible Request Method: GET Request URL: http://localhost:8000/admin/ Django Version: 5.0.2 Exception Type: TypeError Exception Value: 'set' object is not reversible how to fix this error
Devendra
Forbidden (403) CSRF verification failed. Request aborted. Help Reason given for failure: Origin checking failed - https://blogs.dreamerinfotech.in does not match any trusted origins. In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django’s CSRF mechanism has not been used correctly. For POST forms, you need to ensure: Your browser is accepting cookies. The view function passes a request to the template’s render method. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. The form has a valid CSRF token. After logging in in another browser tab or hitting the back button after a login, you may need to reload the page with the form, because the token is rotated after a login. You’re seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed. You can customize this page using the CSRF_FAILURE_VIEW setting.
Qwerty
any solution plz
Add csrf token to your form {% csrf_token %}
Devendra
but this error i facing when try to access admin pannel
Devendra
🌺
Use Mockaroo
Okay thank you
silvio
Hi, I want learn Django for create a professional app. The way it's ready documentation and in the next step create a project?
Whiterose
Guys, I have several forms, Company, Address, Partner, etc... I need to send them to a registration page, I'm managing to do this, but I feel like my code is complex. Do you think using a Wizard system would be more interesting?
Whiterose
What do you use for these cases?
٩ʕ•͡וʔ۶
how do I make an index to search for icontains by model field?
٩ʕ•͡וʔ۶
what?
the model has a name field and needs an index for this field in postgresql
٩ʕ•͡וʔ۶
class Meta: indexes = [field]
this will create a btree index, it will not work with icontains
Qwerty
Rose
User Redhat has 1/3 warnings; be careful! Reason: offtopic and crossposting
Rama Krishna
Hello I need help in running a django project (e voting with face recognition)
Rama Krishna
I already have the code but I'm facing issues while running it
Charly
I already have the code but I'm facing issues while running it
We can't help if you don't say what issues you are facing
Rama Krishna
Production
Rama Krishna
The group isn't letting me add images, could you dm me please
Charly
The group isn't letting me add images, could you dm me please
No, read rule 5 on how to share code and errors here.
Andrew
I want the systems to be built in Django, that's why I'm asking in a Django group
Charly
I want the systems to be built in Django, that's why I'm asking in a Django group
But you are not asking about Django specific things, costs are not specific to the technologies the developer uses
Andrew
Ok, I'm sorry
Eudes Gaël
C:\Users\Fantas\Desktop\ProgrammingKnowledge\monpro>python3 manage.py runserver Python is nie gevind nie; laat loop sonder argumente om vanaf die Microsoft Store te installeer, of deaktiveer hierdie kortpad in Instellings>Bestuur aliasse van toepassinguitvoering.
Eudes Gaël
How can solve this?
Eudes Gaël
I'm trying to view my djang app, but this what I getting as a message.
Eudes Gaël
After typing Python3 manage.py runserver
northern
look at docs.
Rose
User shais has 1/3 warnings; be careful! Reason: nonsense message
Flyest
please i had this error trying to deploy my project with docker. postagram_api | could not connect to server: Address not available postagram_api | Is the server running on host "localhost" (::1) and accepting postagram_api | TCP/IP connections on port 5432? postagram_api | (venv) ubuntu@ip-172-31-46-191:~/volvo-api$ settings.py ___________ DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql_psycopg2", "NAME": "coredb", "USER": "core", "PASSWORD": "wCh29&HE&T83", "HOST": "localhost", "PORT": "5432", } } i have made sure the postgresql.conf has accessible with local,127.... postgresql.conf _______________ listen_addresses = 'localhost,127.0.0.1' port = 5432 max_connections = 100 #superuser_reserved_connections = 3 After doing this i have restarted both the postgres data and the docker-compose.yml file. but issue still persist. this is a django project that am running on aws ec2 instance and i have installed postgres on my instance for my database base but encountering an error
Kevin
How to generate html to pdf in django.
Farman
How to mongodb in settings same as SQL ?
Qwerty
How to mongodb in settings same as SQL ?
``` DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'your-db-name', 'ENFORCE_SCHEMA': False, 'CLIENT': { 'host': 'mongodb+srv://<username>:<password>@<atlas cluster>/<myFirstDatabase>?retryWrites=true&w=majority' } } } ``` It’s optional. U can use mongo engine and connect to your atlas or localhost.
Rose
User Mohamadamin.​.​.​ has 2/3 warnings; be careful! Reason: rule #1: speak English
Ædel
hi, In django rest framework, i'm using update_or_create() based on two fields from my model. check the request, if the values for field1 and field2 already exist, update the instance. if not, create. it works as expected (using postman or the built-in browser app) but when i use it from a TV that constantly requests, it ignores the condition sometimes, and creates two similar objects. (similar in the value of those two fields). how can i debug/solve/investigate this? is this due to race condition? a server problem?
Eudes Gaël
install python and configure your environment variable.
I alreardy have Python installed. I think my environnement is not configure. I'm trying to figure out how I can configure it.
Rose
User saruma🇺🇸 has 1/3 warnings; be careful! Reason: useless messages
-
Hlo anyone help me
Rose
Hlo anyone help me
No one can help you until you explain your difficulties.
Rama Krishna
Specify the problem
-
Only the user who added a post can modify or delete it.
Eng-Mohammed
Only the user who added a post can modify or delete it.
Use filter to filter this object on this user you should have a field how create this obj
.
Only the user who added a post can modify or delete it.
Use UserPassesTestMixin. Anyway, you can’t expect a helpful answer without a helpful question.
Shubhtiwarii
I need on help in authentication token login or signup.
Rose
I need on help in authentication token login or signup.
No one can help you until you explain your difficulties.
Anonymous
I need on help in authentication token login or signup.
What's the issue you're facing?
Shubhtiwarii
I was done the token based authentication api on back-end logic but I am facing issues to use from frontend.
shais
btw why are you setting is_reply ?
Kk
Hello I need some help.😶
Rose
I am facing issues in script tag to send data from frontend.
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain: - what you're doing - what you're expecting - what you're using - where you're running the script - what Python version you're using - what packages and their versions you're using - and the most important thing: show the code YOU wrote (read rule 5️⃣ for that) and more details, that way your chances to get help will increase.
Rose
User Khushboo has 1/3 warnings; be careful! Reason: do not send PMs without the recipient's consent; ask the person in the group first (rule #9)
Kk
I will giving you the full details about the topic why the error is coming I couldn't understand it.
салли
class Product(models.Model): user = models.ForeignKey(get_user_model(), on_delete=models.CASCADE) title = models.CharField(max_length=120) content = models.TextField(blank=True, null=True) price = models.DecimalField(max_digits=15, decimal_places=2, default=99.99) public = models.BooleanField(default=True) quantity = models.IntegerField(default=0) category = models.ManyToManyField(Category, null=True, blank=True, related_name='products') objects = ProductManager() class Sale(models.Model): size = models.DecimalField(max_digits=4, decimal_places=2) end_date = models.DateTimeField(default=datetime.datetime.now() + datetime.timedelta(days=7)) product = models.ForeignKey('Product', on_delete=models.CASCADE, related_name='sale') def __str__(self): return f'Sale for {self.product.title} {self.size}%' Pls guys help. i have this 2 models. How can i fetch queryset of products so that product serializer would not make query for each product to get its sale size
Shubhtiwarii
I think select_related help you.
салли
I think select_related help you.
it says that there are only user field could be selected