So, i want to grab SELECT * on Activity, based on filters, that is done, then i want to have device_nickname for the activity, which is based on the user.
So, I believe or i think if we were going to do this in sql from my limited knowledge of it.
SELECT "core_activity"."id", "core_activity"."DEVICE_(model)_id", "core_compactor"."id", "core_device"."DEVICE_ID" FROM "activity" INNER JOIN "core_device" ON ("core_activity"."DEVICE_(model)_id" = "core_compactor"."id") WHERE (long filter) as t1;
and i guess for a select would be
SELECT "core_nickname"."id", "core_nickname"."nickname" FROM "core_nickname" WHERE "core_nickname"."DEVICE_(model)_id" = t1."DEVICE_(model)_id" AND "core_nickname"."PROFILE_id" = (from variable);
or else i think i believe all in one could be solved in an another inner join with a parameter as user.
SELECT "core_activity"."id", "core_activity"."DEVICE_(model)_id", "core_device"."id", "core_device"."DEVICE_ID", "core_nickname"."id", "core_nickname"."nickname" FROM "activity" INNER JOIN "core_device" ON ("core_activity"."DEVICE_(model)_id" = "core_compactor"."id") LEFT JOIN "core_nickname" ON ("core_activity"."DEVICE_(model)_id" = "core_nickname"."DEVICE_(model)_id" AND "core_nickname"."PROFILE_id" = ($someUserArgInCode)) WHERE (long filter);
and yeah the device model is in a different name, i think i just made it a bit confusing, but i think it should be as it is. "DEVICE_(model)_id" generated by django for the foreign key, and the "DEVICE_ID" is the self made one, but it isn't used for the query.