Posts by Antonio Cleverson dos santos • 16 points
5 posts
-
0
votes1
answer543
viewsA: Valueerror: Cannot assign "'1'": "User.campus" must be a "Campus" instance. Super User registration error in Django
By the image shown you are trying to save the field id. But Django needs the campus instance (which has the pk). Hence the exception of the type ValueError The right would be something like: campus…
-
0
votes1
answer41
viewsA: Django REST Swagger - Gera 2 GET methods
If the class you are using inherits from Modelviewset automatically these urls will be generated. One solution is to achieve multiple inheritance with others cdrf from rest_framework.mixins import…
-
0
votes4
answers92
viewsA: Field match, referenced in previous field
Django has "signal dispatcher" (Signals) Some signals made available: Django.db.models.signals.pre_delete Django.db.models.signals.post_delete Django.db.models.signals.pre_save…
-
0
votes2
answers661
viewsA: Get Python logged in user ID
The request object of the view, if it is only accessed with an authenticated user, contains the user instance in request.user.
-
0
votes2
answers233
viewsA: Classes within classes (Python/Django)
Notice that the entities: father, mother and candidate have several attributes in common. For code reduction you can use the abstract models of Django. class Pessoa(models.Model): nome =…