Yeah, that will do it. I generally do a context = super(...).get_context_data(...) call first, and then do a context.update(...)
(And return that).
Just means that if any of the parent classes also write the same key, yours will win.
noregret
makes sense
michalmo joined the channel
pupil has quit
schinckel: i want here to put some initial values in a form, so i thought of sending it thru context.
schinckel: because using 'initial' will require me to have the fields already there
turbofish joined the channel
schinckel: and i want those fields to appear only in certain conditions
schinckel
If it's really initial data for a form, then it belongs there.
noregret
not sure if i'm clear
cb_ein
Hi. I have one DRF ModelSerializer and set nested field as required=False, but DRF whatever says 'this field is required'. Can anybody help me?
schinckel
You can dynamically alter the form.fields dict.
That may be a better approach, rather than having that decision made in your template.
noregret
schinckel: yeah, but i'm not. I want to add extra fields with values just for display, it won't be posted
schinckel: so i'm using input fields with readonly
not sure if it's the right way to go
av_n joined the channel
schinckel
You could use input with disabled: that way it won't be sent back.
Or just render the text in a span.
noregret
got it
avnee has quit
mandeep has quit
SteenJobs joined the channel
xterm joined the channel
jcda has quit
jcda joined the channel
jcda has quit
av_n has quit
codeme joined the channel
robbyoconnor joined the channel
FinalAngel joined the channel
I have model A o2o B and A o2o C. When A is inserted, B or C will follow, not both. In a listing of A, how can i figure out whether B or C is associated with A?
ambar_ joined the channel
LondonAppDev joined the channel
ubernostrum joined the channel
ambar has quit
ambar_ is now known as ambar
emk joined the channel
djapo has quit
jaywink joined the channel
codeme has quit
xterm
noregret: could you rephrase your question? do you have a B and a C?
whaack joined the channel
noregret
xterm: yes, all 3 models
xterm: When A is going to inserted, either B or C will follow it.
xterm
noregret: A.objects.filter(Q(b=b) | Q(c=c))
noregret
so usually data is found in A&B or A&C models
r0bby_ joined the channel
disturbe1mime is now known as disturbedmime
xterm: got it
pupil joined the channel
robbyoconnor has quit
xterm: but i wanted to know which is associated with A, not need for filtering
whaack has quit
indistylo joined the channel
k3va has quit
indistylo has quit
xterm
noregret: iirc with o2o through the orm you have navigation from either ends, a.b, a.c, b.a, c.a.
(assuming you have not set a related name ofcourse)
noregret
xterm: yeah, so should i just check if a.b.id or a.c.id exists ?
denys joined the channel
codeme joined the channel
gingitsune joined the channel
wwwald joined the channel
Quitta joined the channel
akki has quit
avnee joined the channel
i'm using the default modelform with a createview, i want to hide a field in the template, what can I do here? it should be hidden with an initial value i set in get_form_kwargs()
jcda joined the channel
socketubs joined the channel
zazmaster has quit
Quitta has quit
codeme has quit
avnee has quit
FinalAngel has quit
gannetson joined the channel
converse has left the channel
gannetson has quit
jcugat has quit
indistylo joined the channel
indistylo
Folks, I am using djangorestframework, I am getting this error, http://pastebin.com/09Yiusvz , Kindly help to understand this problem
Groscheri joined the channel
quenode_ joined the channel
rain0r joined the channel
Folks, I am using djangorestframework, I am getting this error, http://pastebin.com/09Yiusvz , Kindly help to resolve and take right steps to solve this problem
MrGix joined the channel
mine0901 has quit
quenode has quit
ASonOfGod has quit
T0rch joined the channel
subho has quit
kuter joined the channel
slav0nic joined the channel
citizen-stig joined the channel
subho joined the channel
kushal has quit
jcugat joined the channel
jas02 joined the channel
FinalAngel joined the channel
citizen-stig has quit
happyKatt joined the channel
gannetson joined the channel
aRkadeFR
indistylo: the import path for GenericForeignKey is: django.contrib.contenttypes.fields.GenericForeignKey
indistylo: check your file guardian/models.py line 8
tierce has quit
josuebrunel joined the channel
gannetson has quit
indistylo
aRkadeFR :guardian/models.py there is no such file in my directory
aRkadeFR
/usr/lib/python2.7/dist-packages/guardian/models.py then it is from an external library that is not compatible with Django 1.9