Posts by JACKSON MOURA • 151 points
7 posts
-
0
votes1
answer21
viewsA: Password field via ajax in Dajngo
Tip: You can hash your password inside your view, and save to the Field you want. from django.contrib.auth.hashers import make_password, check_password hashed_pwd = make_password("plain_text")…
djangoanswered JACKSON MOURA 151 -
0
votes1
answer148
viewsA: Error while trying to create new field in a model in Django
Very hard to say right away what it is, it can be a configuration/permission of your SQL server. If you have any delivery time, I recommend creating the field via SQL, then run a "fake" Migration,…
-
1
votes1
answer70
viewsA: Working with static methods/variables
Do not store values this way. The explanation is complex, but basically Django doesn’t work this way, you can’t write "global" variables or store anything in static classes, this is highly not…
-
1
votes1
answer662
viewsA: 'Nonetype' Object has no attribute 'groups'
Use this way: from django import template register = template.Library() @register.filter(name='has_group') def has_group(user, group_name): return user.groups.filter(name=group_name).exists() In…
-
1
votes1
answer326
viewsA: Pass view parameters to Django form creator
The solution is this same, yes it is a lot of text. However in the abstraction scenario allows greater flexibility. In the case of Modelform you can also use the meta class: from django import forms…
-
1
votes1
answer111
viewsA: Doubt About the logged in user
There is a certain difficulty in accessing instances of request within Forms, there are several tricks to this. Use the Django-globals library, which allows you to access the user and request from…
-
2
votes1
answer67
viewsA: Difference between saving the form directly and creating model instance
From what I understand your Modelform does not contemplate the field evaluated. And you are trying to change it manually, hence the error. That would be right: if request.method == 'POST': local =…