Because ORM is completely detached from requests...
Tykling
well somewhere the stuff that needs to be done must be passed to the ORM
could feasibly pass the request ID there too
jtiai
Well how you plan to do that in admin for example?
Tykling
does it sound like I have a plan for all this? :) I just know what I want to do, I don't yet know how to do it
jtiai
Or 3rd party packages you may use? quite can of worms..
Tykling
well the 3rd party packages and the admin still use the same ORM
trevortwining joined the channel
it might not be possible to do what I want, but I hope it is :)
jtiai
I think there isn't.
FancyCamel joined the channel
paiti joined the channel
MJR_ joined the channel
Tykling
I am not ready to accept that, but when I've looked into it and made up my mind I will let the channel know what I found :)
maartenpi has quit
trevortw_ joined the channel
jtiai
You could still do the logging like django-devserver does with sql logger. I think that could work. But it's not logging on db level but bit higher level.
MJR_
hi. how to get a model full path or another unique identifier for that model?
jtiai
MJR_: What for?
paiti has quit
rodolfojcj_ joined the channel
MJR_
jtiai: I'm trying to right a export generator and need a unique string so that user can select from a select list
azuri5 has quit
jtiai
MJR_: Select what?
maartenpi joined the channel
ubuntu_aze has quit
cmheisel_ joined the channel
trevortwining has quit
cmheisel_ has quit
Lokefar
jtiai: As fare as I see it I have a list of dict's now: [{'label': 'Counter1', 'data': 8}, {'label': 'Counter2', 'data': 9}, {'label': 'Counter3', 'data': 5}, {'label': 'Counter4', 'data': 15}] and these I want to turn into a single dict. Tried "data_dict = {item['label']:item for item in data}" but that got me: {'Counter4': {'label': 'Counter4', 'data': 15}, 'Counter2': {'label': 'Counter2', 'data': 9}, 'Counter3': {'label': 'Counter3',
'data': 5}, 'Counter1': {'label': 'Counter1', 'data': 8}}. Do you have an idea which function/code to use instead?
jtiai
Lokefar: To do what?
nikivi joined the channel
Lokefar
jtiai: To turn the list of dict's into a single dict's? As fare as I see it that is what is causing the error when parsing. That the 3rd parameter isn't a single dict.
cmheisel_ joined the channel
MJR_
jtiai: select a model for export
jtiai
Lokefar: Well you convert that list of dicts to json string?
Lokefar
jtiai: Yes?
jtiai
MJR_: Well content type framework might be something you're looking for.
Lokefar: So do that. Note, you get STRING back from json.dumps.
Serg_Penguin joined the channel
grimel joined the channel
Lokefar: but template context expects to have a DICT . So you have to create a dict where you assign your string to some key, which you can then refer within a template.
hi ! upgrade from 1.10b2 to 1.10.2, error: "TypeError: <QuerySet []> is not JSON serializable". I was having my custom JsonResponse, now commented it out leaving just "from django.http.response import JsonResponse" - to no avail
jtiai
grimel: You do, either explicit or implicit made by admin.
grimel
so?
azuri5 joined the channel
kuter has quit
bullicon joined the channel
ok, implicit made by admin - then what do I do?
jtiai
grimel: Maybe it's something with your model.
grimel
jtiai: I have a field 'taxid' in Customers modle
model*
jtiai
grimel: Maybe there is something in that field that causes a problem. I can't read people minds yet.
grimel
jtiati: there raises ValidationError, ok, I agree. but why does it say that CustomersForm has no 'taxid'?
maartenpi has quit
jtiai
As i said, I can't read your mind. You need to show some code.
maartenpi joined the channel
nimrod13 joined the channel
nimrod13
hi guysssssssssssssssssssssssssss
shredding joined the channel
I have a question, I'm trying to copy an existing object from default db to a new db with all object's relations also
royendgel has quit
jtiai
nimrod13: Why? Can't you use database own tools for that?
django809 joined the channel
cmheisel_ has quit
nimrod13
i'm trying to copy a consistent part of the model. i.e. start form some object and copy it and all of its related objects.
azuri5 has quit
shredding has quit
royendgel joined the channel
i thought about doing o = Object.objects.using('db1').prefetch_related(...).get(...) and then o.save(using='db2')
jas02_ joined the channel
maartenpi has quit
this only saves a single row in db2
SimpleName has quit
jas02__ joined the channel
jas02 has quit
it ignores the fact that there are more related objects. Do you have any other idea?
cmheisel_ joined the channel
jtiai
nimrod13: Well you have to explicitly save everything and in correct order. That's why I would suggest using proper tools, instead of Django.
nimrod13
So what proper tools do you suggest (db is postgres)
jas02 joined the channel
jtiai
pgadmin III, or more generic dbeaver.
TraceEv joined the channel
bochecha joined the channel
hutch34 has quit
nimrod13
i need a computational solution. something i can put in a script
EmeraldExplorer joined the channel
Lokefar
jtiai: Trying to do the json to dict thing but getting an error that string indices must be integers. Code is "data_dict = {item['label']:item for item in data}". Question, should I use an integer or can I do it another way with a string instead?
jtiai
nimrod13: You can script pg dump/load.
royendgel has quit
jas02_ has quit
nimrod13: pgadmin III can help you to figure out correct export procedure.
ok, ValidationError on disabled fields made that error...
Hanumaan
I have a problem with css the changes are not getting applied how to debug in django? I have changed in bootstrap.css file
jtiai
Hanumaan: Huh?
grimel
Another question - what are a good analogues of django-mptt? I need a linked instances and have them to be shown with indentation in admin page
Rialynn joined the channel
Because I couldn't make django-mptt work with multiple inheritance
ironfroggy_ joined the channel
jas02 has quit
Lokefar
jtiai: The view gets a request containing a question id. If this id equals an excisting question then the question is returned with the label 'question'. Is that correctly understood?
Hanumaan
jtiai, I have changed before it worked but now not working any more the changes do I need to execute python manage.py collectstatic to afterever change not on server local machine development
jtiai
Lokefar: No. View gets whole instace as is and it is passed to template in context variable named "question".
nimrod13
AFAIK pgadmin can dump entire tables and not a specific object graph.
jtiai
Lokefar: Now replace question with "json_data" and assign json.dumps() to that key...
ironfroggy_ has quit
ironfroggy_ joined the channel
Serg_Penguin solved, wrote myproject.core.serializers.json.MyProjectJSONEncoder(DjangoJSONEncoder)