Kareem
Now when you build your project what are the Vulnerabilities you should check for in code level?
There is a command you can run on terminal something like python mange.py check --deploy
Kareem
That tells u a list of the stuff you much check before you deployment also search on internet for more additional information because there is a lot of stuff you may add in the Middleware section as well as if you have cookies or tokens, also testing is a thing too
Abel
HEllo guys how can i connect View with Url
Charly
HEllo guys how can i connect View with Url
Using the urls.py file, if you don't know what's that is because you haven't read the official tutorial do it now.
𝒮𝒽𝒶𝓏
DIY tutorial on how to create a live streaming application using django
Anuj
The MEDIA_URL and STATIC_URL settings must have different values facing this issue
salawu
Is there any api on pypi for advance email sending and auto reply messages in Django project
Kiro
class CinemaSerializer(serializers.ModelSerializer): long = serializers.DecimalField(max_digits=9, decimal_places=6, required=False) lat = serializers.DecimalField(max_digits=9, decimal_places=6, required=False) max_distance = serializers.DecimalField(max_digits=9, decimal_places=6, required=False) class Meta: model = models.Cinema fields = "all" I need to use this serializer in a view in two cases: one where I'm adding a cinema, so I send a post request and I don't include the three declared fields set to required=False, and the other case where I'm getting the cinemas and I need the request to include the 3 fields so I can search based on those
Kiro
Is this the best way to do this?
Kiro
Just thought that, using a get request, I'd embed those fields in the url Does the serializer read data from url?
HOOMAN
__ &_
Doragonsureiyā
all
• Use a backtick (`) on both ends of your single line: print("hello world") • For more lines, use three backticks (```) before the first line, and after the last: def hello(name): print(f"hello {name}") • You can also select text when typing, and select markdown formatting.
ManDo
Hi. I am trying to use Subquery with 2 tables in 2 different databases. But it is not work. I have Tabel1 in database1 and Table2 in database2 My query set: subquery = Table2.objects.filter(field2=OuterRef(‘field1’)).values(‘id’)[:1] mainquery = Table1.objects.annotate(newfield=Subquery(subquery, using=‘database2’)) But the error is: Table ‘database1.model_database1_table1’ does not exist Where is my mistake?
ManDo
Check again. It may be a typo
I hope it is just a typo, but its not. It finds Tabe2 in database1, although I setted “using=‘database2’
Shivani
How to filter data between two dates when 1 I'd store database in many time and send amount but how can I find how much amount is send between two dates
Abhi
How to solve multivaluedictkey error
Kritesh
Hello guys I am really very big prblm for long time please help me any1
Kritesh
I have integrated django as backend and react is frontend together so it will be like if hit my server 127.0.0.1 it will display react page ok
Kritesh
So I am stuck that how would I access react routes so that I can go to rest of pages by django
Duong Chan Troi
can anyone tell me why i cant apply css to separate elements in other html?
Kritesh
can anyone tell me why i cant apply css to separate elements in other html?
I think u need to define '{% load static%}' at top in base template html
Duong Chan Troi
Kritesh
It still works for the elements defined in base.html
I hope in other html page u had define 'extend ./base.html.' at top
Kritesh
{% extend '. /base.html' %}
Duong Chan Troi
Yes. But the individual elements that base.html does not have, it does not apply css
Kritesh
Yes. But the individual elements that base.html does not have, it does not apply css
Look external css only apply when u define link tag with path of css file ok which tht base.html contains if any html page not containg base.html then css won't work check for extend part
Duong Chan Troi
Looks like people are less active
Yug
Sorry I can't help with react
Ukasha
Sorry I can't help with react
I can help you with react
Duong Chan Troi
Why can't I load static when debug is off?
cj
Why can't I load static when debug is off?
because django shouldn't serve static files in production, you should configure your web server to do that task
Duong Chan Troi
Oh
salawu
Why can't I load static when debug is off?
If you are using pythonanywhere you have to add the media url and the static url on the web
Duong Chan Troi
Cant even load css
salawu
Cant even load css
Which site are you hosting your Django project
salawu
Replit
Oh, sorry I know nothing about Replit
Duong Chan Troi
repl.it
salawu
But you can try pythonanywhere, it is free and easy to deploy Django project
Duong Chan Troi
Okay
Suryo Adhy Chandra
hello... i am newbie in django. why i cant use nginx server to serve as a reverse proxy server for django. my static file not loaded. thanks for your help
Suryo Adhy Chandra
Sea
Anyone here know how to do that with the Smart-Selects with the Cities-Light in django
01110010
can anyone tell me why i cant apply css to separate elements in other html?
The easiest way to go around this is to use block tags declare {% block styles %} {% endblock %} in the header of the base.html the. Use it in other HTML that extands base.html; to write and load styles specific to other html template
01110010
Cant even load css
I use WhiteNoise to serve static files Read more here https://whitenoise.readthedocs.io/en/latest/index.html
Thierry
Bjr
mirodil
How to get (Parent) objects by filtering its child model? class TvProgram(TimeStampedModel): name = models.CharField(max_length=512) class TvProgramSchedule(TimeStampedModel): tvprogram = models.ForeignKey( to=TvProgram, on_delete=models.CASCADE ) schedule = models.DateTimeField() I want to get Tvprograms (Parent) which its children's schedules are only for the 7 days, In my case I am getting tvprograms with its all children. Is there a way to retrieve all the Parent objects that are in the filtered querysets?
vishal
Best tutorials for django
Doragonsureiyā
Best tutorials for django
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
ManDo
why is ‘using’ not work when I use it in subquery?
chowmin
How to sent code in this group?
Doragonsureiyā
How to sent code in this group?
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://linkode.org, https://nekobin.com (or your favorite one)
chowmin
https://linkode.org/#oExt3QWNJgPW4iqxiMwq3 The .update() method does not support writable nested fields by default. Write an explicit .update() method for serializer servey_quiz_form.serializers.editresponseserializers.ResponseSerializer, or set read_only=True on nested serializer fields. I'm getting this error
Vadim
Hello, there is a django server, POST requests come to it. How to write them to the database?[18/Apr/2023 12:47:18] "POST / HTTP/1.1" 200 20 [18/Apr/2023 12:47:28] "POST / HTTP/1.1" 200 20 [18/Apr/2023 12:47:38] "POST / HTTP/1.1" 200 20 [18/Apr/2023 12:47:46] "POST / HTTP/1.1" 200 20 [18/Apr/2023 12:47:50] "POST / HTTP/1.1" 200 20
Oxytocin
Hi guys My user group doesnt have permission for post method and the class returns false to view(generics.create apiview), but my user can create object! If you know the reason please help me
Kritesh
I can help you with react
Can you help me with how would I acces reacts routes functional based in django urls
Oxytocin
Hi guys My user group doesnt have permission for post method and the class returns false to view(generics.create apiview), but my user can create object! If you know the reason please help me
I found out that when I try to create an instance, 3 times post method us used 2 times its not allowd but with the third one it is created!!
Anonymous
i have a service in django but i want to create async telegram bot and therefore i want to make my django service async. How can i make this? Use django async or another framework
Vadim
I'm trying to get a POST request, but when outputting to CMD, the following message occurs "TypeError: MultiValueDict.get() missing 1 required positional argument: 'key'", if I specify the "Key" argument, it indicates that the type is NONE. VIEWS itself looks like this: def current_datetime(request): if request.method == 'POST': print("Test text") print(request.POST.get('key')) return HttpResponse('Test text')
Sagar
Can anyone guide me How to save selected data from dropdown in modelselect2widget in form?
Aleh
Can anyone help me What do I have to do to get the admin interface to display properly after DEBUG=False? I already do collect static but still have: [django.request:241] log 9 140677998938952 Not Found: /static/admin/js/nav_sidebar.js
Aleh
yeah. I think I get it. I need to set up web server properly
01110010
Can you help me with how would I acces reacts routes functional based in django urls
If it’s react functional component; inside of ur useEffect function Use Axios to get data from Django url
Asad
Pip install Xhtml2pdf package is not supported on shared hosting, I want to generate and print pdf reports. Any alternative solution?