2010-08-27 8 views
6

Ho un modulo web dJango da un modello con alcuni errori di verifica (campo email valido, ecc.). Tutto funziona bene in vari browser Opera, Camino, Netscape, Safari e IE (eccetto IE7).Forme di Django che si spezzano in IE7

Tutto ciò che ottengo in IE7 è il messaggio 'Internet Explorer non può visualizzare la pagina web'. Se i moduli validi i dati vengono scritti nel database, penso che abbia qualcosa a che fare con lo stage di reindirizzamento.

Ho provato varie cose metodo = invio e invio modulo javascript ma nulla sembra fermare IE7 dandomi questo errore.

Qualsiasi aiuto sarebbe apprezzato.

forms.py modello

class NewElectiveForm(ModelForm): 
    host_country = forms.CharField(widget=forms.widgets.Select(choices=COUNTRIES) , label="Destination") 
    host_type  = forms.CharField(widget=forms.widgets.Select(choices=HOST_TYPE) , label="Location type")  
    host_name  = forms.CharField(max_length=256, label="Name of host institution") 
    host_street  = forms.CharField(required = False, max_length=100, label="Street") 
    host_city  = forms.CharField(required = False, max_length=100, label="City") 
    host_district = forms.CharField(required = False, max_length=100, label="District") 
    host_zipcode = forms.CharField(required = False, max_length=100, label="Zipcode") 
    host_supervisor = forms.CharField(required = False, max_length=256, label="Name of supervisor") 
    host_email  = forms.EmailField(required = False, max_length=100, label="Email") 
    host_fax  = forms.CharField(required = False, max_length=100, label="Fax.No.") 
    host_tel  = forms.CharField(required = False, max_length=100, label="Tel.No.") 
    start_date  = forms.DateField(widget=SelectDateWidget(),label="Elective start date") 
    end_date  = forms.DateField(widget=SelectDateWidget(),label="Elective end date") 
    subject   = forms.CharField(required = False, max_length=256,label="Subject") 
    reasons   = forms.CharField(required = False, widget=forms.widgets.Textarea(attrs={'class':'question'}), label="Please state briefly the reasons for this choice's location and subject") 
    outcomes  = forms.CharField(required = False, widget=forms.widgets.Textarea(attrs={'class':'question'}), label="Please give upto to 4 outcomes that you hope to achieve during this elective") 
    your_mobile  = forms.CharField(required = False, max_length=100, label="Please provide your mobile number if you are taking it with you")   
    insurance  = forms.BooleanField(required = False, label="Please confirm that you have arranged holiday insurance") 
    malpractice  = forms.BooleanField(required = False, label="Please confirm that you have medical malpractice cover") 
    groupinfo  = forms.CharField(required = False, label="If you planning your Elective in a group, please list your fellow students") 
    #risk_upload = forms.FileField(widget=AdminFileWidget, required = False, label='Upload a completed risk assesment form') 
    #evidence_upload = forms.FileField(widget=AdminFileWidget, required = False, label='Upload an evidence document') 


    class Meta: 
      model = ElectiveRecord   
      exclude = ('id', 'review','elective', 'status', 'edit_userid','modified') 

html:

<form enctype="multipart/form-data" method="post" class="uniForm" id="newform" > 
    {% for i in form %} 
    <div class="fieldwrapper {% for error in i.errors %} error {% endfor %}"> 
{% for error in i.errors %} 
    <b>{{error|escape}}</b><br/> 
{% endfor %} 
{{ i.label_tag }} : 
    {% if i.html_name == "reasons" or i.html_name == "outcomes" %} <br/> {% endif %} 
{{ i }} 
{% if i.html_name == "evidence_upload" %} <br/>latest file= xxx {% endif %} 
     {% if i.html_name == "risk_upload" %} <br/>latest file= xxx {% endif %} 
</div> 
    {%endfor%} 
    <div class="fieldWrapper"> <input type="submit" value="Save" NAME='save' > </div> 
</form> 

models.py

class ElectiveRecord(models.Model): 
     elective  = models.ForeignKey(Elective, null=True, blank=True) 
     status   = models.CharField(choices=ELECTIVE_STATUS_FLAGS, max_length=40) 
     edit_date  = models.DateTimeField(auto_now_add=True)   
     edit_userid  = models.CharField(max_length=12) 
     host_country = models.CharField(max_length=100, help_text="Destination") 
     host_type  = models.CharField(choices=HOST_TYPE, max_length=10, help_text="Location type")  
     host_name  = models.CharField(max_length=256, help_text="Name of host institution") 
     host_street  = models.CharField(max_length=100, help_text="Street") 
     host_city  = models.CharField(max_length=100, help_text="City") 
     host_district = models.CharField(max_length=100, help_text="District") 
     host_zipcode = models.CharField(max_length=100, help_text="Zipcode") 
     host_supervisor = models.CharField(max_length=256, help_text="Name of supervisor") 
     host_email  = models.CharField(max_length=100, help_text="Email") 
     host_fax  = models.CharField(max_length=100, blank=True, help_text="Fax.No.") 
     host_tel  = models.CharField(max_length=100, help_text="Tel.No.") 
     start_date  = models.DateField(help_text="Elective start date") 
     end_date  = models.DateField(help_text="Elective end date") 
     subject   = models.CharField(max_length=256,help_text="Tel.No.") 
     reasons   = models.TextField(help_text="Please state briefly the reasons for this choice's location and subject") 
     outcomes  = models.TextField(help_text="Please give upto to 4 outcomes that you hope to achieve during this elective") 
     your_mobile  = models.CharField(max_length=100, blank=True, help_text="Please provide your mobile number if you are taking it with you")   
     insurance  = models.BooleanField(default=False, help_text="Please confirm that you have arranged holiday insurance") 
     malpractice  = models.BooleanField(default=False, help_text="Please confirm that you have medical malpractice cover") 
     groupinfo  = models.CharField(max_length=256, blank=True, help_text="If you planning your Elective in a group, please list your fellow students") 
     modified  = models.DateTimeField(auto_now_add=True)   
     class Meta: 
       get_latest_by = 'modified'   
     def __unicode__(self): 
       return u"[%s] %s, %s " % (self.id,self.host_name,self.subject) 
+1

Dovrai mostrare il codice di visualizzazione prima che qualcuno possa aiutare realisticamente. Inoltre, cosa sta succedendo sul log del tuo server (apache o runserver)? –

+0

Ho notato che ciò accade solo quando si utilizza il server di sviluppo "runserver". Sto solo usando la vista standard auth_login. Django 1.2.3 – dlamotte

risposta

1

Conferma che è la fase di reindirizzamento che sta causando il problema sostituendo

HttpResponseRedirect(url) 

con

HttpResponse('<!DOCTYPE html><html><head><title>title</title></head><body><a href="%(url)s">%(url)s</a></body></html>' % {'url':url}) 

Se questo non rende, allora il problema sta accadendo prima del reindirizzamento. Se esegue il rendering, il problema potrebbe essere il reindirizzamento o potrebbe essere la pagina reindirizzata. Clicca sul link. Se la pagina successiva viene visualizzata correttamente, il problema è quasi certamente il reindirizzamento stesso. In caso contrario, il problema è nella pagina reindirizzata.

Problemi correlati