Changeset 1183 in main


Ignore:
Timestamp:
06/06/12 15:31:33 (7 years ago)
Author:
zali
Message:

Template revision: revisions displayed as in the browse page

Location:
trunk/openPLM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/views/main.py

    r1182 r1183  
    494494                ctx["part_formset"] = forms.SelectPartFormset(queryset=parts) 
    495495        ctx["add_revision_form"] = add_form 
    496  
    497496    ctx["confirmation"] = confirmation 
    498497    revisions = obj.get_all_revisions() 
     498         
     499    ctx["thumbnails"] = {} 
     500    ctx["num_files"] = {} 
     501     
     502    ids=[] 
     503    for revision in revisions : 
     504        ids.append(revision.id) 
     505    #ids = revisions.values_list("id", flat=True) 
     506    thumbnails = models.DocumentFile.objects.filter(deprecated=False, 
     507                document__in=ids, thumbnail__isnull=False) 
     508    ctx["thumbnails"].update(dict(thumbnails.values_list("document", "thumbnail"))) 
     509    num_files = dict.fromkeys(ids, 0) 
     510    for doc_id in models.DocumentFile.objects.filter(deprecated=False, 
     511        document__in=ids).values_list("document", flat=True): 
     512            num_files[doc_id] += 1 
     513            ctx["num_files"] = num_files 
     514         
    499515    ctx.update({'current_page' : 'revisions', 
    500516                'revisions' : revisions, 
  • trunk/openPLM/templates/revisions.html

    r1181 r1183  
    33<!-- Manage html display in the Content div which correspond to the "revisions" menu --> 
    44 
     5{% block css %} 
     6<style type="text/css"> 
     7div.identity_card:last-child{ 
     8    /*border: 2px solid red;*/ 
     9    box-shadow: 3px 3px 9px #C90657; 
     10} 
     11</style> 
     12{% endblock %} 
    513{% block content %} 
    614    {% if add_revision_form and obj.is_revisable %} 
     
    3038        {% endif %} 
    3139    {% endif %} 
    32     <table class="Content"> 
     40    <div id="rev_list" class="Content"> 
    3341        {% for object in revisions %} 
    34             <tr class="Content"> 
    35                 <td class="Content"> 
    36                     <a href="{{object.plmobject_url}}">{{object.reference}}</a> 
    37                 </td> 
    38                 <td class="Content">{{object.revision}}</td> 
    39                 <td class="Content">{{object.type}}</td> 
    40                 <td class="Content">{{object.state.name}}</td> 
    41             </tr>        
     42            {% if object.is_part %} 
     43                {% include "parts/identity_card.html" %} 
     44            {% else %} 
     45                {% include "documents/identity_card.html" %} 
     46            {% endif %} 
    4247        {% endfor %} 
    43     </table> 
     48    </div> 
    4449{% endblock %} 
    4550 
Note: See TracChangeset for help on using the changeset viewer.