Thursday, August 29, 2019

Re: confusing about running some codes in django

That code is meant for you to type it in the python console however, you could also include it pretty much anywhere in your code.


On Wednesday, August 28, 2019 at 9:15:20 AM UTC-4, Vahid Asadi wrote:
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/b6b3b24e-b34e-42e6-b637-3e6a30ca2823%40googlegroups.com.

No comments:

Post a Comment