Django

Code

Changeset 854

Show
Ignore:
Timestamp:
10/13/05 13:28:44 (3 years ago)
Author:
rjwittams
Message:

Merged to r852.
Cleaned up some templates.
Efficiency fix in field_widget tag.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/new-admin/django/conf/admin_media/css/global.css

    r537 r854  
    231231fieldset.collapse h2 a.collapse-toggle { color:#ffc; } 
    232232fieldset.collapse h2 a.collapse-toggle:hover { text-decoration:underline; } 
     233.hidden { display:none; } 
    233234 
    234235/* MESSAGES & ERRORS  */ 
     
    349350.timelist a { padding:2px; } 
    350351 
    351 /*  OLD ORDERING WIDGET  */ 
     352/*  ORDERING WIDGET  */ 
    352353 
    353354ul#orderthese { padding:0; margin:0; list-style-type:none; } 
  • django/branches/new-admin/django/conf/admin_templates/admin_change_form.html

    r802 r854  
    33{% load adminmedia %} 
    44{% block extrahead %} 
    5   
    65   {% for js in javascript_imports %} 
    76      {% include_admin_script js %} 
    87   {% endfor %} 
    9  
    108{% endblock %} 
    11  
    129{% block coltype %}{{ coltype }}{% endblock %} 
    13  
    1410{% block bodyclass %}{{app_label}}-{{object_name.lower}} change-form{% endblock %} 
    15  
    1611{% block breadcrumbs %}{% if not is_popup %} 
    1712<div class="breadcrumbs"> 
    1813     <a href="../../../">Home</a> &rsaquo; 
    1914     <a href="../">{{verbose_name_plural|capfirst}}</a> &rsaquo; 
    20      {% if add %} 
    21         Add {{verbose_name}} 
    22      {% else %} 
    23         {{original|striptags|truncatewords:"18"}} 
    24      {% endif %} 
     15     {% if add %}Add {{verbose_name}}{% else %}{{original|striptags|truncatewords:"18"}}{% endif %} 
    2516</div> 
    26 {% endif %} 
    27 {% endblock %} 
     17{% endif %}{% endblock %} 
    2818 
    2919{% block content %}<div id="content-main"> 
     
    8373 
    8474{% if add %} 
    85    <script type="text/javascript">document.getElementById("id_{{first_field}}").focus();</script>' 
     75   <script type="text/javascript">document.getElementById("{{first_form_field_id}}").focus();</script> 
    8676{% endif %} 
    8777 
  • django/branches/new-admin/django/conf/admin_templates/admin_field_line.html

    r802 r854  
    11<div class="{{ class_names }}" > 
    2    {% for bound_field in bound_fields %} 
    3       {{ bound_field.html_error_list }}  
    4    {% endfor %} 
    5     
    6    {% for bound_field in bound_fields %} 
    7       {% if bound_field.has_label_first %} 
    8          {% field_label bound_field %} 
    9       {% endif %} 
    10        
    11       {% field_widget bound_field %} 
    12  
    13       {% if not bound_field.has_label_first %} 
    14          {% field_label bound_field %} 
    15       {% endif %} 
    16  
    17       {% if change %} 
    18          {% if bound_field.field.primary_key %} 
    19              {{ bound_field.original_value }}  
    20           {% endif %} 
    21  
    22          {% if bound_field.raw_id_admin %} 
    23             {% if bound_field.existing_repr %} 
    24                 &nbsp;<strong>{{ bound_field.existing_repr|truncatewords:"14" }}</strong> 
    25             {% endif %} 
    26          {% endif %} 
    27       {% endif %} 
    28  
    29       {% if bound_field.field.help_text %} 
    30         <p class="help"> 
    31            {{bound_field.field.help_text}} 
    32         </p> 
    33       {% endif %} 
    34  
    35    {% endfor %} 
     2{% for bound_field in bound_fields %}{{ bound_field.html_error_list }}{% endfor %} 
     3{% for bound_field in bound_fields %} 
     4  {% if bound_field.has_label_first %} 
     5    {% field_label bound_field %} 
     6  {% endif %}     
     7  {% field_widget bound_field %} 
     8  {% if not bound_field.has_label_first %} 
     9    {% field_label bound_field %} 
     10  {% endif %} 
     11  {% if change %} 
     12    {% if bound_field.field.primary_key %} 
     13          {{ bound_field.original_value }}  
     14        {% endif %} 
     15    {% if bound_field.raw_id_admin %} 
     16      {% if bound_field.existing_repr %}&nbsp;<strong>{{ bound_field.existing_repr|truncatewords:"14" }}</strong>{% endif %} 
     17        {% endif %} 
     18  {% endif %} 
     19  {% if bound_field.field.help_text %}<p class="help">{{bound_field.field.help_text}}</p>{% endif %} 
     20{% endfor %} 
    3621</div> 
  • django/branches/new-admin/django/core/cache.py

    r701 r854  
    1616                                    on localhost port 11211. 
    1717 
    18     db://tablename/                 A database backend in a table named  
     18    db://tablename/                 A database backend in a table named 
    1919                                    "tablename". This table should be created 
    2020                                    with "django-admin createcachetable". 
     
    2727                                    testing. Note that this cache backend is 
    2828                                    NOT threadsafe! 
    29                                          
     29 
    3030    locmem:///                      A more sophisticaed local memory cache; 
    3131                                    this is multi-process- and thread-safe. 
     
    7373 
    7474class _Cache: 
    75  
    7675    def __init__(self, params): 
    7776        timeout = params.get('timeout', 300) 
     
    133132else: 
    134133    class _MemcachedCache(_Cache): 
    135         """Memcached cache backend.""" 
    136  
     134        "Memcached cache backend." 
    137135        def __init__(self, server, params): 
    138136            _Cache.__init__(self, params) 
     
    162160 
    163161class _SimpleCache(_Cache): 
    164     """Simple single-process in-memory cache""" 
    165  
     162    "Simple single-process in-memory cache." 
    166163    def __init__(self, host, params): 
    167164        _Cache.__init__(self, params) 
     
    231228except ImportError: 
    232229    import pickle 
     230import copy 
    233231from django.utils.synch import RWLock 
    234232 
    235233class _LocMemCache(_SimpleCache): 
    236     """Thread-safe in-memory cache""" 
    237      
     234    "Thread-safe in-memory cache." 
    238235    def __init__(self, host, params): 
    239236        _SimpleCache.__init__(self, host, params) 
     
    251248                should_delete = True 
    252249            else: 
    253                 return self._cache[key] 
     250                return copy.deepcopy(self._cache[key]) 
    254251        finally: 
    255252            self._lock.reader_leaves() 
     
    262259            finally: 
    263260                self._lock.writer_leaves() 
    264                  
     261 
    265262    def set(self, key, value, timeout=None): 
    266263        self._lock.writer_enters() 
     
    269266        finally: 
    270267            self._lock.writer_leaves() 
    271              
     268 
    272269    def delete(self, key): 
    273270        self._lock.writer_enters() 
     
    285282 
    286283class _FileCache(_SimpleCache): 
    287     """File-based cache""" 
    288      
     284    "File-based cache." 
    289285    def __init__(self, dir, params): 
    290286        self._dir = dir 
     
    294290        del self._cache 
    295291        del self._expire_info 
    296          
     292 
    297293    def get(self, key, default=None): 
    298294        fname = self._key_to_file(key) 
     
    309305            pass 
    310306        return default 
    311          
     307 
    312308    def set(self, key, value, timeout=None): 
    313309        fname = self._key_to_file(key) 
     
    328324        except (IOError, OSError): 
    329325            raise 
    330              
     326 
    331327    def delete(self, key): 
    332328        try: 
     
    334330        except (IOError, OSError): 
    335331            pass 
    336              
     332 
    337333    def has_key(self, key): 
    338334        return os.path.exists(self._key_to_file(key)) 
    339          
     335 
    340336    def _cull(self, filelist): 
    341337        if self.cull_frequency == 0: 
     
    349345                pass 
    350346 
    351     def _createdir(self):     
     347    def _createdir(self): 
    352348        try: 
    353349            os.makedirs(self._dir) 
     
    367363 
    368364class _DBCache(_Cache): 
    369     """SQL cache backend""" 
    370      
     365    "SQL cache backend." 
    371366    def __init__(self, table, params): 
    372367        _Cache.__init__(self, params) 
    373368        self._table = table 
    374         max_entries = params.get('max_entries', 300)  
    375         try:  
    376             self._max_entries = int(max_entries)  
    377         except (ValueError, TypeError):  
    378             self._max_entries = 300  
    379         cull_frequency = params.get('cull_frequency', 3)  
    380         try:  
    381             self._cull_frequency = int(cull_frequency)  
    382         except (ValueError, TypeError):  
    383             self._cull_frequency = 3  
    384          
     369        max_entries = params.get('max_entries', 300) 
     370        try: 
     371            self._max_entries = int(max_entries) 
     372        except (ValueError, TypeError): 
     373            self._max_entries = 300 
     374        cull_frequency = params.get('cull_frequency', 3) 
     375        try: 
     376            self._cull_frequency = int(cull_frequency) 
     377        except (ValueError, TypeError): 
     378            self._cull_frequency = 3 
     379 
    385380    def get(self, key, default=None): 
    386381        cursor = db.cursor() 
     
    395390            return default 
    396391        return pickle.loads(base64.decodestring(row[1])) 
    397          
     392 
    398393    def set(self, key, value, timeout=None): 
    399394        if timeout is None: 
     
    418413        else: 
    419414            db.commit() 
    420          
     415 
    421416    def delete(self, key): 
    422417        cursor = db.cursor() 
    423418        cursor.execute("DELETE FROM %s WHERE cache_key = %%s" % self._table, [key]) 
    424419        db.commit() 
    425          
     420 
    426421    def has_key(self, key): 
    427422        cursor = db.cursor() 
    428423        cursor.execute("SELECT cache_key FROM %s WHERE cache_key = %%s" % self._table, [key]) 
    429424        return cursor.fetchone() is not None 
    430          
     425 
    431426    def _cull(self, cursor, now): 
    432427        if self._cull_frequency == 0: 
     
    439434                cursor.execute("SELECT cache_key FROM %s ORDER BY cache_key LIMIT 1 OFFSET %%s" % self._table, [num / self._cull_frequency]) 
    440435                cursor.execute("DELETE FROM %s WHERE cache_key < %%s" % self._table, [cursor.fetchone()[0]]) 
    441          
     436 
    442437########################################## 
    443438# Read settings and load a cache backend # 
  • django/branches/new-admin/django/core/db/backends/mysql.py

    r819 r854  
    144144    'EmailField':        'varchar(75)', 
    145145    'FileField':         'varchar(100)', 
     146    'FilePathField':     'varchar(100)', 
    146147    'FloatField':        'numeric(%(max_digits)s, %(decimal_places)s)', 
    147148    'ImageField':        'varchar(100)', 
  • django/branches/new-admin/django/core/db/backends/postgresql.py

    r713 r854  
    155155    'EmailField':        'varchar(75)', 
    156156    'FileField':         'varchar(100)', 
     157    'FilePathField':     'varchar(100)', 
    157158    'FloatField':        'numeric(%(max_digits)s, %(decimal_places)s)', 
    158159    'ImageField':        'varchar(100)', 
  • django/branches/new-admin/django/core/db/backends/sqlite3.py

    r713 r854  
    155155    'EmailField':                   'varchar(75)', 
    156156    'FileField':                    'varchar(100)', 
     157    'FilePathField':                'varchar(100)', 
    157158    'FloatField':                   'numeric(%(max_digits)s, %(decimal_places)s)', 
    158159    'ImageField':                   'varchar(100)', 
  • django/branches/new-admin/django/core/formfields.py

    r791 r854  
    823823#################### 
    824824 
     825class FilePathField(SelectField): 
     826    "A SelectField whose choices are the files in a given directory." 
     827    def __init__(self, field_name, path, match=None, recursive=False, is_required=False, validator_list=[]): 
     828        import os 
     829        if match is not None: 
     830            import re 
     831            match_re = re.compile(match) 
     832        choices = [] 
     833        if recursive: 
     834            for root, dirs, files in os.walk(path): 
     835                for f in files: 
     836                    if match is None or match_re.search(f): 
     837                        choices.append((os.path.join(path, f), f)) 
     838        else: 
     839            try: 
     840                for f in os.listdir(path): 
     841                    full_file = os.path.join(path, f) 
     842                    if os.path.isfile(full_file) and (match is None or match_re.search(f)): 
     843                        choices.append((full_file, f)) 
     844            except OSError: 
     845                pass 
     846        SelectField.__init__(self, field_name, choices, 1, is_required, validator_list) 
     847 
    825848class PhoneNumberField(TextField): 
    826849    "A convenience FormField for validating phone numbers (e.g. '630-555-1234')" 
  • django/branches/new-admin/django/core/management.py

    r791 r854  
    144144        for row in cursor.fetchall(): 
    145145            output.append("DELETE FROM auth_admin_log WHERE content_type_id = %s;" % row[0]) 
     146 
     147    # Close database connection explicitly, in case this output is being piped 
     148    # directly into a database client, to avoid locking issues. 
     149    db.db.close() 
    146150 
    147151    return output[::-1] # Reverse it, to deal with table dependencies. 
     
    637641        except KeyboardInterrupt: 
    638642            sys.exit(0) 
    639     from django.utils import autoreload 
    640     autoreload.main(inner_run) 
     643    #from django.utils import autoreload 
     644    #autoreload.main(inner_run) 
     645    inner_run() 
    641646runserver.args = '[optional port number, or ipaddr:port]' 
    642647 
  • django/branches/new-admin/django/core/meta/fields.py

    r803 r854  
    291291         """ 
    292292         return { self.get_db_column(): self._get_val_from_obj(obj)} 
    293          
     293 
     294    def get_follow(self, override=None): 
     295        if override: 
     296            return override 
     297        else: 
     298            return self.editable 
    294299  
    295300class AutoField(Field): 
     
    464469        return os.path.normpath(f) 
    465470 
     471class FilePathField(Field): 
     472    def __init__(self, verbose_name=None, name=None, path='', match=None, recursive=False, **kwargs): 
     473        self.path, self.match, self.recursive = path, match, recursive 
     474        Field.__init__(self, verbose_name, name, **kwargs) 
     475 
     476    def get_manipulator_field_objs(self): 
     477        return [curry(formfields.FilePathField, path=self.path, match=self.match, recursive=self.recursive)] 
     478 
    466479class FloatField(Field): 
    467480    empty_strings_allowed = False 
  • django/branches/new-admin/django/core/meta/__init__.py

    r803 r854  
    233233        else: 
    234234            count = self.field.rel.num_in_admin 
    235  
     235             
    236236        fields = [] 
    237          
    238  
    239237        for i in range(count): 
    240238            for f in self.opts.fields + self.opts.many_to_many: 
     
    425423 
    426424    def get_data_holders(self, follow=None): 
     425        if follow == None : 
     426            follow = self.get_follow() 
    427427        return [f for f in self.fields + self.many_to_many + self.get_all_related_objects_wrapped() if follow.get(f.name, None) ] 
    428428 
    429429    def get_follow(self, override=None): 
    430430        follow = {} 
    431          
    432         for f in self.fields + self.many_to_many: 
     431        for f in self.fields + self.many_to_many + self.get_all_related_objects_wrapped(): 
    433432            if override and override.has_key(f.name): 
    434                 fol = override[f.name] 
     433                child_override = override[f.name]  
    435434            else: 
    436                 fol = f.editable 
     435                child_override = None 
     436            fol = f.get_follow(child_override) 
    437437            if fol: 
    438438                follow[f.name] = fol 
    439   
    440         for f in self.get_all_related_objects_wrapped(): 
    441             if override and override.has_key(f.name): 
    442                fol = f.get_follow(override[f.name]) 
    443             else: 
    444                fol = f.get_follow(None) 
    445             if fol: 
    446                 follow[f.name] = fol  
    447  
    448439        return follow 
    449440 
     
    479470        field_type (e.g. FileField). 
    480471        """ 
     472        #TODO: follow 
    481473        if not hasattr(self, '_field_types'): 
    482474            self._field_types = {} 
  • django/branches/new-admin/django/middleware/cache.py

    r819 r854  
    1 import copy 
    21from django.conf import settings 
    32from django.core.cache import cache 
     
    5049 
    5150        request._cache_update_cache = False 
    52         return copy.copy(response) 
     51        return response 
    5352 
    5453    def process_response(self, request, response): 
  • django/branches/new-admin/django/templatetags/admin_modify.py

    r818 r854  
    99 
    1010from django.views.admin.main import AdminBoundField 
    11 from django.core.meta.fields import BoundField 
     11from django.core.meta.fields import BoundField, Field 
    1212import re 
    1313 
     
    2525 
    2626#@inclusion_tag('admin_submit_line', takes_context=True) 
    27 def submit_row(context):         
     27def submit_row(context): 
    2828    change = context['change'] 
    2929    add = context['add'] 
     
    6969 
    7070class FieldWidgetNode(template.Node): 
     71    nodelists = {} 
     72    default = None 
     73     
    7174    def __init__(self, bound_field_var): 
    7275        self.bound_field_var = bound_field_var 
    73         self.nodelists = {} 
    74         t = template_loader.get_template("widget/default") 
    75         self.default = t.nodelist  
    76  
     76 
     77    def get_nodelist(cls, klass): 
     78        if not cls.nodelists.has_key(klass): 
     79            try: 
     80                field_class_name = klass.__name__ 
     81                template_name = "widget/%s" % \ 
     82                    class_name_to_underscored(field_class_name) 
     83                nodelist = template_loader.get_template(template_name).nodelist 
     84            except template.TemplateDoesNotExist: 
     85                super_klass = bool(klass.__bases__) and klass.__bases__[0] or None 
     86                if super_klass and super_klass != Field: 
     87                    nodelist = cls.get_nodelist(super_klass) 
     88                else: 
     89                    if not cls.default: 
     90                        cls.default = template_loader.get_template("widget/default").nodelist 
     91                    nodelist = cls.default 
     92             
     93            cls.nodelists[klass] = nodelist 
     94            return nodelist 
     95        else: 
     96            return cls.nodelists[klass] 
     97    get_nodelist = classmethod(get_nodelist)        
     98             
     99             
    77100    def render(self, context): 
    78101     
    79102        bound_field = template.resolve_variable(self.bound_field_var, context) 
    80         add = context['add'] 
    81         change = context['change'] 
    82103         
    83104        context.push() 
    84105        context['bound_field'] = bound_field 
    85         klass = bound_field.field.__class__ 
    86         if not self.nodelists.has_key(klass): 
    87             t = None 
    88             while klass: 
    89                 try:  
    90                     field_class_name = klass.__name__ 
    91                     template_name = "widget/%s" % \ 
    92                         class_name_to_underscored(field_class_name) 
    93                     t = template_loader.get_template(template_name) 
    94                     break 
    95                 except template.TemplateDoesNotExist:  
    96                     klass = bool(klass.__bases__) and klass.__bases__[0] or None 
    97               
    98             if t == None: 
    99                 nodelist = self.default 
    100             else:            
    101                 nodelist = t.nodelist 
    102  
    103             self.nodelists[klass] = nodelist             
    104  
    105         output = self.nodelists[klass].render(context) 
     106         
     107        output = self.get_nodelist(bound_field.field.__class__).render(context) 
    106108        context.pop() 
    107109        return output 
  • django/branches/new-admin/django/utils/decorators.py

    r819 r854  
    1313                if result is not None: 
    1414                    return result 
     15            if hasattr(middleware, 'process_view'): 
     16                result = middleware.process_view(request, view_func, **kwargs) 
     17                if result is not None: 
     18                    return result 
    1519            response = view_func(request, *args, **kwargs) 
    1620            if hasattr(middleware, 'process_response'): 
  • django/branches/new-admin/django/views/admin/main.py

    r819 r854  
    606606def fill_extra_context(opts, app_label, context, add=False, change=False, show_delete=False, form_url=''): 
    607607    admin_field_objs = opts.admin.get_field_objs(opts) 
     608     
    608609    ordered_objects = opts.get_ordered_objects()[:] 
    609610    auto_populated_fields = [f for f in opts.fields if f.prepopulate_from] 
     
    622623    form = context['form'] 
    623624    original = context['original'] 
     625     
     626    field_sets = opts.admin.get_field_sets(opts) 
    624627    bound_field_sets = [field_set.bind(form, original, AdminBoundFieldSet)  
    625                         for field_set in opts.admin.get_field_sets(opts)] 
    626                          
     628                        for field_set in field_sets] 
     629     
     630    first_form_field = bound_field_sets[0].bound_field_lines[0].bound_fields[0].form_fields[0]; 
     631                     
    627632    inline_related_objects = opts.get_inline_related_objects_wrapped() 
    628633     
     
    632637        'add': add,  
    633638        'change': change, 
     639        'first_form_field_id': first_form_field.get_id(), 
    634640        'ordered_objects' : ordered_objects,  
    635641        'ordered_object_names' : ordered_object_names, 
     
    644650        'content_type_id' : opts.get_content_type_id(), 
    645651        'save_on_top' : opts.admin.save_on_top, 
    646         'verbose_name_plural': opts.verbose_name_plural,  
     652        'verbose_name_plural': opts.verbose_name_plural, 
     653        'verbose_name': opts.verbose_name, 
    647654        'save_as': opts.admin.save_as,  
    648655        'app_label': app_label, 
     
    712719     
    713720     
    714     fill_extra_context(opts, app_label, c, change=False) 
     721    fill_extra_context(opts, app_label, c, add=True) 
    715722    
    716723    return render_to_response("admin_change_form", context_instance=c)  
  • django/branches/new-admin/django/views/generic/list_detail.py

    r741 r854  
    3333        pages 
    3434            number of pages, total 
     35        hits 
     36            number of objects, total 
    3537    """ 
    3638    mod = models.get_module(app_label, module_name) 
     
    5759            'previous': page - 1, 
    5860            'pages': paginator.pages, 
     61            'hits' : paginator.hits, 
    5962        }) 
    6063    else: 
  • django/branches/new-admin/docs/db-api.txt

    r791 r854  
    450450    4 
    451451 
    452 Each of those ``add_choice`` methods is equivalent to (except obviously much 
    453 simpler than):: 
     452Each of those ``add_choice`` methods is equivalent to (but much simpler than):: 
    454453 
    455454    >>> c = polls.Choice(poll_id=p.id, choice="Over easy", votes=0) 
     
    459458for the ``id`` field, nor do you give a value for the field that stores 
    460459the relation (``poll_id`` in this case). 
     460 
     461The ``add_FOO()`` method always returns the newly created object. 
    461462 
    462463Deleting objects 
  • django/branches/new-admin/docs/generic_views.txt

    r528 r854  
    116116    pattern. 
    117117 
    118     Uses the template ``app_label/module_name__archive_year`` by default. 
     118    Uses the template ``app_label/module_name_archive_year`` by default. 
    119119 
    120120    Has the following template context: 
     
    135135    numbers, use ``"%m"``. 
    136136 
    137     Uses the template ``app_label/module_name__archive_month`` by default. 
     137    Uses the template ``app_label/module_name_archive_month`` by default. 
    138138 
    139139    Has the following template context: 
     
    152152    decimal number, 1-31). 
    153153 
    154     Uses the template ``app_label/module_name__archive_day`` by default. 
     154    Uses the template ``app_label/module_name_archive_day`` by default. 
    155155 
    156156    Has the following template context: 
     
    247247        ``pages`` 
    248248            Number of pages total 
     249        ``hits`` 
     250            Total number of objects 
    249251 
    250252``object_detail`` 
     
    273275    could use ``post_save_redirect="/polls/%(slug)s/"``. 
    274276 
    275     Uses the template ``app_label/module_name__form`` by default. This is the 
     277    Uses the template ``app_label/module_name_form`` by default. This is the 
    276278    same template as the ``update_object`` view below. Your template can tell 
    277279    the different by the presence or absence of ``{{ object }}`` in the 
     
    295297    ``post_save_redirect`` as ``create_object`` does. 
    296298 
    297     Uses the template ``app_label/module_name__form`` by default. 
     299    Uses the template ``app_label/module_name_form`` by default. 
    298300 
    299301    Has the following template context: 
  • django/branches/new-admin/docs/install.txt

    r484 r854  
    2222 
    2323If you can't use mod_python for some reason, fear not: Django follows the WSGI_ 
    24 spec, which allows it to run on a variety of server platforms. As peopl
    25 experiment with different server platforms, we'll update this document to 
    26 give specific installation instructions for each platform. 
     24spec, which allows it to run on a variety of server platforms. See th
     25`server-arrangements wiki page`_ for specific installation instructions for 
     26each platform. 
    2727 
    2828.. _Apache: http://httpd.apache.org/ 
     
    3030.. _WSGI: http://www.python.org/peps/pep-0333.html 
    3131.. _How to use Django with mod_python: http://www.djangoproject.com/documentation/modpython/ 
     32.. _server-arrangements wiki page: http://code.djangoproject.com/wiki/ServerArrangements 
    3233 
    3334Get your database running 
     
    3738make sure a database server is running. Django works with PostgreSQL_ 
    3839(recommended), MySQL_ and SQLite_. 
    39  
    40 Note that support for MySQL and SQLite is a recent development, and Django 
    41 hasn't been comprehensively tested in those environments. If you find any bugs 
    42 in Django's MySQL or SQLite bindings, please file them in 
    43 `Django's ticket system`_ so we can fix them immediately. 
    4440 
    4541Additionally, you'll need to make sure your Python database bindings are 
  • django/branches/new-admin/docs/model-api.txt

    r749 r854  
    9696        ) 
    9797 
    98         The first element in each tuple is the actual value to be stored. The 
    99         second element is the human-readable name for the option. 
     98    The first element in each tuple is the actual value to be stored. The 
     99    second element is the human-readable name for the option. 
    100100 
    101101``core`` 
     
    249249 
    250250    The admin represents this as an ``<input type="file">`` (a file-upload widget). 
    251      
    252     Using a `FieldField` or an ``ImageField`` (see below) in a model takes a few  
     251 
     252    Using a `FieldField` or an ``ImageField`` (see below) in a model takes a few 
    253253    steps: 
    254      
     254 
    255255        1. In your settings file, you'll need to define ``MEDIA_ROOT``as the 
    256256           full path to a directory where you'd like Django to store uploaded 
     
    259259           sure that this directory is writable by the Web server's user 
    260260           account. 
    261          
    262         2. Add the ``FileField`` or ``ImageField`` to your model, making sure  
     261 
     262        2. Add the ``FileField`` or ``ImageField`` to your model, making sure 
    263263           to define the ``upload_to`` option to tell Django to which 
    264264           subdirectory of ``MEDIA_ROOT`` it should upload files. 
     
    270270           the absolute URL to your image in a template with ``{{ 
    271271           object.get_mug_shot_url }}``. 
    272      
     272 
    273273    .. _`strftime formatting`: http://docs.python.org/lib/module-time.html#l2h-1941 
     274 
     275``FilePathField`` 
     276    A field whose choices are limited to the filenames in a certain directory 
     277    on the filesystem. Has three special arguments, of which the first is 
     278    required: 
     279 
     280        ======================  =================================================== 
     281        Argument                Description 
     282        ======================  =================================================== 
     283        ``path``                Required. The absolute filesystem path to a 
     284                                directory from which this ``FilePathField`` should 
     285                                get its choices. Example: ``"/home/images"``. 
     286 
     287        ``match``               Optional. A regular expression, as a string, that 
     288                                ``FilePathField`` will use to filter filenames. 
     289                                Note that the regex will be applied to the 
     290                                base filename, not the full path. Example: 
     291                                ``"foo.*\.txt^"``, which will match a file called 
     292                                ``foo23.txt`` but not ``bar.txt`` or ``foo23.gif``. 
     293 
     294        ``recursive``           Optional. Either ``True`` or ``False``. Default is 
     295                                ``False``. Specifies whether all subdirectories of 
     296                                ``path`` should be included. 
     297        ======================  =================================================== 
     298 
     299    Of course, these arguments can be used together. 
     300 
     301    The one potential gotcha is that ``match`` applies to the base filename, 
     302    not the full path. So, this example:: 
     303 
     304        FilePathField(path="/home/images", match="foo.*", recursive=True) 
     305 
     306    ...will match ``/home/images/foo.gif`` but not ``/home/images/foo/bar.gif`` 
     307    because the ``match`` applies to the base filename (``foo.gif`` and 
     308    ``bar.gif``). 
    274309 
    275310``FloatField`` 
     
    303338 
    304339    Requires the `Python Imaging Library`_. 
    305      
     340 
    306341    .. _Python Imaging Library: http://www.pythonware.com/products/pil/ 
    307342 
     
    722757 
    723758    This is a list of lists of fields that must be unique when considered 
    724     together. It's used in the Django admin. 
     759    together. It's used in the Django admin and is enforced at the database 
     760    level (i.e., the appropriate ``UNIQUE`` statements are included in the 
     761    ``CREATE TABLE`` statement). 
    725762 
    726763``verbose_name`` 
  • django/branches/new-admin/docs/modpython.txt

    r642