form, that is, set different types of input boxes#set name to text, cls_id as drop-down box classStudentform (Form): Name= fields. Charfield (widget=widgets. Inputtext ()) cls_id= fields. Integerfield (widget =widgets. Select ()) c. Set the contents of the drop-down box choices PropertiesclassStudentform (Form): cls_id=Fields . Integerfield (widget=widgets. Select (choices=models. Classes.objects.values_list ('ID','title')) Note: The value of choices must be a [tuple, (), ()] Type widget
the top layer of not, in the student table notinch(Learn the teacher course student's ID, as well as the group filter out duplicates) # First to find out what the teacher Li Ping taught lessons;--SelectStudent.sid,student.sname fromStudentwhereStudent.sid notinch (
--Selectstudent_id fromscore--wherescore.course_idinch(SelectCid fromCourse left join teacher on Course.teacher_id=teacher.tidwhereTeacher.tname='Mr. Li Ping')
--GROUP by student_id); # - whereGROUP BY has: Advanced
; TD>{{Item.age}}TD> TD>{{Item.email}}TD> TD>{{item.cls_id}}TD> TD> ahref= "/app01/edit_student/nid={{Item.id}}"class= "Glyphicon glyphicon-pencil">Edita>| ahref= "/app01/del_student/nid={{Item.id}}"class= "Glyphicon Glyphicon-trash">Deletea> TD>{#点击删除是一个get请求, to tell the server ID, you can get it through a URL get request, or a URL match to a pass to the
Document directory
CMS
Forum
Debugging
Database Upgrade
Unclassified
Looking for Django resources, the Wiki on the official website is also a good place.
Http://code.djangoproject.com/wiki/DjangoResourcesResources
Django Official Website
Django document
Django step by step was the best getting started tuto
After djangocms is integrated into existing projects, several problems are found:1. the URL matching of the existing project is invalid. The following requests request is sent to djangocms for processing.URL (R' ^ admin/', include (Admin. site. URL (R' ^ requests/', include ('eform. URLs '), URL (R' ^ todolist/', include ('formset _ test. URLs '), URL (R' ^', include ('cms. URLs ')),2. The current project reads the browser language by default. As a re
Advanced content: How to write reusable applications
This article starts at the end of part seventh (en) of the tutorial. We will translate the previously written survey application into a separate Python package that can be reused in new projects and shared with others.
If you have not completed tutorial 1-7, we encourage you to complete them again so that you can match your project with the following tutorial. The problem of reusability
Designing, building, testing, and maintaining WEB applic
http://www.iteye.com/topic/405150
Recently, I've seen the introduction of the Django-related extensions in this section, and one of its extensions writes a post that doesn't feel necessary.
A list of previously collated Django resources that was transferred from my wiki.
The wiki on the official website is also a good place to find Django resources.
Http://code.d
Write a URL in url.py
Be sure to import the view:
From.mysite Import Hellourl (R ' ^hello/$ ', hello), #r表示不转义特殊字符.2. Define a views.py write to the following statementFrom django.http import httpresponsedef Hello (Request): Return HttpResponse ("Hello World")3. Enter Python manage.py runserver access 127.0.0.1:8000/hello/you will see HelloWorld.This article is from the "North Son" blog, please be sure to keep this source http://itbullet.blog.51cto.com/6681459/1882354Django Learning 2
. Similar to the ASPX page. Create a hello.html file first. As follows:
Load the template in the view and assign values to the variables.
Change the view hello_who:
Def hello_who (request ):
T = get_template('hello.html ')
Html = T. Render (context ({'name': 'songjiang '}))
Return httpresponse (HTML)
You can use a function to obtain the template and the rendering function, as shown below:Def hello_who (request ):
Return render_to_response('hello.html ', {'name': 'songjiang '})
To use this
hyperlinks in Django
Destination Address of hyperlink
The href is followed by the destination address
Template can be used {% url ' app_name:url_name ' param%}
App_name: Name of the app namespace
Url_name: Link Name
PARAM: Address Parameters
App_name corresponds to namespace in urls.py in the root directory, url_name corresponds to name in urls.py in the app
re-match URL
Root URLs, written in the second parameter location of the include (), namespa
1, this upload method is done with the admin background, with the database and model to doVim settings.pyMedia_root = '/headimg/' file is saved in the path (and later)# ' Django.middleware.csrf.CsrfViewMiddleware ', ban this, cross the station without problems' Django.contrib.admin ', open this, admin is available' ENGINE ': ' Django.db.backends.sqlite3 ', select Sqlite3 database2. Vim blog/models.pyFrom django.db import ModelsClass User (models. Model):Username = models. Charfield (max_length=3
Enable Administrator features
The Django Administrator feature is not enabled by default-this is an optional option. To enable administrator functionality for your program, you need to do these three things:
1. Add "Django.contrib.admin" to the Installed_apps setting.
2. Run Python manage.py syncdb. When you add a new application to Installed_apps, the database table needs to be manually updated.
3. Edit file mysite/urls.py, uncomment "uncomment t
In the previous chapter we explained how to start a Django project and run a Django serverOf course, this site does not actually do anything------except for the information "It worked" is displayed.In this chapter we describe how to use Django to create dynamic Web pages Your first view: Dynamic content Let's create a Web page that displays the current date an
No web development experience or background. It has basic C language and python syntax. What are the basic requirements for django learning? What is the learning sequence of django? The time was quite short. I made a hand-stretched party that I had always despised. Sorry .. No web development experience or background.
It has basic C language and python syntax.
What are the basic requirements for
The following describes how to use and extend manage commands in the Python Django framework: pythondjango
[Overview]
Django-admin.py is a command line tool for Django to manage tasks. This article describes its general usage.
In addition, there is a manage. py in each Django project. Manage. py is a simple package for
Foreword: With the release of Django1.4 's second candidate, although Python3 is not yet supported, the Django team is already in the process of planning, and according to the official blog, Django1.5 will be experimenting with supporting python3.
Django, as an outstanding Python open source framework, may not get as much praise as other popular frameworks like rails, but it is as refined as any other fram
I. Software preparation:
1.1 python-2.5.1.msi
1.2 apache_2.2.8-win32-x86-no_ssl.msi
1.3 Django-0.96.1.tar.gz
1.4 mod_python-3.3.1.win32-py2.5-Apache2.2.exe
1.5 MySQL-python-1.2.2.win32-py2.5.exe
Ii. installation steps:2.1 install Python (run the python-2.5.1.msi and, after completion, set the environment variable)2.2 mysql-python(run mysql-python-1.2.2.win32-py2.5.exe)2.3 install Apache (run apache_2.2.8-win32-x86-no_ssl.msi)2.4 install the module of
Original: https://automationpanda.com/2017/09/14/django-projects-in-pycharm-community-edition/comment-page-1/Note the section "Creating Run configurations", which describes how to use the Pycharm Community Debug Django ProjectDjango Projects in Pycharm Community Edition JetBrains Pycharm is one of the best Python IDEs around. It ' s smooth and intuitive–a big step up from Atom or notepad++ for big projects.
Before looking at some articles on the web that describe the process of Django processing requests and the Django source structure, it's helpful to find out more about the Django project. So I summed up my own logic to see how the Django Project works and the basic processing process for the request.
One,
1. What's Django?
Django is an advanced Python WEB framework that was originally designed by the Lawrence Publishing Group in Canada to manage the content of its news sites. It encourages rapid development and cleanliness and is responsible for many of the hassles of Web development, so developers can focus on writing applications without having to reinvent the wheel.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.