3👍
✅
If you want to make User
as in active while keeping the UserInformation
object and User
object un-deleted in database, you can do something like this:
def destroy(self, request, *args, **kwargs):
user = self.get_object().user
user.is_active = False
user.save()
return Response(UserInformationUpdateSerializer(self.get_object()).data)
0👍
You have 'is_active': {'read_only': True}}
.
Also,
# this seems redundant
def delete(self, *args, **kwargs):
self.user.delete()
super(UserInformation, self).delete(*args, **kwargs)
👤Özer
- [Django]-Gunicorn, Django, and slow loading code…?
- [Django]-Django Include ManyToManyField on "other" model in ModelForm
- [Django]-Django 1.8 model migrations have dependency to outdated field type
- [Django]-Django does not render after POST request
Source:stackexchange.com