Wednesday, August 28, 2019

confusing about running some codes in django

Hi . 
when i read the django docs,it suggested that running some code but it does not note that where to write this piece of code . the code is :

from django.contrib.auth.models import User
u = User.objects.get(username='john')
u.set_password('new password')
u.save()

i know that i can run it in django shell (manage.py shell)
but i want to write these in a file(its some confusing that every code in views.py should return a http response but this type of commands does not return any respone) 
where should i put this code ??
thanks for your attention.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5f90e07-d69e-42e4-ad1f-2a801b3c6114%40googlegroups.com.

No comments:

Post a Comment