Shivam
Does anyone tell about how to draw pie chart in django
cj
Does anyone tell about how to draw pie chart in django
you can't, that's a front-end task
Bheeshma
How can i edit django admin front-end
Doragonsureiyā
How can i edit django admin front-end
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box write down the same words you asked here Step 4: Read the firsts results
Jesus
how can I try catch stuff in Django? I am using try: except Exception as e: print(e) but it hasnt got any effect
cj
how can I try catch stuff in Django? I am using try: except Exception as e: print(e) but it hasnt got any effect
using try/except should work, maybe you're doing something wrong, show your code
cj
LOL
what is funny? are you banned from using Google?
Jesus
https://pastebin.com/Y66028Ed
Jesus
im trying to save all the errors in the DB while in production
cj
https://pastebin.com/Y66028Ed
task_obj = EssayTemplate.objects.filter( id=taskId, auth_user_id=request.user ) will never raise an exception 🤷🏻‍♂️ unless request.user raises one, but it won't
Jesus
ohh yeah make sense, because itself its actually working, maybe im using that try except in a wrong place
cj
and your code should be: try: task_obj = EssayTemplate.objects.get( id=taskId, auth_user_id=request.user ) except EssayTemplate.DoesNotExist as e: print("==========") print(e)
Jesus
yeahh got it now
cj
or even better, use the get_object_or_404(...) shortcut
Jesus
is there anyway to get the traceback using Exception?
cj
is there anyway to get the traceback using Exception?
and maybe you want to use django-toolbet during development
Jesus
the thing is to save errors during production
Shivam
you can't, that's a front-end task
so any solution for that problem ?
cj
so any solution for that problem ?
first, you don't have any problem, you didn't show anything to be considered a problem. second, I already told you that what you want to do is a front-end thing, nothing related to Django. now go away
Jesus
use a logger then, not print
cool, i got what I wanted! Thank you very muxh
Jesus
much
Jesus
i just found out about Sentry, have anyone used it, is it worth it?
cj
i just found out about Sentry, have anyone used it, is it worth it?
yes it's; on past jobs we used it and is very good
cj
yes it's; on past jobs we used it and is very good
there's a free community version that you can host yourself (we used that) if you don't want to pay for the commercial support
Jesus
yes it's; on past jobs we used it and is very good
it seems quite nice, I dont really wanna re-invent the wheel
Jesus
i had a look to it and apparently that community version is not available. however, there is a developer free version, which is nice to play around with it firstly
Jesus
thank you again
Paul
Hi, using django rest framework, for get_serializer_class trying to send request = self.get_renderer_context().get('request') and check for user permissions with request.user for get_serializer_class raising error NoneType. any suggestions? for get_queryset working fine in docs i saw: def get_serializer_class(self): if self.request.user.is_staff this case also not working
Paul
i've managed by checking inside action method, but wondering maybe someone faced same problem
Anonymous
Please anyone who can help with a way to override django allauth views
Doragonsureiyā
Please anyone who can help with a way to override django allauth views
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box write down the same words you asked here Step 4: Read the firsts results
Paul
i'm using permissions from django.auth.contrib.models standart Permission model.
Sheshadri
You can always override it in your viewset.
Paul
needed to validate if request.user.has_perm and return different serializers
Paul
working fine on querysets, interesting why request.user is None for get_serializer_class
Sheshadri
It says it's only available for genericapiview, are.you using that ?
Paul
Paul
CreateModelMixin provides a .create(request, *args, **kwargs) method and for get_queryset() request.user working fine
Nikhil
from django.db import models class article(models.Model): author = models.ForeignKey('auth.User',on_delete = models.CASCADE) title = models.CharField(mqx_length=100) body = models.TextField() def str(self): return self.title
You may add this field after creating model, so you have to give some default value to the previous records or if this field is not necessary then make this field null and blank
Damron
Hello! Had anyone used amocrm with django? Is it hard?
Doragonsureiyā
Hello! Had anyone used amocrm with django? Is it hard?
Please don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello I need help on $z" Just ask about your problem directly! With 56k+ people the probability that someone will help is pretty high. Also please read: http://catb.org/~esr/faqs/smart-questions.html
Alexandros
I am looking for the django rest framework way to implement creation of related objects in one request
Alexandros
if my json contains the parent object and a list of child objects it will only create the parent object which makes sense
Alexandros
however I would like all objects (parent and related child objects) to be validate and created on the same request
Mirco
I think by sharing your models it will help us to help u
Alexandros
I think by sharing your models it will help us to help u
I'll try to see if I can take summarize only the fields of interest
cj
however I would like all objects (parent and related child objects) to be validate and created on the same request
https://www.django-rest-framework.org/api-guide/serializers/#writable-nested-representations
Alexandros
I'll take a look at this, I think I skimmed over it already but at least now I know this is what I'm looking for
Ghorz
hey guys, I've been off django for a while, sometimes ago, some dudes here ask regularly for CUSTOM USER MODEL AND AUTHENTICATION SYSTEM. I spend today building a django app to solve that. My release Django CustomUser Model is a custom user model integrated with django allauth and bootstrap google-like login/signup template. https://pypi.org/project/Django-CustomUser-Model/ try it out and be sure to report bugs so I can fix them. Thanks.
Alexandros
https://www.django-rest-framework.org/api-guide/serializers/#writable-nested-representations
I think I figured it out, update seems a bit complicated to me but I don't need the nested update functionality so I should be good, thank you
Kushal
Two users which must add by admin Can anyone help me
Anonymous
establish Foriegnkey relationship between employee and owner with on_delete=models.CASCADE. It'll work
Sheshadri
mixins.CreateModelMixin, viewsets.GenericViewSet
Will try and let you know . Even i am working on DRFs , maybe useful for me too
Rushikesh
Hi guys, I am try to verify user email address as soon as he signs up on my account using token authentication in Django. I have created a token and send a mail to user which has a link in it. So I need you help in verifying this link coz this link has the token. Can anyone please help, Thank You in advance
Rushikesh
Hello rishi1, please activate your account here :- http://localhost:8000/Signup/17805f77b9d1ed3f462cec0d32ec1c171cc78a23 Thank You Above is a sample mail send to a user when he signs up
Rushikesh
Now how should I verify his email address ?
Anonymous
Something similar from the projects during the flood?
syam
yes @h4iderAli
Anonymous
yes @h4iderAli
Ill check out the links after electricity is back
Anonymous
hi what's the difference between csrf_token and csrf_exempt?????????
Doragonsureiyā
hi what's the difference between csrf_token and csrf_exempt?????????
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box write down the same words you asked here Step 4: Read the firsts results
R
Please, help me to fix error error: NameError: name 'self' is not defined class-based view: https://pastebin.com/F4Kgfqyz (error throws in 7th line)
Dhruva
How to have uuid and the password for the password reset how can I check ?!
Goutham
Is that possible to create a chained or dependent dropdown list in django rest framework
Piyush
Hey devlopers please help In my code driver details are updating but user details are not updating. here is my code https://pastebin.com/dB5azx1j
Gil
Hey devlopers please help In my code driver details are updating but user details are not updating. here is my code https://pastebin.com/dB5azx1j
Maybe instanciate user = User(), set attribs to user and save, then append to driver.admin, and then drive.save() ?
Mirco
hi what's the difference between csrf_token and csrf_exempt?????????
With exempt decorator for example, you force a view to be accessed without CSRF token check, so do it if it's really needed and you are very sure the request can come only from safe origin, otherwise you are opening doors to attacks