Alex
You should not use CBV
Alex
use simple functions as views
Alex
Why not ?
Because how it is get called.
Alex
I mean in this particular case
Anonymous
thanx
Mirco
Because how it is get called.
https://stackoverflow.com/questions/15149555/how-to-specify-a-custom-404-view-for-django-using-class-based-views Just to remind that CBVs when called with as_view() returns a callable like FBVs are
Dedalus
Hello. Can you tell me where to start learning django? Maybe some books advise? I started to learn video lessons from creating a blog and many questions remain. Thanks in advance for your answers.
Mirco
I cannot check it right now, but I'm not sure if simple .as_view() will be enough
Anyway, totally agree with u that it depends on the use case ☺️
Doragonsureiyā
Hello. Can you tell me where to start learning django? Maybe some books advise? I started to learn video lessons from creating a blog and many questions remain. Thanks in advance for your answers.
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Dhruva
Is there any varchar field in the Django
Dhruva
Is it defined as VarcharField or any other name
Dhruva
Ok thanks
Dhruva
Noreverse match found error
Ghorz
Noreverse match found error
Check your url definitions
Dhruva
path('story', views.media,name='story')
Dhruva
Urls
Dhruva
def media(request) return render(request,'story.html',{title':'media'})
Dhruva
Views
Anonymous
path('story', views.media,name='story')
Is this the only URL you have ? And it is recommended to add slash at the end. `path('story/', .....) Please show us the main URLs.py
Dhruva
And in base file{% url' media' %}
Anonymous
And in base file{% url' media' %}
Then here it is the problem there is no media in the URls.py
Ashutosh
I want to create log out
Ashutosh
And thorough deleting the token
Ashutosh
How should i do that
Ashutosh
Guide me guys
Anonymous
!!
You have to use the story not the media Like {% url 'story' %}
Anonymous
And thorough deleting the token
I really don't understand what u mean by token can u explain if I can help u
Cesar
And thorough deleting the token
Are you talking about DRF?
Ashutosh
It's working with logout(request) function
Ashutosh
But i want to do that with the help of token delete
Cesar
But i want to do that with the help of token delete
https://stackoverflow.com/a/58271997
Anonymous
Hello Guys, how to implement bitcoin payment with django
PV
I want to include two forms in a webpage, how do i impart the backend functionality through Django
Ashutosh
https://stackoverflow.com/a/58271997
class UserLoginViewSet(viewsets.ViewSet): def create(self,request): try: data=request.data email=data.get('email') password=data.get('password') date_of_birth=data.get('date_of_birth') if not all([email,password,date_of_birth]): raise Exception('all fields are mandetory') user=authenticate(username=email,password=password) if user is not None: token=generate_token() user_info=MyUser.objects.get(email=email) data=({ 'email':user_info.email, 'password':user_info.password, #'data_of_birth':user_info.data_of_birth }) return Response({"message": "You are successfully logged in", "user_info":data,"token": token, "success": True},status=status.HTTP_200_OK) else : raise Exception('not authorised') except Exception as error: traceback.print_exc() return Response({"message": str(error), "success": False}, status=status.HTTP_200_OK) def delete(self,request): logout(request) return Response({'successfull':True}) # request.user.token.delete() # return Response({"logout":True},status=status.HTTP_200_OK) #user is logging out ,but i want to do by token delete
Cesar
request.user.auth_token.delete()
Gio
https://medium.com/@BeriaGiorgi/django-translations-working-example-70457372bd72
Batman
Hello all, I tried looking this up but didn't get any info, so I was wondering whether I can use the django shortcut get_object_or_404 with Django Rest Framework
Alex
Hm, nvm
Alex
drf really uses its own util for that
Alex
what's that?
You would not belive https://github.com/encode/django-rest-framework/blob/master/rest_framework/generics.py#L13
Aswath
{% for delegate in delegate_list %} {% set idd = delegate.id %} {{ idd }} {% endfor %}
Aswath
is not working
Aswath
may i know why ?
Aswath
Guys please help me out here
Pedro
Hay guys... I need some help... How I can set profile pictures ? I search in internet but I can't use ... It's not work... I don't know why
Aswath
i am doing this because i wanna referenece it later
Alex
guys help here
What exactly doesnt work?
Alex
Is there an exeption?
Aswath
yes
Aswath
'set', expected 'empty' or 'endfor'. Did you forget to register or load this tag?
Alex
yes
Ah, my personal telepat is still on his vacation
Aswath
is the error
Pedro
!google
Yes I use Google but if I ask something is because I can't find out anything... :)
Alex
'set', expected 'empty' or 'endfor'. Did you forget to register or load this tag?
Just phoned him. He says that probably you are using jinja syntax with but actual template lang is dtl
Aswath
so how do i go about assigning variables in this templating langudage ?
Alex
so how do i go about assigning variables in this templating langudage ?
https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#with
Aswath
i wanna message you personally
Alex
i wanna message you personally
Write in the chat pls
Andrew
hi I tried django-tinymce, django-ckeditor, django-tinymce4-lite, and all of them are doing the same thing. In django admin, inside text editor, everything is ok and i can resize an image(https://pasteboard.co/IS3P9sC.jpg), but on rendered page the image takes the entire width of the parent element(https://pasteboard.co/IS3OU2R.jpg) Maybe i can make some settings, or change the wysiwyg editor to something else?
Khaidem Sandip
Can we directly insert Google adsense text in django admin panel?