Bunty chhatri wala..
How to i add arithmetic captcha in my app.. without using any other apps. I want to create my own random number which will be used for captcha..
Charanjit Singh
You can use random module for this
Charanjit Singh
It is Python inbuilt module
S.H
Can anyone guide me to understand best approach to log frequently generated large log data to mongodb database
Bunty chhatri wala..
You can use random module for this
I tried..but it generates numbet 2 times.. when page is loaded and it gets changed after request.post method..
Rose
Hi, Is anyone willing to study django with me?
âshîsh
Tb10
Hi, I'm getting those messages from uwsgi log, running a django 2.2.17 app: 05 08:28:36 uwsgi[12834]: 228 WARNING log Forbidden: / Feb 05 08:28:36 uwsgi[12834]: [pid: 12852|app: 0|req: 98/1236] 127.0.0.1 () {30 vars in 350 bytes} [Fri Feb 5 08:28:36 2021] GET / => generated 69 bytes in 83 msecs (HTTP/1.0 403) 7 headers in 530 bytes (1 switches on core 0) Feb 05 08:33:36 uwsgi[12834]: 228 WARNING log Forbidden: / Feb 05 08:33:36 uwsgi[12834]: [pid: 12857|app: 0|req: 219/1237] 127.0.0.1 () {30 vars in 350 bytes} [Fri Feb 5 08:33:36 2021] GET / => generated 69 bytes in 96 msecs (HTTP/1.0 403) 7 headers in 544 bytes (1 switches on core 0) This mean someone is trying to access the url?
Kamal
Hello... I'm new on learning django where to start?
Anonymous
Im also new on django ...is someone can help to start ..
Anvesh
Need help. Django test hangs even before entering tests. It takes 5 mins to run one test. And it just times out. And I tried removing database, reinstalling all packages in virtual env. But nothing worked.
Doragonsureiyā
Hello... I'm new on learning django where to start?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
17838
Is anyone have complete Django videos pls guys
Anonymous
Hello everyone
Doragonsureiyā
Hello everyone
Please move your "Hello" and other social talk to @PythonOfftopic.
Khumoyun
Hello, is it possible change object id in Django? or create object with specific id? because when I delete objects from Django admin and when I create new object's id start after deleted object id
ken
hi. among the available packages, which is the minimal for scheduling simple tasks in django?, such as executing some python script every 24 hours
Naol
cron jobs
Naol
for windows there is task scheduler
Akash
I have added 'django.middleware.csrf.CsrfViewMiddleware', to middleware and inherit generics.CreateAPIView in my view (DRF) . But when I make a POST request, it doesn't verify it for CSRF token and returns 200 status The doc states that if you are using generic views you don't need to explicitly verify for CSRF. Why not in this case then ?
Mirco
POST requests comes from Postman/(FE server).
And even on Postman you receive 201 ?
Mirco
200 status
Did you customise the response code ? The Create view should return 201 on successful POST
Mirco
Yes, its explicitly mentioned as 200
Ok so in REST API, it should be 201 for resource created and not 200 But it's not the issue, what kind of authentication did you specify for Django Rest Framework ?
Akash
Ok so in REST API, it should be 201 for resource created and not 200 But it's not the issue, what kind of authentication did you specify for Django Rest Framework ?
`'refs.authentication.JWTAuthentication', 'rest_framework.authentication.TokenAuthentication', ` and I am using CSRF_USE_SESSIONS=True
Mirco
`'refs.authentication.JWTAuthentication', 'rest_framework.authentication.TokenAuthentication', ` and I am using CSRF_USE_SESSIONS=True
It creates something so 201 is the creation success code So basically it expects the Authorization header
Akash
It creates something so 201 is the creation success code So basically it expects the Authorization header
yup, I am using Auth header, thats not a issue I just tried @method_decorator(requires_csrf_token, name='dispatch') on top of my view class, but still no error for CSRF
Akash
yup, I am using Auth header, thats not a issue I just tried @method_decorator(requires_csrf_token, name='dispatch') on top of my view class, but still no error for CSRF
` @method_decorator(csrf_protect, name='dispatch')` This worked. But do I actually need to add it to every view ?
Akash
The main question is when I am using CSRF in middleware then why it doesn't validate without explicit mentioning
Anonymous
round Robin schedule algorithm??
Asmita
Please tell me solution of this error
Asmita
Value error
âshîsh
When the output is infinite or a wrong while loop. You can use value error to prevent it.
âshîsh
Along with try
Asmita
Views.app.signup didn't return httpresponse
Asmita
But I don't use anywhere httpresponse in whole code
âshîsh
Show your view
Akhil
TypeError: __init() missing 1 required positional argument: 'on_delete'
Akhil
How to fix this
Asmita
This is my view
mukul
After form.save Try to send a simple http response
âshîsh
use- form = Registration(request.POST or None)
âshîsh
One more thing, Don't use redirect. It will redirect you to homepage.. refer this code. def SignUp(request): if request.method=="POST": form = Registration(request.POST or None) if form.is_valid(): form.save() return render(request, 'your_html_file_path/file.html', {'form':form})
âshîsh
then in the html file use <form method="POST'> {% csrf_token %} {{form.as_p]} <input type="submit" value="submit"> </form>
^o^
Is there any Django built-in template filter available for default value...for example: {{value l default_if_none:"NA"}} This will show NA if the value is none. I want to show NA if the value is zero.
Tonana
Hi)) Are there people from Prague ?))
Haleem
How to style label using form init method... self.fields['fieldname'].label_classes = ('classone', 'classtwo') In html {{ fieldname.label_tag}} is not working
Charanjit Singh
Instead of styling label in form use load widget_tweaks
Haleem
Very useful library
Actually i am using all the admin styles of admin.. just have to write the classes
Anonymous
I have problem of space between images when I add products in django administration
Anonymous
how can I pass foreign key id in post request in drf?
Charanjit Singh
âshîsh
I have problem of space between images when I add products in django administration
Use split command in views to remove spaces. Check documents.
Haleem
So you are just restyling your admin page..
Actually i have a form in view template... I want it to have same look of admin
Anonymous
How to get most out of documentation of django
Anonymous
Two scoops of django 3 seems to be best book on django
Anonymous
while post request it throws an error user.college must be a college instance how to solve this?
Mike
hello for django anybody knows any tutorial for full project tutorial? thankyou