-
BuffaloSoldier has quit
-
BuffaloSoldier joined the channel
-
graphene has quit
-
graphene joined the channel
-
audioburn joined the channel
-
graphene joined the channel
-
FlavioZ has quit
-
robotme has quit
-
robotme joined the channel
-
robotme has quit
-
eht joined the channel
-
robotme joined the channel
-
robotme has quit
-
two_tired2 has quit
-
agrawalritesh joined the channel
-
robotme joined the channel
-
babykosh joined the channel
-
babykosh has quit
-
graphene joined the channel
-
jaddison has quit
-
catonano joined the channel
-
catonano has quit
-
catonano joined the channel
-
catonano has quit
-
catonano joined the channel
-
sydbarret joined the channel
-
sydbarret
is there a django channel in spanish?
-
graphene joined the channel
-
chasonchaffin joined the channel
-
sh3iny joined the channel
-
aossama joined the channel
-
SmileyChris has quit
-
jessamynsmith joined the channel
-
BuffaloSoldier has quit
-
FunkyBob
sydbarret: if there is it would be #django-es I expect
-
BuffaloSoldier joined the channel
-
sydbarret
FunkyBob its almost empty. Ok let me ask you know how to display the primary key in the template?
-
schinckel
{{ instance.pk }}
-
sydbarret
like this? id = forms.BigAutoField(disabled=True, required=False)
-
shinckel is that on the template?
-
schinckel
Why do you want a primary key form input element? You don't want the user to be able to change that, do you?
-
FunkyBob
sydbarret: stop using disabled form fields!
-
{{ form.instance.pk }}
-
chasonchaffin has quit
-
eht has quit
-
sydbarret
FunkyBob i have to use disable to have them readonly If I dont use that the user can edit the field
-
FunkyBob
you don't need it on the form at all!
-
chasonchaffin joined the channel
-
schinckel
Yeah, disabled should only be a thing if it's likely to be enabled by JS under certain circumstances.
-
Otherwise, just leave it off the form.
-
sydbarret
But when I left it i can edit the fields
-
schinckel
No, leave the whole field off!
-
FunkyBob
we've been over this, sydbarret
-
sydbarret
FunkyBob you didnt explain well haha
-
FunkyBob
I told you: if you don't want the user to edit the field, do not put it on the form
-
cjwelborn joined the channel
-
how much simpler do you want it?
-
sydbarret
and im telling you it doest work
-
FunkyBob
what doesn't work?
-
sydbarret
it renders and they i can edit
-
and it shouldnt let me
-
FunkyBob
show the code
-
schinckel
Show us your form class definition.
-
FunkyBob
and the view where you build the modelform_set
-
sydbarret
-
FunkyBob
so you dropped the fields list I told you to put on before
-
sydbarret
-
PaulWay[w]
Just how crispy are Django crispy forms?
-
FunkyBob
-
PaulWay[w]: meh
-
sjms has quit
-
sjms joined the channel
-
PaulWay[w]
OK :-)
-
schinckel
sydbarret: Don't use exclude. List the fields you want in fields instead.
-
sydbarret
perhaps im confounded witth the other conditions, if you see the view I have 3 if statements
-
some of them might be enabling the fields?
-
cause the fields are editable
-
and only checkbox should editable
-
schinckel
So only include that field. Get rid of exclude altogether.
-
drodger has quit
-
sydbarret
schinckel and how do i prevent the fields to be editable
-
cause right now they are
-
schinckel
Don't include those fields: instead just render the value using {{ form.instance.<field> }}
-
sydbarret
they are only readonly when I put a_search_term=forms.CharField(disabled=True,required=False)
-
FunkyBob
...
-
yes you keep saying that... and we keep saying don't do that
-
graphene joined the channel
-
sydbarret
-
im able to edit those boxes
-
and user should not do it
-
let me restart the service
-
cause at the moment my form has only the meta class you paste it
-
greg_f joined the channel
-
drodger joined the channel
-
funky could it be because the other if statements? Im using GET method to filter the formset based on 4 combo boxes
-
FunkyBob
it could be you're editing the entirely wrong form class, for all we know
-
sydbarret
I have 2 GET and 1 POST
-
FunkyBob
also we haven't seen your template
-
sydbarret
-
robotme_ joined the channel
-
robotme has quit
-
robotme_ is now known as robotme
-
FunkyBob
sydbarret: in your view function, just bfore your call the modelform_set factory... print(FixChangesForm.fields.keys())
-
sydbarret
which line?
-
i have many modelformset_factory
-
FunkyBob
how many views are we talking about right now?
-
just the 1 I hope
-
sydbarret
let me paste you the whole view
-
-
its a single view but I have 3 if statements depending which button was clicked
-
FunkyBob
so you've left in the bit wehere you pass a full list of fields
-
.... and then wonder why it treats it as you passing a fuill list of fields
-
in the modelformset_factory calls... STOP passing fields lists... since you've defined them on the Form class itself
-
sydbarret
so I have to delete the fields=(..) there?
-
FunkyBob
yes
-
sydbarret
but how will it render them?
-
n000b joined the channel
-
FunkyBob
as I told you earlier
-
sydbarret
in the forms you made me delete
-
FunkyBob
you can still access all the values on the model instance
-
by accessing form.instance
-
so render _them_
-
sydbarret
so after delete them where I have to put the list?
-
FunkyBob
delete which? put which list?
-
sydbarret
if i understand I have to delete the fields=(.... from all my modelformset_factory
-
FunkyBob
yes
-
sydbarret
and then?
-
FunkyBob
then edit your template
-
for all the values you want to show that are not form fields... access them as form.instance.whatever
-
because at that point form.instance is the model instance that form is editing
-
sydbarret
ok let me try
-
sunil_bansal joined the channel
-
they appear but they lost the format. the boxes got lost
-
FunkyBob
because they're no longer rendered as html inputs
-
the main point is the forms now will absolutely NOT update anything but that one field
-
tdy1 joined the channel
-
sydbarret
but now also clientrevert is readonly
-
schinckel
If you really (for visual purposes) want to render them as disabled inputs, then you can do that quite easily.
-
jessamynsmith has quit
-
<input {% if form.instance.<field> %}checked=checked{% endif %} type=checkbox>
-
FunkyBob
sydbarret: you left that as {{ form.clientrevert }} right?
-
sydbarret
oh so without instance
-
FunkyBob
05:25 <+FunkyBob> for all the values you want to show that are not form fields... access them as form.instance.whatever
-
sydbarret
cool works now
-
so how do i set them with format ?
-
they are too tight together
-
FunkyBob
"them"?
-
sydbarret
yes the columns
-
FunkyBob
stop being so vague!
-
tdy has quit