Changeset 711

Show
Ignore:
Timestamp:
11/25/10 09:18:48 (3 years ago)
Author:
jose.brandao
Message:

Changing to make possible find published trials by trial_id

Location:
trunk/opentrials
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/opentrials/repository/templates/repository/clinicaltrial_list.html

    r706 r711  
    1818                <td class="trial_label" width="50%">{% trans 'Title' %}</td> 
    1919                <td class="trial_label" width="30%">{% trans 'Primary Id Number' %}</td> 
    20                 <td class="trial_content" width="20%"><a href="{% url repository.trial_registered ct.hash_code %}">{{ ct.trial_id }}</a></td> 
     20                <td class="trial_content" width="20%"><a href="{% url repository.trial_registered ct.trial_id %}">{{ ct.trial_id }}</a></td> 
    2121            </tr> 
    2222            <tr> 
    23                 <td class="trial_title" rowspan="2"><a href="{% url repository.trial_registered ct.hash_code %}">{{ ct.main_title }}</a></td> 
     23                <td class="trial_title" rowspan="2"><a href="{% url repository.trial_registered ct.trial_id %}">{{ ct.main_title }}</a></td> 
    2424                <td class="trial_label">{% trans 'Recruitment Status' %}</td> 
    2525                <td class="trial_content">{{ ct.rec_status }}</td> 
  • trunk/opentrials/repository/views.py

    r709 r711  
    22 
    33from django.core import serializers 
    4 from django.http import HttpResponseRedirect, HttpResponse 
     4from django.http import HttpResponseRedirect, HttpResponse, Http404 
    55from django.shortcuts import render_to_response, get_object_or_404 
    66from django.utils.translation import ugettext_lazy as _ 
     
    307307def trial_registered(request, trial_fossil_id): 
    308308    ''' show details of a trial registered ''' 
    309     fossil = get_object_or_404(Fossil, pk=trial_fossil_id) 
     309    try: 
     310        fossil = Fossil.objects.get(pk=trial_fossil_id) 
     311    except Fossil.DoesNotExist: 
     312        try: 
     313            fossil = Fossil.objects.get(is_most_recent=True, serialized__contains='"trial_id": "%s"'%trial_fossil_id) 
     314        except Fossil.DoesNotExist: 
     315            raise Http404 
    310316 
    311317    ct = fossil.get_object_fossil() 
  • trunk/opentrials/reviewapp/templates/reviewapp/index.html

    r710 r711  
    5454        {% for ct in clinical_trials %} 
    5555            <li> 
    56                 <a class="NewsTitle" href="{% url repository.trial_registered ct.hash_code %}">{{ ct.short_title }}</a> 
     56                <a class="NewsTitle" href="{% url repository.trial_registered ct.trial_id %}">{{ ct.short_title }}</a> 
    5757                <p> 
    58                     <b>{% trans 'Primary Id Number' %}</b>: <a class="pnumber" href="{% url repository.trial_registered ct.hash_code %}">{{ ct.trial_id }}</a><br/> 
     58                    <b>{% trans 'Primary Id Number' %}</b>: <a class="pnumber" href="{% url repository.trial_registered ct.trial_id %}">{{ ct.trial_id }}</a><br/> 
    5959                </p> 
    6060            </li> 
  • trunk/opentrials/reviewapp/views.py

    r710 r711  
    7676        show_beta_message = False 
    7777         
    78     fossil_trials = ClinicalTrial.fossils.order_by('-creation')[:3] 
     78    fossil_trials = ClinicalTrial.fossils.published().order_by('-creation')[:3] 
    7979    clinical_trials = fossil_trials.proxies() 
    80      
    81     """ 
    82     for trial in clinical_trials: 
    83         try: 
    84             #trans = trial.translations.get(language__iexact=request.LANGUAGE_CODE) 
    85             trans = ClinicalTrialTranslation.objects.get_translation_for_object( 
    86                         request.LANGUAGE_CODE.lower(), trial, 
    87                         ) 
    88         except ClinicalTrialTranslation.DoesNotExist: 
    89             trans = None 
    90          
    91         if trans: 
    92             if trans.public_title: 
    93                 trial.public_title = trans.public_title 
    94             if trans.public_title: 
    95                 trial.scientific_title = trans.scientific_title 
    96     """ 
    9780 
    9881    return render_to_response('reviewapp/index.html', {