CN109960503A - Component development method and device based on Django framework - Google Patents
Component development method and device based on Django framework Download PDFInfo
- Publication number
- CN109960503A CN109960503A CN201711432439.1A CN201711432439A CN109960503A CN 109960503 A CN109960503 A CN 109960503A CN 201711432439 A CN201711432439 A CN 201711432439A CN 109960503 A CN109960503 A CN 109960503A
- Authority
- CN
- China
- Prior art keywords
- view
- function
- class
- multiple inheritance
- reconstruct
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 88
- 238000011161 development Methods 0.000 title claims abstract description 48
- 238000012795 verification Methods 0.000 claims abstract description 55
- 230000006870 function Effects 0.000 claims description 205
- 238000012217 deletion Methods 0.000 claims description 14
- 230000037430 deletion Effects 0.000 claims description 14
- 238000005538 encapsulation Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 34
- 230000018109 developmental process Effects 0.000 description 30
- 238000013475 authorization Methods 0.000 description 11
- 238000012545 processing Methods 0.000 description 9
- 230000000694 effects Effects 0.000 description 3
- 235000008429 bread Nutrition 0.000 description 2
- 235000012813 breadcrumbs Nutrition 0.000 description 2
- 239000012141 concentrate Substances 0.000 description 2
- 238000009877 rendering Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000008140 language development Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/34—Graphical or visual programming
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/72—Code refactoring
Abstract
A component development method and device based on a Django framework are disclosed. The component development method comprises the following steps: encapsulating at least one multiple inheritance class for realizing a predetermined function in at least one view in a business logic layer of the Django framework to generate at least one reconstructed view; implementing a function corresponding to the at least one reconstructed view based on the at least one reconstructed view, wherein the at least one multiple inherited class includes a multiple inherited class for implementing a login function and a multiple inherited class for implementing a permission verification function, and wherein the implementing step includes: and calling the generated at least one reconstructed view to realize a login function, an authority verification function and a function corresponding to the at least one view.
Description
Technical field
The present invention relates to field of software development, more particularly, to a kind of Components Development method based on Django frame
And device.
Background technique
Django frame is a kind of common Web Development Framework, because it can easy, quickly exploitation database-driven net
It stands and is widely used.However, many Django projects mostly use and write single module view functions to be responsible for processing business at present,
It is however, writing the problem of single module view functions carry out processing business, even some simple config options or function,
It needs user individually to write corresponding function when needed and realizes that this allows them much to be limited in practical application, and
Size of code is increased, and subsequent expansion is poor.For this purpose, proposing needing to locate using setting single entry function in the prior art
When managing data, single entry function is called, and ask by the data processing that the single entry function receives the control parameter for carrying transmitting
It asks, then according to the corresponding functional control module of the selection of control parameter.Then, by the functional control module of selection, according to
The control parameter is managed operation to management class function, obtains operating result, is finally generated according to the operating result corresponding
Processing result data, and the processing result data is returned to user by the single entry function.However, such operation needs to use
Simultaneously functional control module and management module is separately provided in family setting single entry function, this will lead to function and excessively concentrates, although one
Determine to reduce duplicated code in degree, but operates inflexible, subsequent poor expandability.
In addition, in current enterprise-level web exploitation, although in order to achieve the purpose that quickly to develop, using CBV (class
Based view, class-based view) mode developed and development efficiency promoted, but realize web frame
Often understand in frame life cycle referent check, create, updating, deleting etc. be required to individually to write before functions for realizing
The code of the functions such as login, Authority Verification executes corresponding behaviour to ensure user in the case where logging in and having corresponding authority
Make, this not only adds additional size of code, reduce development efficiency, and be unfavorable for the unified pipe of web frame life cycle
Reason.
In consideration of it, being required to be more easier project development, reduces size of code and raising scalability and project are opened
The development approach and device of the unified management of enterprise-level web frame life cycle are realized in the case where sending out efficiency.
Summary of the invention
According to an aspect of the present invention, a kind of project development method based on Django frame is provided, the project is opened
Forwarding method include: by for realizing at least one multiple inheritance class wrapper of predetermined function Django frame Business Logic
In at least one view in, with generate at least one reconstruct view;Based on it is described at least one reconstruct view realization with it is described
At least one reconstruct corresponding function of view, wherein at least one described multiple inheritance class includes for realizing function is logged in
Can multiple inheritance class and multiple inheritance class for realizing Authority Verification function, wherein realize that step includes: to call to generate
At least one described reconstruct view realizes login function, Authority Verification function and function corresponding at least one described view
Energy.
According to another aspect of the present invention, a kind of project development device based on Django frame, the project are provided
Development device can include: reconstruct view generation module will exist for realizing at least one multiple inheritance class wrapper of predetermined function
In at least one view in the Business Logic of Django frame, to generate at least one reconstruct view;It realizes module, is based on
At least one described reconstruct view realization with it is described at least one reconstruct the corresponding function of view, wherein it is described that at least one is more
Derived class includes the multiple inheritance class for realizing login function and the multiple inheritance class for realizing Authority Verification function, reality again
Existing module calls at least one the described reconstruct view realization login function generated, Authority Verification function and with described at least one
A corresponding function of view.
According to another aspect of the present invention, a kind of computer readable storage medium is provided.The computer-readable storage medium
Matter is stored with the program instruction for making processor execute method as described above when being executed by a processor.
According to another aspect of the present invention, a kind of computing device is provided.The computing device includes processor and memory.
Wherein, memory is stored with the program instruction for making processor execute method as described above when being executed by a processor.
According to the project development method and apparatus, by the way that login function and Authority Verification function are written as multiple inheritance
Class, and the view being encapsulated in the Business Logic of Django frame reconstructs view, and based on the view of reconstruct come real
Now corresponding function, so that without individually writing many function codes when realizing function corresponding with view to realize every time
It logs in and Authority Verification to not only reduce size of code greatly reduces development difficulty, and can be realized web frame
Uniform permission administration.In addition, at least one the multiple inheritance class either write, or the reconstruct view generated, it is following
It is directly used for developer, perhaps can also add or inherit again as needed other classes or can also modify existing multiple
Derived class is to meet the needs of under different scenes, to improve the scalability of development efficiency and code.
Detailed description of the invention
In order to illustrate more clearly of embodiments herein, below by attached drawing needed in the description to embodiment
It is briefly described, however, the accompanying drawings in the following description is only embodiments herein, for those of ordinary skill in the art
For, without creative efforts, other attached drawings can also be obtained according to the attached drawing of offer.
Fig. 1 is the schematic diagram for showing the MTV model of the prior art;
Fig. 2 is the process for showing the Components Development method based on Django frame of an exemplary embodiment of the present invention
Figure;
Fig. 3 is the multiple inheritance for realizing login function write for showing an exemplary embodiment of the present invention
(Mixin) the code schematic diagram of class;
Fig. 4 be show an exemplary embodiment of the present invention write for realizing the multiple of Authority Verification function
The code schematic diagram of derived class;
Fig. 5 be show an exemplary embodiment of the present invention write for realizing the more of crumbs navigation feature
The code schematic diagram of weight derived class;
Fig. 6 and Fig. 7 is the frame of the list common view pattern for the reconstruct that an exemplary embodiment of the present invention is shown respectively
Schematic diagram and code schematic diagram;
Fig. 8 is the code schematic diagram realized based on function for showing the function of list object for showing the prior art;
Fig. 9 and Figure 10 is the frame of the details common view pattern for the reconstruct that an exemplary embodiment of the present invention is shown respectively
Schematic diagram and code schematic diagram;
Figure 11 and Figure 12 is the frame of the creation common view pattern for the reconstruct that an exemplary embodiment of the present invention is shown respectively
Frame schematic diagram and code schematic diagram;
Figure 13 and Figure 14 is the frame of the update common view pattern for the reconstruct that an exemplary embodiment of the present invention is shown respectively
Frame schematic diagram and code schematic diagram;
Figure 15 and Figure 16 is the frame of the deletion common view pattern for the reconstruct that an exemplary embodiment of the present invention is shown respectively
Frame schematic diagram and code schematic diagram;
Figure 17 be an exemplary embodiment of the present invention is shown object is shown based on the list common view pattern of reconstruct
The code schematic diagram of the example view of list;
Figure 18 be an exemplary embodiment of the present invention is shown object is checked based on the details common view pattern of reconstruct
The code schematic diagram of the example view of details;
Figure 19 be an exemplary embodiment of the present invention is shown object is created based on the creation common view pattern of reconstruct
Example view code schematic diagram;
Figure 20 is to show the update common view pattern based on reconstruct of an exemplary embodiment of the present invention come upgating object
Example view code schematic diagram;
Figure 21 be an exemplary embodiment of the present invention is shown object is deleted based on the deletion common view pattern of reconstruct
Example view code schematic diagram;
Figure 22 is the code schematic diagram for showing the list of an exemplary embodiment of the present invention;
Figure 23 is the block diagram for showing the Components Development device according to an exemplary embodiment of the present invention based on Django frame.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on
Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall in the protection scope of this application.
To facilitate the understanding of the present invention, here first to part term used in the present invention and related to these terms
Knowledge be explained and illustrated.Django frame is the enterprise web application frame of the open source of python language development, so
Django is also referred to as MTV frame.Fig. 1 is the schematic diagram for showing the MTV model of the prior art.In MTV frame, M represents mould
Type (Model), i.e. data access layer, this layer processing all affairs associated with the data, for example, how accessing, how having verified
Effect etc..T represents template (Template), that is, presentation layer, relevant to the performance decision of layer processing, for example, how in the page or
It is shown in other types document.V represents view (View), that is, Business Logic, the layer include Access Model and transfer just
When the interrelated logic of template, the bridge that is seen as between model and template.In addition, ORM indicates relationship object mapping, use
In the table structure according to class automatically generated data library.URL routing handles http request for searching corresponding View.In reality
In, when Web browser receives request, Django finds corresponding diagram by URL routing to handle the request, has
Body, View calls corresponding Model to come from ORM storing data, and calls corresponding Template to user's displayed page.This
Invention emphasis improves the Business Logic (also referred to as View layers) in Django frame.Hereinafter, will be referring specifically to
Exemplary embodiment of the present invention is described in detail in Fig. 2 to Figure 16.
Fig. 2 is the process for showing the Components Development method according to an exemplary embodiment of the present invention based on Django frame
Figure.
Referring to Fig. 2, in step S210, by for realizing at least one multiple inheritance class wrapper of predetermined function in Django
In at least one view in the Business Logic of frame, to generate at least one reconstruct view.It here, will be for realizing predetermined
At least one multiple inheritance class wrapper of function is at least one view in the Business Logic of Django frame to generate
At least one reconstruct view shows that the reconstruct view generated inherits described at least one multiple inheritance class and described at least one
A view.Accoding to exemplary embodiment, at least one described multiple inheritance class can be encoded before encapsulation.Specifically, user
Some complexity or common functions or operations can be written as suitable multiple inheritance (Mixin) class according to actual needs, from
And all need not in addition write corresponding code when needing to realize the operation or function every time, but can be directly using preparatory
The multiple inheritance class write realizes corresponding function by being encapsulated in the view of needs.For example, being based on
Django Development of Framework Web application whole life cycle in, display list object, check object details, creation object,
In the operation such as upgating object or deletion object, it is required to whether verifying user logs in, and execute Authority Verification after the user logs
To judge whether user has the permission for executing corresponding operating, and usually need to carry out data navigation and rope in aforesaid operations
Draw (that is, crumbs navigation).Therefore, if login function, Authority Verification function and crumbs navigation feature are written as multiple
Derived class, and being encapsulated in the view in Business Logic, then be convenient to call view realization object to show, object
It checks, call encapsulation multiple inheritance class in the view to log in realize automatically when Object Creation, object update or object is deleted
Function, Authority Verification function and crumbs navigation feature, without individually writing in each view for realizing above-mentioned function
Code.
Accoding to exemplary embodiment, at least one described multiple inheritance class may include for realizing login function it is multiple after
Hold class and the multiple inheritance class for realizing Authority Verification function.In addition, accoding to exemplary embodiment, described at least one is multiple
The multiple inheritance class that derived class may also include for realizing crumbs navigation feature.However, it will be clear to someone skilled in the art that
The multiple inheritance class that can be write is not limited to above-mentioned example, but can be according to project needs or user's actual needs to some common works
The multiple inheritance class that energy or operation are write to form suitable multiple inheritance class, and write can be stored in order to facilitate subsequent
Exploitation uses.For convenience of description, the multiple inheritance for realizing login function is only symbolically described referring to Fig. 3 to Fig. 5
Class, the multiple inheritance class for realizing Authority Verification function and the multiple inheritance class for realizing crumbs navigation feature.
Fig. 3 is the multiple inheritance for realizing login function write for showing an exemplary embodiment of the present invention
(Mixin) the code schematic diagram of class.Accoding to exemplary embodiment, it can be written as realizing the multiple inheritance class of login function
Pass through the included object class of succession Django frame and calls the login_required method in Django frame to realize
Login function.Specifically, it when code is realized, can will be named as realizing the multiple inheritance class of login function
LoginRequiredMixin.The side as_view is realized by inheriting object class referring to Fig. 3, LoginRequiredMixin
Method calls the as_view method of parent to return to a View using super, passes to Django's for View as parameter
Login_required method is logged in, and default page is jumped to if being not logged in.Those skilled in the art should be clear
It is that either the naming method for realizing the multiple inheritance class of login function is still specifically write for realizing login function
The mode of multiple inheritance class be not limited to the exemplary codes in Fig. 3, but different code implementations can be used, as long as
So that the multiple inheritance class write out can be realized login function.
Fig. 4 be show an exemplary embodiment of the present invention write for realizing the multiple of Authority Verification function
The code schematic diagram of derived class.Accoding to exemplary embodiment, it is written as realizing the multiple inheritance class of Authority Verification function
Pass through the included ContextMixin class of succession Django frame and rewrites the dispatch method in Django frame to realize
Authority Verification function.Specifically, it when code is realized, can will be named as realizing the multiple inheritance class of Authority Verification function
PermissionForbiddenView.PermissionForbiddenView inherits ContextMixin class, and defines two
A default property is for judging user right and redirection.In addition, rewritable dispatch method to be to verify user right, and
By the request parameter in dispatch method, request.user.has_perm method, general _ permission_ are called
The value of attr is verified as its parameter.In addition, settable default property _ permission_attr=None and _
Forbidden_url_=" forbidden_view ", if this attribute of no couple _ permission_attr in service view
Covering, then be redirected to _ forbidden_url default view.Those skilled in the art it should be clear that either for realizing
The naming method of the multiple inheritance class of Authority Verification function still specifically write for realizing Authority Verification function it is multiple after
The mode for holding class is not limited to exemplary codes in Fig. 4, but different code implementations can be used, as long as to write
Multiple inheritance class out can be realized Authority Verification function.
Fig. 5 be show an exemplary embodiment of the present invention write for realizing the more of crumbs navigation feature
The code schematic diagram of weight derived class.Accoding to exemplary embodiment, it is compiled for realizing the multiple inheritance class of crumbs navigation feature
It is written as by inheriting the included ContextMixin class of Django frame and rewriteeing the get_context_ in Django frame
Data method realizes crumbs navigation feature.It specifically, can will be for realizing crumbs navigation feature when code is realized
Multiple inheritance class is named as BreadcrumbMixin.The ContextMixin class of BreadcrumbMixin succession Django.This
Outside, get_context_data method is rewritten, get_paginator_full_path additional to the request object of HTTP belongs to
Property, and using the get_context_data method of super calling parent, utilize model to obtain the verbose_ in mete
Name, for navigation index to be arranged.All get_ for calling parent in utilization super based on the view of BreadcrumbMixin
A dictionary can be all obtained when context_data method, wherein including breadcrumbs variable, be used for Bootstrap bread
Bits navigation.Those skilled in the art are it should be clear that either for realizing the life of the multiple inheritance class of crumbs navigation feature
The mode that name mode still specifically writes the multiple inheritance class for realizing crumbs navigation feature is not limited to showing in Fig. 5
Example property code, but different code implementations can be used, as long as the multiple inheritance class write out is made to can be realized bread
Consider navigation feature to be worth doing.
In the above examples, at least one described multiple inheritance class is the multiple inheritance class quilt carried based on Django frame
It writes, at this point, at least one described view can be class-based view.However, the invention is not limited thereto, described at least one
A multiple inheritance class can also be encoded based entirely on function, rather than be compiled based on the multiple inheritance class that Django frame carries
It writes, at this point, at least one described view can be the view based on function.
Referring back to Fig. 2, accoding to exemplary embodiment, in step S210, at least one described view can be following
At least one common view pattern in common view pattern: for showing the list common view pattern of list object, for checking object details
Details common view pattern, the creation common view pattern for creating object, for the update common view pattern of upgating object, for deleting
The deletion common view pattern of object.However, the view that can encapsulate at least one multiple inheritance class is not limited to above example, but can wrap
Include in any one of View layers views, if user expectation realize the view function when also wishes realize and it is described extremely
A few corresponding function of multiple inheritance class.Accoding to exemplary embodiment, at least one reconstruct described in being generated in step S210
View inherits at least one described multiple inheritance class and at least one described common view pattern, thus, the weight of generation can be passed through
Structure view is (for example, the list common view pattern of reconstruct, details common view pattern, creation common view pattern, update common view pattern and deletion are logical
With view) not only realize function corresponding at least one described multiple inheritance class, but also realize and at least one described view
Scheme corresponding function.Accoding to exemplary embodiment, will be for realizing the multiple inheritance class of login function and for realizing permission
It, can in the case that the multiple inheritance class wrapper of authentication function is at least one view in the Business Logic of Django frame
Pass through the reconstruct view realization login function of generation, Authority Verification function and function corresponding at least one described view.
It accoding to exemplary embodiment, can be by successively inheriting the multiple inheritance class for realizing login function, being used in fact in step S210
The multiple inheritance class of existing Authority Verification function, for realizing crumbs navigation feature multiple inheritance class and it is described at least one
Common view pattern simultaneously rewrites get_context_data method, generates at least one described reconstruct view.In addition, if it is described at least
One common view pattern includes creation common view pattern or updates common view pattern, then in the process for generating at least one reconstruct view
In, list can be configured in template corresponding at least one reconstruct view described in generation, in creation object or update pair
As when show the field in list and field format turned into bootstrap label.
For convenience of description, hereinafter, only symbolically describe to give birth in step S210 by encapsulation referring to Fig. 6 to Figure 10
At the list common view pattern of reconstruct, details common view pattern, creation common view pattern, update common view pattern and delete common view pattern.
Fig. 6 is the block schematic illustration of the list common view pattern for the reconstruct for showing an exemplary embodiment of the present invention.Root
According to exemplary embodiment, the list common view pattern of reconstruct can be named as GuideListView, however, naming method is not limited to
This.As shown in fig. 6, list common view pattern GuideListView can inherit LoginRequiredMixin,
The included ListView of PermissionForbiddenView, BreadcrumbMixin and Django frame, according to succession
Relationship, the sequence successively called be then LoginRequiredMixin, PermissionForbiddenView,
BreadcrumbMixin and ListView.In addition, two-page separation function can be customized according to business demand, specifically, as long as in the view
It is middle setting paginator_class attribute can (AutoPaginator be oneself realize paging class), if be not provided with
Paginator_class attribute, then the default paging that will be used in ListView.In addition, rewriteeing the side get_context_data
Method calls the get_context_data method of parent using super to realize the display of list object.ListView mono-
View built in Django convenient for showing table data, and fast implements paging displaying, and the function of realizing is from database
Data are read, and construct the context that be passed to template.In Fig. 6 other View (for example, View, ListView,
BaseListView) or other classes (for example, object and ContextMixin) are views or base class built in Django, this
Field technical staff understands its function, and which is not described herein again.Specifically, GuideListView can be written as shown in Figure 7
Code, however, this is only example.
In the following, comparing the size of code of the list common view pattern of reconstruct by example and to be based on function in the prior art direct
Write the size of code for the class for realizing that list object is shown.For example, user, which usually needs to obtain, to be stored in when developing a website
The list of some Model in database then needs to write for example as shown in Figure 8 if it is the function is realized based on function
Code, it is clear that and in the case where equally realizing the function, size of code as shown in Figure 7 is considerably less than code shown in Fig. 8
Amount.It can be seen that by the way that at least one multiple inheritance class wrapper at least one view in Business Logic, is being realized
At least one the multiple inheritance class that in the case where said function, can obviously reduce size of code, and either write, or reconstruct
Common view pattern future can directly for developer use or can add or inherit again as needed other classes, to improve
The scalability of development efficiency and code.
Fig. 9 is the block schematic illustration of the details common view pattern for the reconstruct for showing an exemplary embodiment of the present invention.Root
According to exemplary embodiment, the details common view pattern of reconstruct can be named as GuideListView, however, naming method is not limited to
This.As shown in figure 9, details common view pattern GuideDetailView can inherit LoginRequiredMixin,
PermissionForbiddenView, BreadcrumbMixin and Django included DetailView is closed according to inheriting
System, the sequence successively called be then LoginRequiredMixin, PermissionForbiddenView,
BreadcrumbMixin and DetailView.In addition, rewritable get_context_data method, calls parent using super
Get_context_data method, get_context_data method is in all built-in class-based views of Django
There is use, is used to provide context Context data for the rendering of template.Context [' page_name'] will be provided
To template, for showing page title.In Fig. 9 other View (for example, View, DetailView,
BaseDetailView) or other classes (for example, object and ContextMixin) are views or base class built in Django,
Those skilled in the art understand its function, and which is not described herein again.Specifically, GuideDetailView can for example be written as
Code shown in Fig. 10, however, this is only example.
Figure 11 is the block schematic illustration of the creation common view pattern for the reconstruct for showing an exemplary embodiment of the present invention.Root
According to exemplary embodiment, the creation common view pattern of reconstruct can be named as GuideCreateView, however, naming method is unlimited
In this.As shown in figure 11, creation common view pattern GuideCreateView can inherit LoginRequiredMixin,
The CreateView of PermissionForbiddenView, BreadcrumbMixin and Django.In addition, can be according to reality
It needs that GuideCreateView is made to inherit SuccessMessageMixin to return success message when creating object success, and
And the get_success_message method of rewritable SuccessMessageMixin, by success_message attribute weight
New assignment is at the desired value of user.According to inheritance, the sequence that GuideCreateView is successively called be can be
LoginRequiredMixin、PermissionForbiddenView、BreadcrumbMixin、
SuccessMessageMixin and CreateView.Introduction was carried out to get_context_data method above, here not
It repeats again.The template_name in 1, GuideCreateView can be used for being arranged default template, success_ referring to Fig.1
Message is used to be arranged prompt information template when Object Creation success.Continue_to_add_url continues newly for being arranged
Increase the URL of view.In Figure 11 other View (for example, View, CreateView, BaseCreateView,
ProcessFormView) or other classes (for example, object, ContextMixin and SuccessMessageMixin) are
View or base class built in Django, those skilled in the art understand its function, and which is not described herein again.Specifically,
GuideCreateView can be written as code as shown in figure 12, however, this is only example.In addition, according to exemplary implementation
Example,, can be corresponding in the creation common view pattern to reconstruct in the generation step S210 of Fig. 2 for the creation common view pattern of reconstruct
Template in configure Form list, to show the field field in list when creating object and be formatted into field field
Bootstrap label.It is as follows to implement code:
Figure 22 is the code schematic diagram for showing the Form list of an exemplary embodiment of the present invention.It can be by the table of configuration
Singly it is named as PostForm, wherein in the list, clean method is used to verify the form data of user's submission, and can root
Form is shown according to model, fields, widgets attribute set in Meta.Here, the attribute of widgets corresponds to one
HTMLForm input element is mainly used for HTML rendering.
Figure 13 is the block schematic illustration of the update common view pattern for the reconstruct for showing an exemplary embodiment of the present invention.Root
According to exemplary embodiment, the update common view pattern of reconstruct can be named as GuideUpdateView, however, naming method is unlimited
In this.As shown in figure 13, the update common view pattern GuideUpdateView of reconstruct can inherit LoginRequiredMixin,
The UpdateView of PermissionForbiddenView, BreadcrumbMixin and Django.In addition, can also basis
It needs to inherit SuccessMessageMixin.According to inheritance, the sequence successively called be can be
LoginRequiredMixin、PermissionForbiddenView、BreadcrumbMixin、
SuccessMessageMixin and UpdateView.It is similar with the template template of GuideCreateView, template_
Name can be used for being arranged default template, and success_message is used to be arranged prompt information template when Object Creation success.Figure
Other View (for example, View, UpdateView, BaseUpdateView and ProcessFormView) or other classes in 13
(for example, object, ContextMixin and SuccessMessageMixin) is the view or base class built in Django, this
Field technical staff understands its function, and which is not described herein again.Specifically, GuideUpdateView can be written as such as Figure 14
Shown in code, however, this is only example.In addition, accoding to exemplary embodiment, for the update common view pattern of reconstruct, in Fig. 2
Generation step S210 in, Form list can also be configured in the corresponding template of update common view pattern with reconstruct, to create
The field field in list is shown when object and field field is formatted into bootstrap label.Above referring to figure
Form list is described in 11 and Figure 22, and which is not described herein again.
Figure 15 is the block schematic illustration of the deletion common view pattern for the reconstruct for showing an exemplary embodiment of the present invention.Root
According to exemplary embodiment, the deletion common view pattern of reconstruct can be named as GuideDeleteView, however, naming method is unlimited
In this.As shown in figure 15, GuideDeleteView inherit LoginRequiredMixin,
PermissionForbiddenView, BreadcrumbMixin and Django included DeleteView.In addition, can also
The included SuccessMessageMixin of Django is inherited as needed.According to inheritance, the sequence successively called be can be
LoginRequiredMixin、PermissionForbiddenView、BreadcrumbMixin、
SuccessMessageMixin and DeleteView.In Figure 15 other View (for example, View, DeleteView,
BaseDeleteView and BaseDetailView) or other classes (for example, object, ContextMixin,
SuccessMessageMixin and DeletionMixin) it is view or class built in Django, those skilled in the art are equal
Understand its function, which is not described herein again.Specifically, GuideDeleteView can be written as code as shown in figure 16, so
And this is only example.
The multiple inheritance class write has been illustratively described referring to Fig. 3 to Figure 16 above and has sealed multiple inheritance class
At least one reconstruct view generated at least one view in View layers.
Referring back now to Fig. 2.After step S210 generates at least one reconstruct view, in step S220, it can be based on
At least one described reconstruct view realization function corresponding at least one described reconstruct view.Specifically, it is incited somebody to action in step S210
Multiple inheritance class for realizing login function and the multiple inheritance class wrapper for realizing Authority Verification function are in Django frame
In the case where at least one view in the Business Logic of frame, at least one weight described in generation can be called in step S220
Structure view come realize login function, Authority Verification function and at least one described corresponding function of reconstruct view.According to showing
Example property embodiment, function corresponding at least one described reconstruct view may include that at least one multiple inheritance class is respectively realized
Predetermined function and function corresponding at least one described view.As an example, predetermined function may include login function, permission
At least one of authentication function and crumbs navigation feature, but not limited to this.It is corresponding at least one view in View layers
Function may include list object display function, object details look facility, Object Creation function, object more new function and right
As deleting at least one of function, but not limited to this.As described above, at least one the described reconstruct view generated inherits institute
State at least one multiple inheritance class and at least one described common view pattern.Therefore, can by successively call it is described at least one
At least one described multiple inheritance class for being inherited of reconstruct view and at least one described common view pattern come realize with it is described extremely
A few corresponding function of reconstruct view.Accoding to exemplary embodiment, it in step S220, can call first for realizing function is logged in
Can multiple inheritance class whether log in determining user and execute login function in the case where determining that user is not logged in.Then,
If user has logged in, the multiple inheritance class for realizing Authority Verification function is called to execute Authority Verification, if permission
It is proved to be successful, then at least one described view is called to execute function corresponding at least one described view.It can concentrate as a result, logical
It crosses for realizing the multiple inheritance class of login function and controls institute for realizing the multiple inheritance class of Authority Verification function to manage
Some logins and authorization check operation, so as to realize the uniform permission administration of web frame.
Above with reference to described in step S210, if at least one described common view pattern includes creation common view pattern or updates logical
With view, then need to configure list in template corresponding at least one reconstruct view described in generation, in creation object
Or the field in list is shown when upgating object and field format is turned into bootstrap label.Therefore, if described at least one
A common view pattern includes creation common view pattern or updates common view pattern, then is calling at least one reconstruct view described in generation
When realizing login function, Authority Verification function and function corresponding at least one described view, it can be needed from list
Field to be shown simultaneously dynamically renders bootstrap label, and to guide, user carries out Object Creation or object updates.
Hereinafter, referring to Fig.1 7 to Figure 20 respectively with the reconstruct view of generation be reconstruct list common view pattern, details it is general
It is real that the reconstruct view based on generation is introduced for view, creation common view pattern, update common view pattern and deletion common view pattern
Now function corresponding with the reconstruct view of generation.
Figure 17 be an exemplary embodiment of the present invention is shown object is shown based on the list common view pattern of reconstruct
The code schematic diagram of the example view of list.As shown in figure 17, the view write inherits the above general view of list reconstructed
Scheme GuideListView, the sequence successively called can be LoginRequiredMixin,
PermissionForbiddenView, BreadcrumbMixin and ListView.Specifically, whether user can be verified first
It logs in.If not logged in, then login page view will be automatically redirected to.If logined successfully, it is by verification active user
The no permission for possessing magic.view_post, if the not permission, is automatically redirected to specified page.If passed through
Authorization check will then call the get_queryset method rewritten, obtain the list of model to show list object.It can root
The code of oneself is constructed according to service logic, it might even be possible to not rewrite get_queryset method, it is only necessary to specify a model
Attribute and templeate_name attribute.ListView needs to render by specified template_name attribute come specified
Template, and context_object_name be to get_queryset method return model list rename, because
Title for the model list of default return is object_list, for readability, can pass through context_object_
Name is reassigned, for example, here designated as post_list.Label as { { } } can be used to wrap in template file
Template variable is wrapped up in, these variables are exactly that view by context is transmitted to template.In get_context_data method
Some context variables of default are added in super (PostList, self) .get_context_data (* * kwargs) sentence
Context object, it is seen that breadcrumb variable joined context object by assignment method, then view helps me again
Context is passed to template, so as to its subsequent processing.Here, the urls.py file of application can add following URL pattern:
Figure 18 be an exemplary embodiment of the present invention is shown object is checked based on the details common view pattern of reconstruct
The code schematic diagram of the example view of details.As shown in figure 18, which inherits the above general view of details reconstructed
Scheme GuideDetailView, and the sequence successively called can be LoginRequiredMixin,
PermissionForbiddenView, BreadcrumbMixin and CreateView.Specifically, it can verify and whether step on first
Land.If not logged in, then login page view will be automatically redirected to facilitate user to log in.If logined successfully,
Whether verification active user is then possessed to the permission of magic.add_post.If the not permission is automatically redirected to refer to
Determine the page.If authorization check passes through, object details are checked by the get_context_data method rewritten is called.It can also
Get_context_data method is not rewritten, it is only necessary to a specified model attribute and _ permission_attr attribute.
The view it is expected the Major key that entitled " pk " is captured from URL, and pk major key is needed to be associated with the major key in database to obtain number
According to.The urls.py file of application can add following URL pattern:
Here, (? P<pk>d+) be regular expression grouping, be equivalent to a dictionary, key=pk, value=d+,
Then this parameter is transmitted to corresponding function in View.
In addition, the following hyperlink that acquisition details can be arranged in post_list.html list template is detailed to obtain content
Feelings:
Figure 19 be an exemplary embodiment of the present invention is shown object is created based on the creation common view pattern of reconstruct
Example view code schematic diagram.As shown in figure 19, which inherits the above creation common view pattern reconstructed
GuideCreateView, the sequence successively called can be LoginRequiredMixin,
PermissionForbiddenView, BreadcrumbMixin and CreateView.Specifically, it verifies and whether has stepped on first
Land.If not logged in, then login page view will be automatically redirected to.If logined successfully, whether active user is verified
Possess the permission of magic.add_post.If verification active user does not have permission, it is automatically redirected to specified page.If
Authorization check passes through, then will call and rewrite get_form method to render bootstrap label to guide user to create object.
It can be needed to initialize list according to business, alternatively, it is also possible to not rewrite get_form method, it is only necessary to which a specified model belongs to
Property and form_class attribute.It then, can be according to its corresponding template configured in GuideCreateView from Form
Obtaining in list needs field to be shown, and page dynamic renders bootstrap label.
In fact, PostCreate shown in Figure 19 is exactly a View, in generation, is write by programming personnel as needed
Code.If developer makes PostCreate inherit GuideCreateView, developer does not need to be concerned about in addition
How the HTMl template for holding view designs, and does not need to be concerned about how authorization check logic is write, it is only necessary to configure _ permission_
Attr attribute (for example, in code _ permission_attr=' magic.add_post '), the authorization check module of succession
Whether the multiple inheritance class of authorization check (that is, be used for) can have addition duty according to _ permission_attr attribute verification user
The permission of industry.If model=Post is arranged in code, evidence of fetching in list can be gone, and according to the display configured in list
Field attribute renders Html and is presented to the user.Submitting button (template automatically generates) is clicked after the corresponding information of user's typing,
It can verify whether form data meets the requirements after then receiving request of data from the background, if met the requirements, certainly by the data of submission
It is dynamic to be saved in list.For the above complex operations, since the PostCreate write is inherited
GuideCreateView, and GuideCreateView inherit LoginRequiredMixin,
PermissionForbiddenView, BreadcrumbMixin and CreateView, and developer is only needed such as figure
These codes shown in 19 are the creation being convenient to ensuring to log in carrying out object in the successful situation of authorization check, not only
Reduce size of code, and greatly reduces development difficulty.If future needs to change a certain module therein, for example,
If necessary to change authorization check module, then PermissionForbiddenView can be only changed, without changing all generations
Code, to improve the scalability of code.In addition, for example, the view due to reconstruct inherits LoginRequiredMixin
And PermissionForbiddenView, therefore, can be concentrated through LoginRequiredMixin and
PermissionForbiddenView controls all login and authorization check operation to manage, to realize the unification of web frame
Rights management.
Figure 20 is to show the update common view pattern based on reconstruct of an exemplary embodiment of the present invention come upgating object
Example view code schematic diagram.As shown in figure 20, example view PostUpdate, which is inherited, updates common view pattern
GuideUpdateView, and the sequence successively called can be LoginRequiredMixin,
PermissionForbiddenView, BreadcrumbMixin and UpdateView.Specifically, user can be verified whether first
It has logged in.If not logged in, then login page view is automatically redirected to so that user logs in.If logined successfully,
It then verifies active user and whether possesses the permission of magic.add_post, if not being automatically redirected to specified page.If
Authorization check passes through, then calls and rewrite get_form method, needed to initialize list according to business.Alternatively, can not also rewrite
Get_form method, it is only necessary to a specified model attribute and form_class attribute.Then, according to
Its corresponding template configured in GuideUpdateView obtains wherein from Form list needs field to be shown, then
Page dynamic renders bootstrap label to guide user to carry out object update.Here, the urls.py file of application can add
It is subject to lower URL pattern:
In addition, the expectation of PostUpdate view captures the Major key of entitled " pk " from URL, pk major key and database are needed
In major key be associated with to obtain data to facilitate user to be updated the data of acquisition.
Figure 21 be an exemplary embodiment of the present invention is shown object is deleted based on the deletion common view pattern of reconstruct
Example view code schematic diagram.As shown in figure 21, example view PostDelete inherits the above deletion reconstructed
Common view pattern GuideDeleteView, and the sequence successively called can be LoginRequiredMixin,
PermissionForbiddenView, BreadcrumbMixin and DeleteView.Specifically, user can be verified whether first
It has logged in.If not logged in, then login page view is automatically redirected to so that user logs in.If logined successfully,
It then verifies whether active user possesses the magic.delete_post permission for deleting object, is automatically redirected to if not
Specified page.If possessing the permission for deleting object, PostDelete view can be by the pk major key given, and rewrites it
The method of get_object goes to delete some object.Alternatively, get_object method can not also be rewritten, it is only necessary to specified one
A model attribute.It will finally call the display of View.as_view method to delete view when GET request, and work as POST request
When will call DeletionMixin.delete method, after deleting successfully will call rewrite get_success_url method,
Obtain the page reorientation address after operating successfully.Here, the urls.py file of application can add following URL pattern:
Also, the hyperlink of deletion can be set in post_list.html list template to navigate to the object of deletion:
It is apparent that by foregoing exemplary description, it, can be only with seldom generation by calling the reconstruct view generated
Code amount realizes that list object is shown, object details are checked, Object Creation, object update and object deletes function, and is executing
Whether meeting automatic Verification user logs in front of above-mentioned function, then executes login if not logged in, if logined successfully, verifies
User is to possess the function of executing corresponding authority, and realize self-navigation.However, it should be apparent to those skilled in the art that
That the code in attached drawing is only example, the code write can according to actual needs with individual programming habit and it is different, as long as can
Inherit the view of reconstruct.
Hereinafter, referring to Figure 23 description according to the Components Development device based on Django frame of invention exemplary embodiment.
Figure 23 is the block diagram for showing the Components Development device according to an exemplary embodiment of the present invention based on Django frame.
Referring to Figure 23, the Components Development device 2300 based on Django frame may include reconstruct view generation module 2310 and realization module
2320.Accoding to exemplary embodiment, reconstruct view generation module 2310 can will be multiple for realizing at least one of predetermined function
Derived class is encapsulated at least one view in the Business Logic of Django frame, to generate at least one reconstruct view.
Accoding to exemplary embodiment, at least one described multiple inheritance class may include the multiple inheritance class and use for realizing login function
In the multiple inheritance class for realizing Authority Verification function.In addition, at least one described multiple inheritance class may also include for realizing face
The multiple inheritance class of packet bits navigation feature, but not limited to this.Here, at least one described view may include in following common view pattern
At least one common view pattern: list common view pattern, the details for checking object details for showing list object are general
View, the creation common view pattern for creating object, for the update common view pattern of upgating object, the deletion for deleting object
Common view pattern.Accoding to exemplary embodiment, reconstruct view generation module 2310 can be by successively inheriting for realizing login function
Multiple inheritance class, for realizing Authority Verification function multiple inheritance class, for realizing crumbs navigation feature it is multiple after
It holds class and at least one described view and rewrites get_context_data method, generate at least one described reconstruct view.
It can when generating reconstruct view if at least one described common view pattern includes creation common view pattern or update common view pattern
List is configured in template corresponding at least one reconstruct view described in generation, with aobvious when creating object or upgating object
Show the field in list and field format is turned into bootstrap label.
Accoding to exemplary embodiment, realize module 2320 can based at least one described reconstruct view realization and it is described at least
One corresponding function of reconstruct view.Specifically, realize that module 2320 can call at least one described reconstruct view of generation
Realize login function, Authority Verification function and function corresponding at least one described view.Components Development device 2300 is also
It may include writing module (not shown), wherein writing module can be used for writing at least one described reconstruct succession before encapsulation
Class.Correspondingly, Components Development device 2300 may also include memory module (not shown), with storage write described at least one weight
At least one of structure derived class and generation reconstruct view.
Here, the multiple inheritance class that at least one described multiple inheritance class can be carried based on Django frame is encoded, this
When, at least one described view can be class-based view.It specifically, can quilt for realizing the multiple inheritance class of login function
It is written as by inheriting the included object class of Django frame and calling the login_required method in Django frame
To realize login function.It can be written as realizing the multiple inheritance class of Authority Verification function by inheriting Django frame certainly
The ContextMixin class of band simultaneously rewrites the dispatch method in Django frame to realize Authority Verification function.For realizing
The multiple inheritance class of crumbs navigation feature can be written as by inheriting the included ContextMixin class of Django frame simultaneously
The get_context_data method in Django frame is rewritten to realize crumbs navigation feature.Alternatively, it is described at least one
Multiple inheritance class may be based on what function was encoded, at this point, at least one described view is the view based on function.But institute
It states at least one multiple inheritance class to be write based on class than writing based on function, size of code can be reduced.
As described above, realize module 2320 can call generation it is described at least one reconstruct view come realize with it is described at least
One corresponding function of reconstruct view, here, function corresponding at least one described reconstruct view includes the predetermined function
And function corresponding at least one described view.Specifically, the predetermined function can be tested for example including login function, permission
At least one of function and crumbs navigation feature are demonstrate,proved, but not limited to this.Accoding to exemplary embodiment, realize that module 2320 can
Call whether the multiple inheritance class for realizing login function logs in and to determine user in the feelings for determining that user is not logged in first
Login function is executed under condition, then, if user has logged in, realizes that module 2320 can be called for realizing Authority Verification function
Multiple inheritance class execute Authority Verification, and if Authority Verification success, realize module 2320 can call it is described at least
One view executes function corresponding at least one described view.Function corresponding at least one described view may include pair
As list display function, object details look facility, Object Creation function, object more new function and object are deleted in function
At least one, but not limited to this.
At least one reconstruct view as described in generation inherit at least one described multiple inheritance class and it is described extremely
Therefore a few common view pattern realizes that module 2320 can be by the institute of successively calling at least one described reconstruct view to be inherited
It is corresponding at least one described reconstruct view to realize to state at least one multiple inheritance class and at least one described common view pattern
Function.
As described above, if at least one described common view pattern includes creation common view pattern or updates common view pattern,
It, can be corresponding at least one reconstruct view described in generation when generating the creation common view pattern of reconstruct or updating common view pattern
List is configured in template, to show the field in list when creating object or upgating object and turn to field format
Bootstrap label.Correspondingly, at least one the reconstruct view described in calling generation of module 2320 is realized to realize login function
When energy, Authority Verification function and function corresponding at least one described view, can obtain from list needs word to be shown
Section simultaneously dynamically renders bootstrap label, and to guide, user carries out Object Creation or object updates.
It is described the invention in detail above with reference to attached drawing 1 to Figure 23, as described above, according to the present invention, can lead to
It crosses and some common functions or sophisticated functions is write into suitable multiple inheritance class, and be encapsulated in Django frame as needed
Business Logic in view reconstruct view, and realize corresponding function based on the view of reconstruct as needed, and nothing
It needs individually to write many function codes when needing to realize those common functions or sophisticated functions every time to realize, thus not only
Reduce size of code, and greatly reduces development difficulty.For example, by the way that login function and Authority Verification function are written as closing
Suitable multiple inheritance class is simultaneously encapsulated in the view in the Business Logic of Django frame, it can be achieved that web frame is entire
Unified rights management in life cycle.In addition, if future needs to change a certain function implementation therein, only on the basis of
The view for needing to change multiple inheritance class, the view in Django frame or the reconstruct write, can be realized function implementation
Change, without changing all codes, to improve the scalability of code.Moreover, at least one either write
Multiple inheritance class, or the common view pattern of reconstruct, it is following directly to be used for developer, or can also add again as needed
Add or inherit other classes, so that the scalability of development efficiency and code is improved, so that developer will can more pay attention to
Power is placed on the framework of entire service logic, without excessively paying close attention to the realization of each functional module, therefore, can promote work effect
Rate reduces development cost, is more easier programming.For example, according to an exemplary embodiment of the present disclosure, list object is aobvious
Show, Object Creation, object are deleted, object updates and object is checked and do not need to write many line codes, and only will be clear that the weight of encapsulation
The effect of structure view, and inherit packaged suitable reconstruct view as needed and can be realized, and can realize object column
Unified login and Authority Verification are carried out before table is shown, Object Creation, object are deleted, object updates and object look facility.
It should be noted that is stressed in the description of above embodiments is the difference from other embodiments,
The same or similar part may refer to each other between each embodiment.
It should also be noted that, herein, term " includes " or any other variant are intended to nonexcludability
Include, so that method or equipment including a series of elements not only include those elements, but also including not arranging clearly
Other element out, or further include for this method or the intrinsic element of equipment.In the absence of more restrictions,
The element limited by sentence " including ... ", it is not excluded that there is also other phases in the method or equipment for including above-mentioned element
Same element.
In addition, the various components of the Components Development square law device according to the present invention based on Django frame can be implemented as
Hardware component or component software, and can be combined as needed.In addition, those skilled in the art can be according to various components institute
The processing of execution uses such as field programmable gate array (FPGA) or specific integrated circuit (ASIC) Lai Shixian various components.
Components Development method according to the present invention based on Django frame may be recorded in including executing by computer reality
In the computer-readable medium of the program instruction of existing various operations.The example of computer-readable medium include magnetic medium (such as
Hard disk, floppy disk and tape);Optical medium (such as CD-ROM and DVD);Magnet-optical medium (for example, CD);And it especially prepares and uses
In the hardware device for storing and executing program instructions (for example, read-only memory (ROM), random access memory (RAM), flash memory
Deng).The example of program instruction includes the machine code for example generated by compiler and is executed comprising usable interpreter by computer
High-level code file.
Although the present invention, those skilled in the art has been described in detail referring to exemplary embodiment of the present invention
It should be understood that in the case where not departing from the spirit and scope of the present invention being defined by the claims, form can be carried out to it
With the various changes in details.
Claims (17)
1. a kind of Components Development method based on Django frame, comprising:
By for realizing at least one multiple inheritance class wrapper of predetermined function in the Business Logic of Django frame extremely
In a few view, to generate at least one reconstruct view;
Based at least one described reconstruct view realization with it is described at least one reconstruct the corresponding function of view,
Wherein, at least one described multiple inheritance class includes for realizing the multiple inheritance class of login function and for realizing permission
The multiple inheritance class of authentication function,
Wherein, realize that step includes: that at least one the described reconstruct view generated is called to realize login function, Authority Verification function
Energy and function corresponding at least one described view.
2. Components Development method as described in claim 1, wherein at least one described multiple inheritance class be before encapsulation by
It writes.
3. Components Development method as claimed in claim 2, wherein at least one described multiple inheritance class further include for realizing
The multiple inheritance class of crumbs navigation feature, wherein realize step further include: call at least one described reconstruct view of generation
Realize crumbs navigation feature.
4. Components Development method as claimed in claim 1 or 2, wherein call at least one described reconstruct view of generation
Realize that login function, Authority Verification function and the step of function corresponding at least one described view include:
Call whether the multiple inheritance class for realizing login function logs in and to determine user in the feelings for determining that user is not logged in
Login function is executed under condition;
If user has logged in, the multiple inheritance class for realizing Authority Verification function is called to execute Authority Verification;
If Authority Verification success calls at least one described view to execute function corresponding at least one described view.
5. Components Development method as claimed in claim 4,
Wherein, function corresponding at least one described view includes at least one of following functions: list object shows function
Energy, object details look facility, Object Creation function, object more new function and object delete function.
6. Components Development method as described in any one of claims 1-3, wherein at least one described view includes following general
At least one common view pattern in view: for showing the list common view pattern of list object, for checking the detailed of object details
Feelings common view pattern, the creation common view pattern for creating object, for the update common view pattern of upgating object, for deleting object
Deletion common view pattern.
7. Components Development method as claimed in claim 6, wherein generation step includes: by successively inheriting for realizing stepping on
The multiple inheritance class of recording function, for realizing the multiple inheritance class of Authority Verification function, for realizing crumbs navigation feature
Multiple inheritance class and at least one described common view pattern simultaneously rewrite get_context_data method, generate it is described at least one
Reconstruct view.
8. Components Development method as claimed in claim 6, wherein if at least one described common view pattern includes that creation is general
View updates common view pattern, then generation step includes: in template corresponding at least one reconstruct view described in generation
List is configured, to show the field in list when creating object or upgating object and field format is turned to bootstrap mark
Label.
9. Components Development method as claimed in claim 8, wherein if at least one described common view pattern includes that creation is general
View updates common view pattern, then at least one described reconstruct view of generation is called to realize login function, Authority Verification function
The step of energy and function corresponding at least one described view includes: to obtain to need field to be shown and dynamic from list
Bootstrap label is rendered, user carries out Object Creation or object updates to guide.
10. Components Development method as claimed in claim 3, wherein at least one described multiple inheritance class is based on Django
The included multiple inheritance class of frame is encoded,
Wherein, at least one described view is class-based view.
11. Components Development method as claimed in claim 10, wherein be encoded for realizing the multiple inheritance class of login function
For by inheriting the included object class of Django frame and calling the login_required method in Django frame come real
Existing login function.
12. Components Development method as claimed in claim 10, wherein for realizing the multiple inheritance class quilt of Authority Verification function
It is written as by inheriting the included ContextMixin class of Django frame and rewriteeing the dispatch method in Django frame
To realize Authority Verification function.
13. Components Development method as claimed in claim 10, wherein for realizing the multiple inheritance class of crumbs navigation feature
It is written as by inheriting the included ContextMixin class of Django frame and rewriteeing the get_ in Django frame
Context_data method realizes crumbs navigation feature.
14. Components Development method as claimed in claim 3, wherein at least one described multiple inheritance class is based on function quilt
It writes,
Wherein, at least one described view is the view based on function.
15. a kind of Components Development device based on Django frame, wherein the Components Development device includes:
Reconstruct view generation module, by for realizing at least one multiple inheritance class wrapper of predetermined function in Django frame
In at least one view in Business Logic, to generate at least one reconstruct view;
Realize module, the function corresponding at least one described reconstruct view of at least one reconstruct view realization based on described in,
Wherein, at least one described multiple inheritance class includes for realizing the multiple inheritance class of login function and for realizing permission
The multiple inheritance class of authentication function realizes that module calls described at least one reconstruct the view realization login function, permission generated
Authentication function and function corresponding at least one described view.
16. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage has when processed
Device makes the program instruction of method described in any one of processor perform claim requirement 1 to 14 when executing.
17. a kind of computing device characterized by comprising
Processor;
Memory is stored with and requires processor perform claim described in any one of 1 to 14
The program instruction of method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711432439.1A CN109960503A (en) | 2017-12-26 | 2017-12-26 | Component development method and device based on Django framework |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711432439.1A CN109960503A (en) | 2017-12-26 | 2017-12-26 | Component development method and device based on Django framework |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109960503A true CN109960503A (en) | 2019-07-02 |
Family
ID=67022092
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711432439.1A Pending CN109960503A (en) | 2017-12-26 | 2017-12-26 | Component development method and device based on Django framework |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109960503A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111427581A (en) * | 2020-03-26 | 2020-07-17 | 山东浪潮通软信息科技有限公司 | Method, device, equipment and medium for realizing type multi-inheritance |
CN113542872A (en) * | 2021-07-30 | 2021-10-22 | 联想(北京)有限公司 | Image processing method and device and electronic equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104598513A (en) * | 2014-11-03 | 2015-05-06 | 腾讯科技(成都)有限公司 | Data flow control method and system based on webpage frame |
CN105787317A (en) * | 2016-03-23 | 2016-07-20 | 中国电力科学研究院 | Permission control method based on multi-layer hierarchy system |
-
2017
- 2017-12-26 CN CN201711432439.1A patent/CN109960503A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104598513A (en) * | 2014-11-03 | 2015-05-06 | 腾讯科技(成都)有限公司 | Data flow control method and system based on webpage frame |
CN105787317A (en) * | 2016-03-23 | 2016-07-20 | 中国电力科学研究院 | Permission control method based on multi-layer hierarchy system |
Non-Patent Citations (3)
Title |
---|
CODELEAVES: "Django类视图与Mixin", 《HTTPS://BLOG.CSDN.NET/LAUGHING2333/ARTICLE/DETAILS/53959426?LOCATIONNUM=9&FPS=1》 * |
ETHAN: "Django-Braces - PermissionRequiredMixin重定向到登录尽管权限可用", 《HTTP://CN.VOIDCC.COM/QUESTION/P-MYMZOBMI-BHE.HTML》 * |
TONGHUAXL: "第十章 构建一个在线学习平台(下)", 《HTTPS://WWW.ITDAAN.COM/BLOG/2017/06/16/DBFF7D9F2584.HTML》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111427581A (en) * | 2020-03-26 | 2020-07-17 | 山东浪潮通软信息科技有限公司 | Method, device, equipment and medium for realizing type multi-inheritance |
CN111427581B (en) * | 2020-03-26 | 2023-02-21 | 山东浪潮通软信息科技有限公司 | Method, device, equipment and medium for realizing type multi-inheritance |
CN113542872A (en) * | 2021-07-30 | 2021-10-22 | 联想(北京)有限公司 | Image processing method and device and electronic equipment |
CN113542872B (en) * | 2021-07-30 | 2023-03-24 | 联想(北京)有限公司 | Image processing method and device and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9021419B2 (en) | System and method for supporting intelligent design pattern automation | |
US8997053B2 (en) | System and method for automated testing of software applications with dynamic user interfaces spanning multiple technologies | |
US11635974B2 (en) | Providing a different configuration of added functionality for each of the stages of predeployment, deployment, and post deployment using a layer of abstraction | |
US20150143267A1 (en) | SYSTEM AND METHOD FOR DEVELOPING A RULE-BASED EVENT-DRIVEN MULTI-LAYERED FRONTEND FOR BUSINESS SERVICES AND RENDERING THE GUIs ON MULTIPLE CLIENT DEVICES | |
MacLean et al. | Pro Android 5 | |
CN109960503A (en) | Component development method and device based on Django framework | |
Paz | Beginning ASP. NET MVC 4 | |
Soni | Full stack angularJS for java developers: Build a full-featured web application from scratch using angularJS with spring RESTful | |
Nusairat | Beginning JBoss Seam: From Novice to Professional | |
Soni et al. | Spring: Developing Java Applications for the Enterprise | |
Hillier et al. | Microsoft SharePoint 2013 app development | |
Mahmoud | Developing Middleware in Java EE 8: Build robust middleware solutions using the latest technologies and trends | |
Sastry | Enhanced Position Aware Sampling For The Cloud | |
Macero García et al. | The Data Layer | |
Avery et al. | Windows developer power tools | |
Amalaraj et al. | Design and Development of a Tethys Framework Web Application to Elucidate the HydroShare. org Application Programmer Interface | |
Trivedi | User interface implementation of environmental data integration system with React | |
Acord et al. | Cross-platform Mobile Application Development A Pattern-Based Approach | |
Pitt | React Components | |
Liu | Decentralized application-a news forum based on react and solid | |
Karadzhov | Learn ZF2: Learning By Example | |
Nguyen | Investication, building, and piloting of a low-code system for enterprice development | |
MacLean et al. | Introduction to Android application architecture | |
Cameron et al. | Pro ASP. NET 3.5 Server Controls and AJAX Components | |
Sharma et al. | Creating Application Flows |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190702 |