Changes between Version 15 and Version 16 of AJAXForeignKey
- Timestamp:
- May 20, 2007, 10:32:50 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AJAXForeignKey
v15 v16 17 17 18 18 * {{{__init__.py}}} -- duh 19 * {{{fields.py}}} -- contains the actual model field. (download)19 * {{{fields.py}}} -- [#a2.bFixingfields.py contains the actual model field. (download)] 20 20 * {{{forms.py}}} -- contains the form field. (download '''forms2.py''' and rename) 21 * {{{views.py}}} -- [#OneLastThing contains the AJAX view. (download) ]21 * {{{views.py}}} -- contains the AJAX view. (download) 22 22 23 3. [# Creatingbase_templatesadminbase_site.html Create a base_site.html file in your base_templates/admin directory.]23 3. [#a3.Creatingbase_templatesadminbase_site.html Create a base_site.html file in your base_templates/admin directory.] 24 24 25 4. [# Modifyurls.py Modify your urls conf to contain the ajax view.]25 4. [#a4.Modifyurls.py Modify your urls conf to contain the ajax view.] 26 26 27 5. [# Usingitinyourmodels Modify your models to use it correctly.]27 5. [#a5.Usingitinyourmodels Modify your models to use it correctly.] 28 28 29 === Creating {{{base_templates/admin/base_site.html}}} === 29 [#Installation (top)] 30 === 2.b Fixing {{{fields.py}}} === 31 32 If you downloaded {{{fields.py}}}, you need to make sure the import line at the top correctly imports the Form field. 33 34 You might need to change this 35 36 {{{ 37 #!python 38 from ajaxfkey.forms import AjaxForeignKeyFormField 39 }}} 40 to this 41 {{{ 42 #!python 43 from myproject.ajaxfkey.forms import AjaxForeignKeyFormField 44 }}} 45 46 [#Installation (top)] 47 === 3. Creating {{{base_templates/admin/base_site.html}}} === 30 48 31 49 Put the contents below in a place locatable by {{{'admin/base_site.html'}}} in your setup. … … 55 73 }}} 56 74 57 58 === Modify {{{urls.py}}} ===75 [#Installation (top)] 76 === 4. Modify {{{urls.py}}} === 59 77 60 78 Put the following in your urls configuration: … … 66 84 Change {{{project.ajaxfkey}}} to the path to the views file you created. 67 85 68 === Using it in your models === 86 [#Installation (top)] 87 === 5. Using it in your models === 69 88 70 89 To use, you need to define a {{{ajax_autocomplete(data)}}} (either in {{{Model}}} or {{{Model.objects}}}) and an {{{ajax_str}}}. … … 101 120 }}} 102 121 103 === One Last Thing === 104 105 If you downloaded {{{fields.py}}}, you need to make sure the import line at the top correctly imports the Form field. 106 107 You might need to change this 108 109 {{{ 110 #!python 111 from ajaxfkey.forms import AjaxForeignKeyFormField 112 }}} 113 to this 114 {{{ 115 #!python 116 from myproject.ajaxfkey.forms import AjaxForeignKeyFormField 117 }}} 118 122 [#Installation (top)] 119 123 === Screenshot === 120 124