【发布时间】:2017-05-03 10:41:58
【问题描述】:
我正在编写一个程序来编辑学生详细信息(而不是作为管理员)。我必须使用不同的 def 来保存包含用户名的变量。在第一个中,我试图获取用户名,而在另一个实际应用编辑功能的 def 中。但它需要包含用户名的变量。如何从第一个中调用变量?对不起,奇怪的措辞。我不知道该怎么说:P 谢谢!
def get_username(request):
#the code to open up a input fields that gets the username
username = input
def edit_student(request):
#the code to open up a pre populated form with the instance of the same student which i get from get_username()
【问题讨论】:
-
get_username 是 django 视图或只是函数描述函数中的详细信息
-
这是 django 视图。
标签: django python-2.7 django-forms django-views