Django 2.2.x Documentationprocess Using TemplateResponse and SimpleTemplateResponse Unicode data Creating the database General string handling Models Templates Files Form submission django.urls utility functions reverse() reverse_lazy() include(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included URLconf for further processing. The idea behind include() is to make it easy to this point, it’s worth reviewing what these arguments are for. path() argument: route route is a string that contains a URL pattern. When processing a request, Django starts at the first pattern in urlpatterns0 码力 | 2915 页 | 2.83 MB | 1 年前3
Django 3.0.x Documentationprocess Using TemplateResponse and SimpleTemplateResponse Unicode data Creating the database General string handling Models Templates Files Form submission django.urls utility functions reverse() reverse_lazy() include(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included URLconf for further processing. The idea behind include() is to make it easy to this point, it’s worth reviewing what these arguments are for. path() argument: route route is a string that contains a URL pattern. When processing a request, Django starts at the first pattern in urlpatterns0 码力 | 3085 页 | 2.95 MB | 1 年前3
Django 1.11.x Documentationprocess Using TemplateResponse and SimpleTemplateResponse Unicode data Creating the database General string handling Models The database API Templates Files Email Form submission django.urls utility functions (end-of-string match character) but rather a trailing slash. Whenever Django encounters include(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included data by key name. In this case, request.POST['choice'] returns the ID of the selected choice, as a string. request.POST values are always strings. Note that Django also provides request.GET for accessing0 码力 | 2747 页 | 2.67 MB | 1 年前3
Django 2.1.x Documentationprocess Using TemplateResponse and SimpleTemplateResponse Unicode data Creating the database General string handling Models Templates Files Form submission django.urls utility functions reverse() reverse_lazy() include(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included URLconf for further processing. The idea behind include() is to make it easy to this point, it’s worth reviewing what these arguments are for. path() argument: route route is a string that contains a URL pattern. When processing a request, Django starts at the first pattern in urlpatterns0 码力 | 2790 页 | 2.71 MB | 1 年前3
Django 2.1.x Documentationinclude(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included URLconf for further processing. The idea behind include() is to make it easy to this point, it’s worth reviewing what these arguments are for. path() argument: route route is a string that contains a URL pattern. When processing a request, Django starts at the first pattern in urlpatterns of the URL and sends it as a keyword argument to the view function. The :question_id> part of the string defines the name that will be used to identify the matched pattern, and the0 码力 | 1910 页 | 6.49 MB | 1 年前3
Django 1.11.x Documentation(end-of-string match character) but rather a trailing slash. Whenever Django encounters include(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included data by key name. In this case, request.POST['choice'] returns the ID of the selected choice, as a string. request.POST values are always strings. Note that Django also provides request.GET for accessing view. In this case, using the URLconf we set up in Tutorial 3, this reverse() call will return a string like '/polls/3/results/' where the 3 is the value of question.id. This redirected URL will then0 码力 | 1878 页 | 6.40 MB | 1 年前3
Django 2.0.x Documentationprocess Using TemplateResponse and SimpleTemplateResponse Unicode data Creating the database General string handling Models The database API Templates Files Form submission django.urls utility functions include(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included URLconf for further processing. The idea behind include() is to make it easy to this point, it’s worth reviewing what these arguments are for. path() argument: route route is a string that contains a URL pattern. When processing a request, Django starts at the first pattern in urlpatterns0 码力 | 2746 页 | 2.67 MB | 1 年前3
Django 2.0.x Documentationinclude(), it chops off whatever part of the URL matched up to that point and sends the remaining string to the included URLconf for further processing. The idea behind include() is to make it easy to this point, it’s worth reviewing what these arguments are for. path() argument: route route is a string that contains a URL pattern. When processing a request, Django starts at the first pattern in urlpatterns of the URL and sends it as a keyword argument to the view function. The :question_id> part of the string defines the name that will be used to identify the matched pattern, and the0 码力 | 1880 页 | 6.41 MB | 1 年前3
Django 1.8.x Documentationprocess Using TemplateResponse and SimpleTemplateResponse Unicode data Creating the database General string handling Models The database API Templates Files Email Form submission django.core.urlresolvers installation. Edit the mysite/settings.py file again, and change the INSTALLED_APPS setting to include the string 'polls'. So it’ll look like this: mysite/settings.py INSTALLED_APPS = ( 'django.contrib.admin' __unicode__() and converts the result to a UTF-8 bytestring. This means that unicode(p) will return a Unicode string, and str(p) will return a bytestring, with characters encoded as UTF-8. Python does the opposite:0 码力 | 2454 页 | 2.85 MB | 1 年前3
Django 1.8.x Documentationinstallation. Edit the mysite/settings.py file again, and change the INSTALLED_APPS setting to include the string 'polls'. So it’ll look like this: mysite/settings.py INSTALLED_APPS = ( 'django.contrib.admin' __unicode__() and converts the result to a UTF-8 bytestring. This means that unicode(p) will return a Unicode string, and str(p) will return a bytestring, with characters encoded as UTF-8. Python does the opposite: the name of the method (with underscores replaced with spaces), and that each line contains the string representation of the output. You can improve that by giving that method (in polls/models.py) a0 码力 | 1685 页 | 6.01 MB | 1 年前3共 91 条- 1
- 2
- 3
- 4
- 5
- 6
- 10













