Сашко
i think you need, add default var example. img = models.ImageField(default='img/profile.png', upload_to='profile') Do that and chek
Yes, but this leads me to MEDIA_ROOT. I already wrote about it: `the default attribute leads to MEDIA_ROOT`. So the path and url will be media/img/profile.png, but I need static/img/profile.png
Inu
Please why is my static file not showing in my admin dashboard after I deploy it
Yavar kazemi
Hello friends What is your solution to redirect the user to the Windows application after payment?
Ingvarr
Yo. Can anyone give me some good link where it's talked about how to make docker with django and postgres
cj
Yo. Can anyone give me some good link where it's talked about how to make docker with django and postgres
google.com or duck.com, those are pretty good links where you can find what you're looking for
Singularity Sikesh
Hii connection, I am facing app not yet loaded issue while starting django shell and importing models from an app. Any inout on it is highly appreciated. Thanks
Anonymous
Hi Is there anyone khow how can I make the register with phone number instead of usernam
ask
How can I delete User from user table in drf, using DestroyAPIView it doesn't delete user permanently instead it turned is_active flag to false, how to hard delete??
Jimmies San
How can I delete User from user table in drf, using DestroyAPIView it doesn't delete user permanently instead it turned is_active flag to false, how to hard delete??
if you, literally, write this in google search you will find this link https://stackoverflow.com/questions/48148711/how-to-set-the-destroyapiview-method-not-real-delete-my-instance
Jimmies San
i mean: literally.
Jimmies San
first thing to learn in IT? how to google stuff.
Jimmies San
it's the biggest skill you can get.
Bhavnish
Hi I have migrate the database from MySQL to postgresql in django application. After this django migrations are continuously running in the server. How can I fix this?
Akash
In my django code, a view is calling get_object_or_404() and is returning list, but i want to return it as dict. How to achieve it ?
Akash
Basically in response.context i want a dict, but its coming as list
Akash
result = get_object_or_404 return result [0] smth like this
Bit correction in question. View is returning correct data... But in test class when calling response.context, its coming as list
Akash
So my code has a test that I can't edit, it iterates over response.context keys of a view that returns a blogpost detail. The intention is that view returns dictionary instead of list
Akash
def post_detail(request, post_id):     template = 'posts/post_detail.html'     post = get_object_or_404(Post, pk=post_id)     posts_count = Post.objects.filter(author_id=post.author.id)     context = {         'page_obj': post,         'posts_count': posts_count     }     return render(request, template, context)
Asad Ullah
assalam - o - alaikum! my question is that i have created a project in django but i am now confusing in using function based views or class based views. which is more convenient.
ask
I've added a boolean field to my User model and my project is currently on aws, after adding boolean field on my gitlab deployment my project tests files are throwing error although my tests are not using that newly added field, what could be the reason, any idea pls help!!!
Akash
context_data?
Didn't get your point. Also, ideally response.context is supposed to return Dict right ?
Alexey
Didn't get your point. Also, ideally response.context is supposed to return Dict right ?
response.context_data return dict. it's possible what u want
Akash
response.context_data return dict. it's possible what u want
I actually can't change the call of response.context, i have to make change in view only. I have another view for pagination, its response.context do return dict.
Alexey
I actually can't change the call of response.context, i have to make change in view only. I have another view for pagination, its response.context do return dict.
u dont understand actually from django.test import TestCase, Client # Create your tests here. class AllTests(TestCase): def test_first(self): c = Client() response = c.get('/url/') print(response.context_data)
Annoy
Anyone please help with django with react js
fsociety
hi. how can i create model with secure access key for office? class Office(models.Model): name admin access key (unique)
Rahat
How to implement twillio api and purchase twillio
Annoy
Hey... I need to create a django website using partical js
Mendux
Hey, devs. I'm trying to collectstatic on an Azure container. I believe I have installed all the required dependencies, but on running "collectstatic" I'm getting the following error: from Azure.storage.blob import BlockBlobService, ContentSettings ImportError: cannot import name 'BlockBlobService' from 'azure.storage.blob' (/mnt/data/Documents/projects/django/django_on_azure/venv/lib/python3.8/site-packages/azure/storage/blob/init.py) I'm trying to figure out what's missing but I can't seem to find a workaround.
切腹
Hello, can someone help me? I’ve alredy renamed my app 2 times, but the error is stay python manage.py startapp smoky_app CommandError: 'smoky_app' conflicts with the name of an existing Python module and cannot be used as an app name. Please try another name.
hello
Hello, does anyone have knowledge about Zapier?
Doragonsureiyā
Hello, does anyone have knowledge about Zapier?
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.
Kareem
Is there a Django roadmap?
Charly
Is there a Django roadmap?
Start by the official tutorial, then just projects and projects
Kareem
Start by the official tutorial, then just projects and projects
Okay but is there specific concepts i should learn like in order
𝔸𝟙𝕕𝕪𝕟
Charly
what tutorial?
Official one
𝔸𝟙𝕕𝕪𝕟
I mean documention on the site?
Charly
I mean documention on the site?
In de documentation site there is a tutorial
Anonymous
I am getting value error : not enough value to unapack (expected 2, got 1) Anyone, how do I solve that?
Frazil
lets make a foroum app in django to discuss about django
Frazil
but I cannot track my problems answer or the solutions that I answered
Charly
But whatever just write them down as notes
Charly
It's not like the vbest idea to go to a forum and ask to make another forum for the same thing
Anonymous
hello guys whats mean: class(Meta): abstract=True i'm beginner pls help me.
Anonymous
hello guys whats mean: class(Meta): abstract=True i'm beginner pls help me.
This code creates a class named "Meta" with an attribute "abstract" set to True. In Python, the term 'meta' refers to an object that contains information about other objects. In this case, "Meta" may be a metaclass that is responsible for defining the behavior of other classes. By setting the "abstract" attribute to True, this indicates that the "Meta" class is meant to be used as a blueprint or base class, but it should not be instantiated directly. Instead, other classes can inherit from it and implement their own functionality. Overall, this code snippet suggests that the developer is creating an abstract metaclass, which can be used as a foundation for other classes.
Сэр Финли
hello guys whats mean: class(Meta): abstract=True i'm beginner pls help me.
Django documentation: Abstract base classes are useful when you want to put some common information into a number of other models. You write your base class and put abstract=True in the Meta class. This model will then not be used to create any database table. Instead, when it is used as a base class for other models, its fields will be added to those of the child class. Doc Django https://docs.djangoproject.com/en/4.2/topics/db/models/#abstract base classes "abstract base classes"
Anonymous
Thank you👍
ask
During deployment on gitlab on test instance getting error of database field, I've added a new field in user model but during gitlab deployment getting error, how can we run migrations before deployment on gitlab???
Roshan Rajak
https://dpaste.org/8e0Wf this tasks don't retry for given exceptions
Mr
Okay
kiran
i have uploaded a video through file field but it is unable to move the video manually
kiran
video_file=models.FileField(upload_to="DATA/VIDEOS",default="",null=True)
kiran
<video class="video-fluid" controls> <source src="{{les.video_file.url}}" type="video/mp4"> </video>
Андрей
Hello 👋 Can someone help me with advice? I have some websockets with redis and drf, and I have a question what is the best goal to save connected users, room and other information? May be someone have example? Save this users to database is it good way?
Alexey
The thing is... It is expected for response.context to return dict only !
read docs. context - it context for every template (len templtate = len context)