Changeset 3815c51


Ignore:
Timestamp:
May 18, 2007 12:28:50 PM (7 years ago)
Author:
olivier <>
Branches:
master, crem, crem2, dev, dev2, diadems, dj1.6, feature/breadcrumbs, feature/ts-0.5, feature/ts-0.5.4, feature/writecache, forma, generic, instru_search, lam, lam2, mapsv3, merge, nlivemulti, production, release/1.4.4, sabiod, security, server, social, storage, telecaster, test, video
Children:
879d772
Parents:
aa5a73f
git-author:
olivier <> (18/05/2007 12:28:50)
git-committer:
olivier <> (18/05/2007 12:28:50)
Message:
  • the media objects ID regex is now in the models, following DRY (see urls)
  • media objects IDs are now validated at model level
  • experimenting new logo by Julia
  • trying some new layout + cleaned css
  • renamed "dictionaries" to "enumerations"
  • new PublishingStatus? enumerations model (you simply need to syncdb)
Location:
telemeta
Files:
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • telemeta/htdocs/css/telemeta.css

    r33b65e3 r3815c51  
    1 body { 
    2     font-family: Verdana; 
    3     font-size: 80%; 
    4 } 
     1body { font-family: Verdana; font-size: 80%; } 
    52 
    63a:link, a:visited { 
     
    107} 
    118 
    12 a:link:hover, a:visited:hover { 
    13     background-color:#EEEEEE; 
    14     color:#555555; 
    15 } 
     9a:link:hover, a:visited:hover { background-color:#EEEEEE; color:#555555; } 
     10a img { border: none; } 
    1611 
    1712#header { 
    18     border-bottom: solid 1px black; 
    1913    padding-bottom: 0.2em; 
    2014    padding-top: 0.2em; 
    2115} 
    22 #header a { 
    23     text-decoration: none; 
     16 
     17#logo { padding-top: 1ex; } 
     18#logo a, #logo a:hover { border: none; background: transparent; } 
     19 
     20#menu a, #menu a:hover { border: none;} 
     21#menu {  
     22    text-align: right;  
     23    clear: right;  
     24    background: #DDDDDD;  
     25    padding: 1px; 
     26    border-bottom: solid 1px black; 
    2427} 
    25 #header a img { 
    26     border: none; 
    27 } 
     28#submenu { clear: right; float: right; padding-top: 1em; } 
     29#submenu a { color: #000066; } 
    2830 
    29  
    30 #menu { 
    31     text-align: right; 
    32     clear: right; 
    33 } 
    34  
    35 #submenu { 
    36     clear: right; 
    37     float: right; 
    38     padding-top: 1em; 
    39 } 
    40 #submenu a { 
    41     color: #000066; 
    42 } 
    43  
    44 #quick_search { 
    45     position: absolute; 
    46     top: 2em; 
    47     right: 1em; 
    48 } 
    49  
     31#quick_search { position: absolute; top: 2em; right: 1em; } 
    5032#quick_search input { 
    5133    vertical-align: middle; 
     
    5335} 
    5436 
    55 #quick_search_pattern { 
    56 } 
     37#quick_search_pattern { } 
    5738 
    5839.item_visualization { 
     
    6243  margin-top: 1em; 
    6344} 
    64 .item_visualization select { 
    65   width: 200px; 
    66 } 
    67  
    68 .item_visualization img { 
    69   width: 300px; 
    70   border: solid 1px black; 
    71 } 
     45.item_visualization select { width: 200px; } 
     46.item_visualization img { width: 300px; border: solid 1px black; } 
    7247 
    7348 
     
    164139/* HTML dublin core display */ 
    165140 
    166 table.dublincore { 
    167     width: auto; 
    168 } 
     141table.dublincore { width: auto; } 
  • telemeta/models.py

    r01bf9f7 r3815c51  
    88# Author: Olivier Guilyardi <olivier@samalyse.com> 
    99 
    10 import telemeta 
    1110from django.db import models 
    1211from django.db.models import Q 
     12from django.core.exceptions import ObjectDoesNotExist 
     13from django.core import validators 
     14 
     15import telemeta 
    1316from telemeta.core import * 
    14 from django.core.exceptions import ObjectDoesNotExist 
    1517from telemeta import dublincore as dc 
     18 
     19# Regular (sub) expression for matching/validating media objects IDs 
     20media_id_regex = r'[0-9A-Za-z._:%?-]+' 
    1621 
    1722class MediaModel(Component): 
     
    2631        return fields_dict 
    2732 
    28 #    def dc_elements(self):         
    29 #        """Return model fields mapped to Dublin Core elements, as a dict of  
    30 #        the form: {dc_element_name: [value1, value2, ....], ...} 
    31 #        """ 
    32 #        fields_dict = {} 
    33 #        for field in self._meta.fields: 
    34 #            if (hasattr(field, 'dc_element')): 
    35 #                if fields_dict.has_key(field.dc_element): 
    36 #                    fields_dict[field.dc_element].append(getattr(self, field.name)) 
    37 #                else: 
    38 #                    fields_dict[field.dc_element] = [getattr(self, field.name)] 
    39 #                     
    40 #        return fields_dict 
    41  
    4233class PhysicalFormat(models.Model): 
    4334    value = models.CharField(maxlength=250) 
    44     is_dictionary = True 
     35    is_enumeration = True 
    4536    def __str__(self): 
    4637        return self.value 
    4738    class Meta: 
    4839        ordering = ['value'] 
     40         
     41class PublishingStatus(models.Model): 
     42    value = models.CharField(maxlength=250) 
     43    is_enumeration = True 
     44    def __str__(self): 
     45        return self.value 
     46    class Meta: 
     47        ordering = ['value'] 
     48        verbose_name_plural = "Publishing status" 
    4949         
    5050class MediaCollectionManager(models.Manager): 
     
    5656        ) 
    5757 
    58  
    5958class MediaCollection(models.Model, MediaCore): 
    6059    "Group related media items" 
     60 
     61    id_regex = media_id_regex 
     62    id_validator = validators.MatchesRegularExpression('^' + id_regex + '$') 
    6163 
    6264    publisher_reference = models.CharField(maxlength=250, blank=True) 
    6365    physical_format = models.CharField(maxlength=250, blank=True) 
    6466    id = models.CharField(maxlength=250, primary_key=True,  
    65         verbose_name='identifier') 
     67        verbose_name='identifier', validator_list=[id_validator]) 
    6668    title = models.CharField(maxlength=250) 
    6769    native_title = models.CharField(maxlength=250, blank=True) 
    6870    physical_items_num = models.CharField(maxlength=250, blank=True)  
    6971    publishing_status = models.CharField(maxlength=250, blank=True) 
    70     is_original = models.CharField(maxlength=250) 
    71     is_full_copy = models.CharField(maxlength=250) 
     72    is_original = models.CharField(maxlength=250, blank=True) 
     73    is_full_copy = models.CharField(maxlength=250, blank=True) 
    7274    copied_from = models.ForeignKey('self', null=True, blank=True) 
    7375    creator = models.CharField(maxlength=250) 
     
    147149    "Describe a item with metadata"  
    148150 
     151    id_regex = media_id_regex 
     152    id_validator = validators.MatchesRegularExpression('^' + id_regex + '$') 
     153 
    149154    ref = models.CharField(maxlength=250, blank=True) 
    150155    format = models.CharField(maxlength=250, blank=True) 
     
    152157    face_plage = models.CharField(maxlength=250, blank=True) 
    153158    id = models.CharField(maxlength=250, primary_key=True,  
    154         verbose_name='identifier') 
     159        verbose_name='identifier', validator_list=[id_validator]) 
    155160    duree = models.CharField(maxlength=250, blank=True) 
    156161    dates_enregistr = models.CharField(maxlength=250, blank=True) 
  • telemeta/templates/admin.html

    r7b2ff59 r3815c51  
    1111<li>Users</li> 
    1212 
    13 {% if dictionaries %} 
    14     <li>Dictionaries 
     13{% if enumerations %} 
     14    <li>Enumerations 
    1515    <ul> 
    16     {% for d in dictionaries %} 
    17         {%ifequal d.id dictionary_id %} 
    18             <li class="active">{{ d.name|capfirst }}</li> 
     16    {% for enum in enumerations %} 
     17        {%ifequal enum.id enumeration_id %} 
     18            <li class="active">{{ enum.name|capfirst }}</li> 
    1919        {%else%} 
    20             <li><a href="{% url telemeta-dictionary-edit d.id %}">{{ d.name|capfirst }}</a></li> 
     20            <li><a href="{% url telemeta-enumeration-edit enum.id %}"> 
     21                {{ enum.name|capfirst }}</a></li> 
    2122        {%endifequal%} 
    2223    {% endfor %} 
     
    2829<div class="tabcontents"> 
    2930    {% block tabcontents %} 
    30      
    31      
    32      
    33      
    34      
    3531    {% endblock %} 
    3632</div> 
  • telemeta/templates/base.html

    r01bf9f7 r3815c51  
    1414--> 
    1515<div id="header"> 
    16 <a href="/"><img src="/images/logo.png"></a> 
     16<div id="logo"> 
     17<a href="{% url telemeta-home %}"><img src="/images/logo.png"></a> 
     18</div> 
    1719 
    1820<div id="quick_search"> 
  • telemeta/templates/enumeration_edit.html

    r7b2ff59 r3815c51  
    22 
    33{% block tabcontents %} 
    4     <h4>Manage {{ dictionary_name_plural|capfirst }}</h4> 
     4    <h4>Manage {{ enumeration_name_plural|capfirst }}</h4> 
    55 
    66 
    77 
    88 <form class="addnew" id="addenum" method="post" 
    9         action="{% url telemeta-dictionary-add dictionary_id %}"> 
     9        action="{% url telemeta-enumeration-add enumeration_id %}"> 
    1010  <fieldset> 
    11    <legend>Add {{ dictionary_name|capfirst }}</legend> 
     11   <legend>Add {{ enumeration_name|capfirst }}</legend> 
    1212   <div class="field"> 
    1313    <label>Value: <input type="text" name="value"></label> 
     
    1919  </fieldset> 
    2020 </form> 
    21  {% if dictionary_values %} 
    22  <form method="POST" action="{% url telemeta-dictionary-update dictionary_id %}"> 
     21 {% if enumeration_values %} 
     22 <form method="POST" action="{% url telemeta-enumeration-update enumeration_id %}"> 
    2323  <table class="listing"> 
    2424   <thead> 
     
    2727    </tr> 
    2828   </thead><tbody> 
    29     {% for record in dictionary_values %} 
     29    {% for record in enumeration_values %} 
    3030    <tr> 
    3131     <td><input type="checkbox" name="sel" value="{{record.id}}" /></td> 
    32      <td><a href="{% url telemeta-dictionary-record-edit dictionary_id,record.id %}"> 
     32     <td><a href="{% url telemeta-enumeration-record-edit enumeration_id,record.id %}"> 
    3333        {{record.value}}</a></td> 
    3434    </tr> 
     
    4141 </form> 
    4242 {% else %} 
    43     <p class="help">This dictionary is empty.</p> 
     43    <p class="help">This enumeration is empty.</p> 
    4444 {% endif %} 
    4545 
    4646  <br style="clear: right"/> 
    47  
    4847{% endblock %} 
  • telemeta/templates/enumeration_edit_value.html

    r7b2ff59 r3815c51  
    22 
    33{% block tabcontents %} 
    4     <h4>Manage {{ dictionary_name_plural|capfirst }}</h4> 
     4    <h4>Manage {{ enumeration_name_plural|capfirst }}</h4> 
    55 
    66 <form class="mod" id="addenum" method="post" 
    7         action="{% url telemeta-dictionary-record-update dictionary_id,dictionary_record.id %}"> 
     7    action="{% url telemeta-enumeration-record-update enumeration_id,enumeration_record.id %}"> 
    88  <fieldset> 
    9    <legend>Modify {{ dictionary_name|capfirst }}</legend> 
     9   <legend>Modify {{ enumeration_name|capfirst }}</legend> 
    1010   <div class="field"> 
    11     <label>Value: <input type="text" name="value" value="{{dictionary_record.value}}" /></label> 
     11    <label>Value: <input type="text" name="value" value="{{enumeration_record.value}}" /></label> 
    1212 
    1313   </div> 
  • telemeta/urls.py

    r01bf9f7 r3815c51  
    2121all_collections = { 'queryset': MediaCollection.objects.all(), } 
    2222 
     23# ID's regular expressions 
     24i_ex = MediaItem.id_regex 
     25c_ex = MediaCollection.id_regex 
     26 
    2327urlpatterns = patterns('', 
    24     (r'^$', web_view.index), 
     28    url(r'^$', web_view.index, name="telemeta-home"), 
    2529 
    2630    # items 
     
    2832        dict(all_items, paginate_by=20, template_name="mediaitem_list.html"), 
    2933        name="telemeta-items"), 
    30     url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/$', web_view.item_detail,  
     34    url(r'^items/(?P<item_id>' + i_ex + ')/$', web_view.item_detail,  
    3135        name="telemeta-item-detail"), 
    32     url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/dc/$', web_view.item_detail,  
     36    url(r'^items/(?P<item_id>' + i_ex + ')/dc/$', web_view.item_detail,  
    3337        {'template': 'mediaitem_detail_dc.html'}, 
    3438        name="telemeta-item-dublincore"), 
    35     url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/dc/xml/$', web_view.item_detail,  
     39    url(r'^items/(?P<item_id>' + i_ex + ')/dc/xml/$', web_view.item_detail,  
    3640        {'format': 'dublin_core_xml'}, 
    3741        name="telemeta-item-dublincore-xml"), 
    38     url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/download/(?P<format>[0-9A-Z]+)/$',  
     42    url(r'^items/(?P<item_id>' + i_ex + ')/download/(?P<format>[0-9A-Z]+)/$',  
    3943        web_view.item_export, 
    4044        name="telemeta-item-export"), 
    41     url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/visualize/(?P<visualizer_id>[0-9a-z]+)/$',  
     45    url(r'^items/(?P<item_id>' + i_ex + ')/visualize/(?P<visualizer_id>[0-9a-z]+)/$',  
    4246        web_view.item_visualize, 
    4347        name="telemeta-item-visualize"), 
     
    5155        'django.views.generic.list_detail.object_list', 
    5256        dict(all_collections, paginate_by=20)), 
    53     url(r'^collections/(?P<object_id>[0-9A-Z._%?-]+)/$',  
     57    url(r'^collections/(?P<object_id>' + c_ex + ')/$',  
    5458        'django.views.generic.list_detail.object_detail', 
    5559        dict(all_collections, template_name="collection_detail.html"), 
    5660        name="telemeta-collection-detail"), 
    57     url(r'^collections/(?P<object_id>[0-9A-Z._%?-]+)/dc/$',  
     61    url(r'^collections/(?P<object_id>' + c_ex + ')/dc/$',  
    5862        'django.views.generic.list_detail.object_detail', 
    5963        dict(all_collections, template_name="collection_detail_dc.html"), 
     
    6670    url(r'^admin/$', web_view.admin_index, name="telemeta-admin"),         
    6771 
    68     # dictionaries administration 
    69     url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/$',  
    70         web_view.edit_dictionary , 
    71         name="telemeta-dictionary-edit"),         
    72     url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/add/$',  
    73         web_view.add_to_dictionary, 
    74         name="telemeta-dictionary-add"),         
    75     url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/update/$',  
    76         web_view.update_dictionary, 
    77         name="telemeta-dictionary-update"),         
    78     url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/(?P<value_id>[0-9]+)/$', 
    79         web_view.edit_dictionary_value, 
    80         name="telemeta-dictionary-record-edit"),    
    81  
    82     url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/(?P<value_id>[0-9]+)/update/$', 
    83         web_view.update_dictionary_value,  
    84         name="telemeta-dictionary-record-update"),   
    85  
     72    # enumerations administration 
     73    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/$',  
     74        web_view.edit_enumeration , 
     75        name="telemeta-enumeration-edit"),         
     76    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/add/$',  
     77        web_view.add_to_enumeration, 
     78        name="telemeta-enumeration-add"),         
     79    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/update/$',  
     80        web_view.update_enumeration, 
     81        name="telemeta-enumeration-update"),         
     82    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/' 
     83        + r'(?P<value_id>[0-9]+)/$', 
     84        web_view.edit_enumeration_value, 
     85        name="telemeta-enumeration-record-edit"),    
     86    url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/' 
     87        + r'(?P<value_id>[0-9]+)/update/$', 
     88        web_view.update_enumeration_value,  
     89        name="telemeta-enumeration-record-update"),    
    8690 
    8791    # CSS+Images (FIXME: for developement only) 
  • telemeta/views/web.py

    r01bf9f7 r3815c51  
    102102                     'items': items}) 
    103103 
    104     def __get_dictionary_list(self): 
     104    def __get_enumerations_list(self): 
    105105        from django.db.models import get_models 
    106106        models = get_models(telemeta.models) 
    107107 
    108         dictionaries = [] 
     108        enumerations = [] 
    109109        for model in models: 
    110             if getattr(model, "is_dictionary", False): 
    111                 dictionaries.append({"name": model._meta.verbose_name_plural,  
     110            if getattr(model, "is_enumeration", False): 
     111                enumerations.append({"name": model._meta.verbose_name_plural,  
    112112                    "id": model._meta.module_name}) 
    113         return dictionaries                     
     113        return enumerations                     
    114114     
    115115    def __get_admin_context_vars(self): 
    116         return {"dictionaries": self.__get_dictionary_list()} 
     116        return {"enumerations": self.__get_enumerations_list()} 
    117117 
    118118    def admin_index(self, request): 
    119119        return render_to_response('admin.html', self. __get_admin_context_vars()) 
    120120 
    121     def __get_dictionary(self, id): 
     121    def __get_enumeration(self, id): 
    122122        from django.db.models import get_models 
    123123        models = get_models(telemeta.models) 
     
    130130 
    131131        return model 
    132          
    133132 
    134     def edit_dictionary(self, request, dictionary_id):         
     133    def edit_enumeration(self, request, enumeration_id):         
    135134 
    136         dictionary  = self.__get_dictionary(dictionary_id) 
    137         if dictionary == None: 
     135        enumeration  = self.__get_enumeration(enumeration_id) 
     136        if enumeration == None: 
    138137            raise Http404 
    139138 
    140139        vars = self.__get_admin_context_vars() 
    141         vars["dictionary_id"] = dictionary._meta.module_name 
    142         vars["dictionary_name"] = dictionary._meta.verbose_name             
    143         vars["dictionary_name_plural"] = dictionary._meta.verbose_name_plural 
    144         vars["dictionary_values"] = dictionary.objects.all() 
    145         return render_to_response('dictionary_edit.html', vars) 
     140        vars["enumeration_id"] = enumeration._meta.module_name 
     141        vars["enumeration_name"] = enumeration._meta.verbose_name             
     142        vars["enumeration_name_plural"] = enumeration._meta.verbose_name_plural 
     143        vars["enumeration_values"] = enumeration.objects.all() 
     144        return render_to_response('enumeration_edit.html', vars) 
    146145 
    147     def add_to_dictionary(self, request, dictionary_id):         
     146    def add_to_enumeration(self, request, enumeration_id):         
    148147 
    149         dictionary  = self.__get_dictionary(dictionary_id) 
    150         if dictionary == None: 
     148        enumeration  = self.__get_enumeration(enumeration_id) 
     149        if enumeration == None: 
    151150            raise Http404 
    152151 
    153         dictionary_value = dictionary(value=request.POST['value']) 
    154         dictionary_value.save() 
     152        enumeration_value = enumeration(value=request.POST['value']) 
     153        enumeration_value.save() 
    155154 
    156         return self.edit_dictionary(request, dictionary_id) 
     155        return self.edit_enumeration(request, enumeration_id) 
    157156 
    158     def update_dictionary(self, request, dictionary_id):         
     157    def update_enumeration(self, request, enumeration_id):         
    159158         
    160         dictionary  = self.__get_dictionary(dictionary_id) 
    161         if dictionary == None: 
     159        enumeration  = self.__get_enumeration(enumeration_id) 
     160        if enumeration == None: 
    162161            raise Http404 
    163162 
    164163        if request.POST.has_key("remove"): 
    165             dictionary.objects.filter(id__in=request.POST['sel']).delete() 
     164            enumeration.objects.filter(id__in=request.POST.getlist('sel')).delete() 
    166165 
    167         return self.edit_dictionary(request, dictionary_id) 
     166        return self.edit_enumeration(request, enumeration_id) 
    168167 
    169     def edit_dictionary_value(self, request, dictionary_id, value_id):         
     168    def edit_enumeration_value(self, request, enumeration_id, value_id):         
    170169 
    171         dictionary  = self.__get_dictionary(dictionary_id) 
    172         if dictionary == None: 
     170        enumeration  = self.__get_enumeration(enumeration_id) 
     171        if enumeration == None: 
    173172            raise Http404 
    174173         
    175174        vars = self.__get_admin_context_vars() 
    176         vars["dictionary_id"] = dictionary._meta.module_name 
    177         vars["dictionary_name"] = dictionary._meta.verbose_name             
    178         vars["dictionary_name_plural"] = dictionary._meta.verbose_name_plural 
    179         vars["dictionary_record"] = dictionary.objects.get(id__exact=value_id) 
    180         return render_to_response('dictionary_edit_value.html', vars) 
     175        vars["enumeration_id"] = enumeration._meta.module_name 
     176        vars["enumeration_name"] = enumeration._meta.verbose_name             
     177        vars["enumeration_name_plural"] = enumeration._meta.verbose_name_plural 
     178        vars["enumeration_record"] = enumeration.objects.get(id__exact=value_id) 
     179        return render_to_response('enumeration_edit_value.html', vars) 
    181180 
    182     def update_dictionary_value(self, request, dictionary_id, value_id):         
     181    def update_enumeration_value(self, request, enumeration_id, value_id):         
    183182 
    184183        if request.POST.has_key("save"): 
    185             dictionary  = self.__get_dictionary(dictionary_id) 
    186             if dictionary == None: 
     184            enumeration  = self.__get_enumeration(enumeration_id) 
     185            if enumeration == None: 
    187186                raise Http404 
    188187        
    189             record = dictionary.objects.get(id__exact=value_id) 
     188            record = enumeration.objects.get(id__exact=value_id) 
    190189            record.value = request.POST["value"] 
    191190            record.save() 
    192191 
    193         return self.edit_dictionary(request, dictionary_id) 
     192        return self.edit_enumeration(request, enumeration_id) 
    194193 
    195194         
    196 def media_item_edit(request, media_item_id): 
    197     "Provide MediaItem object edition" 
    198  
    199     media_item = MediaItem.objects.get(pk=media_item_id) 
    200     dynprops = media_item.get_dynamic_properties() 
    201     return render_to_response('media_item.html', {'media_item': media_item, 'dynprops' : dynprops}) 
    202  
    203 def media_item_update(request, media_item_id): 
    204     "Handle MediaItem object edition form submission" 
    205  
    206     media_item = MediaItem.objects.get(pk=media_item_id) 
    207     media_item.author = request.POST['author'] 
    208     media_item.title = request.POST['title'] 
    209     media_item.save() 
    210  
    211     pattern = re.compile(r'^dynprop_(\d+)$') 
    212     for name, value in request.POST.items(): 
    213         match = pattern.search(name) 
    214         if match: 
    215             prop_id = match.groups()[0] 
    216             prop = MediaItemPropertyDefinition.objects.get(pk=prop_id) 
    217             telemeta.logger.debug("prop_id: " + prop_id + " ; " + "media_item_id: " +  
    218                                     media_item_id + " ; value: " + value +  
    219                                     " ; type:" + prop.type) 
    220             media_item = MediaItem.objects.get(pk=media_item_id) 
    221             property, created = MediaItemProperty.objects.get_or_create( 
    222                                     media_item=media_item, definition=prop) 
    223  
    224             if prop.type == 'text': 
    225                 property.value = value 
    226             else: 
    227                 value = int(value) 
    228  
    229                 if value > 0: 
    230                     enum_item = MediaItemPropertyEnumerationItem.objects.get(pk=value) 
    231                     property.enum_item = enum_item 
    232                 else: 
    233                     property.enum_item = 0 
    234  
    235             property.save() 
    236  
    237     return media_item_edit(request, media_item_id) 
    238      
    239195     
    240196     
Note: See TracChangeset for help on using the changeset viewer.