Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Renderizar itens no html em formato de label
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Adley Damaceno  
View profile   Translate to Translated (View Original)
 More options Nov 19 2012, 12:11 pm
From: Adley Damaceno <adleydamac...@gmail.com>
Date: Mon, 19 Nov 2012 09:11:01 -0800 (PST)
Local: Mon, Nov 19 2012 12:11 pm
Subject: Renderizar itens no html em formato de label

Existe algum meio de eu instanciar um formulario (  com os campos ja
preenchidos ) e deixar os campos não editaveis?

Minha pergunta é essa , existe algum meio de a pessoa apenas visualizar o
formulário?
nem que seja por javascript ou próprio django?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leonardo S  
View profile   Translate to Translated (View Original)
 More options Nov 19 2012, 12:17 pm
From: Leonardo S <leonardo.s.c...@gmail.com>
Date: Mon, 19 Nov 2012 14:17:15 -0300
Local: Mon, Nov 19 2012 12:17 pm
Subject: Re: Renderizar itens no html em formato de label
Tenta algo assim. Não testei:
test_field = forms.CharField(label=u'Test',
widget=forms.TextInput(attrs={u'readonly':u'readonly'}))

Em 19 de novembro de 2012 14:11, Adley Damaceno
<adleydamac...@gmail.com> escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matheus Lima  
View profile   Translate to Translated (View Original)
 More options Nov 19 2012, 12:17 pm
From: Matheus Lima <matheus...@gmail.com>
Date: Mon, 19 Nov 2012 14:17:06 -0300
Local: Mon, Nov 19 2012 12:17 pm
Subject: Re: Renderizar itens no html em formato de label

Tem várias formas de fazer isso. Uma delas é essa:

No Form, criar o campo e passar o atributo "readonly" pro widget.

sku = forms.CharField(widget = forms.TextInput(attrs={'readonly':'readonly'}))

Coloca aí no google "django form readonly", tem várias formas.

Em 19 de novembro de 2012 14:11, Adley Damaceno
<adleydamac...@gmail.com>escreveu:

> Existe algum meio de eu instanciar um formulario (  com os campos ja
> preenchidos ) e deixar os campos não editaveis?

> Minha pergunta é essa , existe algum meio de a pessoa apenas visualizar o
> formulário?
> nem que seja por javascript ou próprio django?

> --

--
Att,
*
*
*Matheus dos Santos Lima  ** <http://twitter.com/matheeusLimaaa>
<http://www.facebook.com/profile.php?id=100001639854566>
 *

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adley Damaceno  
View profile   Translate to Translated (View Original)
 More options Nov 19 2012, 12:24 pm
From: Adley Damaceno <adleydamac...@gmail.com>
Date: Mon, 19 Nov 2012 09:24:48 -0800 (PST)
Local: Mon, Nov 19 2012 12:24 pm
Subject: Re: Renderizar itens no html em formato de label

Valeu pessoal, vou dar uma olhada....

Segunda-feira, 19 de Novembro de 2012 15:11:01 UTC-2, Adley Damaceno
escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adley Damaceno  
View profile   Translate to Translated (View Original)
 More options Nov 19 2012, 12:32 pm
From: Adley Damaceno <adleydamac...@gmail.com>
Date: Mon, 19 Nov 2012 09:32:46 -0800 (PST)
Local: Mon, Nov 19 2012 12:32 pm
Subject: Re: Renderizar itens no html em formato de label

Não tem como deixar tudo readonly?

Segunda-feira, 19 de Novembro de 2012 15:24:48 UTC-2, Adley Damaceno
escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matheus Lima  
View profile   Translate to Translated (View Original)
 More options Nov 19 2012, 12:43 pm
From: Matheus Lima <matheus...@gmail.com>
Date: Mon, 19 Nov 2012 14:43:33 -0300
Local: Mon, Nov 19 2012 12:43 pm
Subject: Re: Renderizar itens no html em formato de label

Eu sei uma forma de fazer, mas não sei se é a melhor solução.

Sobrescrevendo o método __init__() do form, dá fazer isso aqui:

def __init__(self, *args, **kwargs):
    super(MeuForm, self).__init__(*args, **kwargs)
    for field in self.fields:
        field.widget.attrs.update({'readonly':'readonly'})

Assim todos os campos set tornam readonly. Também é uma das formas, tem
outras formas de fazer, como por exemplo, extender a classe forms.Form ou
forms.ModelForm pra ficar um ReadOnlyForm.

Em 19 de novembro de 2012 14:32, Adley Damaceno
<adleydamac...@gmail.com>escreveu:

--
Att,
*
*
*Matheus dos Santos Lima  ** <http://twitter.com/matheeusLimaaa>
<http://www.facebook.com/profile.php?id=100001639854566>
 *

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
leonardo  
View profile   Translate to Translated (View Original)
 More options Nov 19 2012, 1:09 pm
From: leonardo <leonardo.s.c...@gmail.com>
Date: Mon, 19 Nov 2012 10:09:47 -0800 (PST)
Local: Mon, Nov 19 2012 1:09 pm
Subject: Re: Renderizar itens no html em formato de label

Pode estender a classe CharField e deixar o padrão como readonly. Aí é só
instanciar algo tipo ReadOnlyCharField.

Em segunda-feira, 19 de novembro de 2012 14h43min59s UTC-3, Matheus dos
Santos Lima escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adley Damaceno  
View profile   Translate to Translated (View Original)
 More options Nov 20 2012, 9:21 am
From: Adley Damaceno <adley...@yahoo.com.br>
Date: Tue, 20 Nov 2012 12:21:05 -0200
Local: Tues, Nov 20 2012 9:21 am
Subject: Re: Renderizar itens no html em formato de label

def __init__(self, *args, **kwargs):
    super(MeuForm, self).__init__(*args, **kwargs)
    for field in self.fields:
        field.widget.attrs.update({'readonly':'readonly'})
isso não funcionou, os campos continuam sendo editáveis

Em 19 de novembro de 2012 16:09, leonardo <leonardo.s.c...@gmail.com>escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adley Damaceno  
View profile   Translate to Translated (View Original)
 More options Nov 20 2012, 9:25 am
From: Adley Damaceno <adley...@yahoo.com.br>
Date: Tue, 20 Nov 2012 12:24:59 -0200
Local: Tues, Nov 20 2012 9:24 am
Subject: Re: Renderizar itens no html em formato de label

class FormVisualizarRequisicao(forms.ModelForm):
    class Meta:
        model = models.CadastrarRequisicao
def __init__(self, *args, **kwargs):
    super(FormVisualizarRequisicao, self).__init__(*args, **kwargs)
    for field in self.fields:
        field.widget.attrs.update({'readonly':'readonly'})

Em 20 de novembro de 2012 12:21, Adley Damaceno <adley...@yahoo.com.br>escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adley Damaceno  
View profile   Translate to Translated (View Original)
 More options Nov 20 2012, 9:25 am
From: Adley Damaceno <adley...@yahoo.com.br>
Date: Tue, 20 Nov 2012 12:25:20 -0200
Local: Tues, Nov 20 2012 9:25 am
Subject: Re: Renderizar itens no html em formato de label

Não funcionou =/

class FormVisualizarRequisicao(forms.ModelForm):
    class Meta:
        model = models.CadastrarRequisicao
def __init__(self, *args, **kwargs):
    super(FormVisualizarRequisicao, self).__init__(*args, **kwargs)
    for field in self.fields:
        field.widget.attrs.update({'readonly':'readonly'})

Em 20 de novembro de 2012 12:21, Adley Damaceno <adley...@yahoo.com.br>escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »