farn currently dev setup. but I will deploy to web server after after
boxbeatsy joined the channel
farn: How setting I apply to my settings, what is your suggestion
c has left the channel
boxbeatsy
hi, i'm trying to use the pip pckg django-db-mutex, and i'm getting the following error: 'relation "db_mutex_dbmutex" does not exist' whenever i try to initiate the mutex lock. upon inspection, it seems like the db-mutex package requires a 'DBMutex' model to be created in the database. what's the correct way to makemigrations that detects this requirement? i've tried copying/pasting the model into my models.py but that doesn't work.
looking into the package's code, i see a models.py there (/usr/local/lib/python2.7/dist-packages/db-mutex/models.py). how do i get migrations to pick up on it?
boxbeatsy: you can't force migrations on a third party app
mitaka has left the channel
boxbeatsy: if migrate doesn't work, I dunno. did you add it to INSTALLED_APPS?
licensed is now known as Guest54258
leotsem joined the channel
leotsem has quit
rriehle joined the channel
boxbeatsy
Knyght: ooooo, doh. no, i didn't add it to INSTALLED_APPS.
capella-da-star joined the channel
jiang42 joined the channel
Knyght
boxbeatsy: well there's your problem :) if I read your question properly I might have even got it the first time instead of the fourth, but I'll blame the weekend
DLSteve joined the channel
capella-da-star has quit
rpkilby has quit
jaddison has quit
rpkilby joined the channel
grumpi has quit
shannonlucas has quit
beastDivision joined the channel
boxbeatsy
Knyght: :) thanks. i'm getting a subsequent warning now that's leading to the same error: "/usr/local/lib/python2.7/dist-packages/db_mutex/models.py:4: RemovedInDjango19Warning: Model class db_mutex.models.DBMutex doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9. class DBMutex(models.Model):
weird, because that's a new warning that i only get after i add db_mutex to installed_apps
grumpi joined the channel
it_dude_ has quit
Knyght
boxbeatsy: sounds like it's a problem with the module. it doesn't affect you for now but maybe ad an issue to fix it on their github if there isn't already one
package, not module ;x
SteenJobs has quit
hck89 joined the channel
busla has quit
boxbeatsy
Knyght: gotcha. for some reason, even after i add it to installed_apps, it's not detecting the package's model definitions. error being: relation "db_mutex_dbmutex" does not exist
Knyght
hmm
did you run migrate?
boxbeatsy
ya, and it didn't detect any changes. it did out put that warning though
"Model class db_mutex.models.DBMutex doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded"
NomadJim joined the channel
Knyght
yeah I don't think it should be a problem, not sure
sargas joined the channel
boxbeatsy
hmm, ok
iasai joined the channel
grumpi has quit
Knyght: nevermind, i was running makemigrations not migrate. all set. thanks!
Knyght
\o/
robbyoconnor joined the channel
nimomo has quit
dshap has quit
beastDivision
is there something similar to InlineModelAdmin to use with class based views? where you can have your user model and a one-to-one profile model at the same time?
grumpi joined the channel
grumpi has quit
Knyght
I wish there was.
Hairy joined the channel
rriehle has quit
farn
the answer to your first question is inline formsets, but I don't think you can use those with one-to-one relations
j1fig has quit
waawal has quit
AntiSpamMeta has quit
xBBTx
beastDivision, look at django-extra-views
AntiSpamMeta joined the channel
AntiSpamMeta has quit
theslow1 has quit
gerbyzation has quit
AntiSpamMeta joined the channel
apiarian joined the channel
beastDivision
thanks!
iasai has quit
AntiSpamMeta joined the channel
AimerPaddle joined the channel
therocode
When designing a ReSTful api for things like this: http://puu.sh/jT7Hx/4141e2884f.png when you have several instances of an object which is meant to display data of some linked model, like in this case, these are tasks that display the avatar and username of users, and aggregate information of time reports. Would you design the api to give you a list of task objects with the user profile and time information
nested?
Or would you use hyperlinking that would have to be resolved for every task?
dang`r`us
depends
gerbyzation joined the channel
having to make many requests hurts so materializing might be better
gerbyzation has quit
therocode
What would be the drawbacks?
dang`r`us
the materializing call is going to hit your db and cpu harder
therocode
Hm right
I think I'll go with what makes simplest code right now and then optimise later. Thanks
tiagoboldt joined the channel
julio_menendez joined the channel
pytony has quit
Another question: In templates when referring to things like static urls and such, you can use the {% static %} tag, or {{ STATIC_ROOT }} or such to find the files. But if you write a lot of the website in client side angular js code served by static files, how would you deal with supplying which URL things are at?
For example, in development, they reside under localhost, but I might want a real domain based URL in production
Is there nothing django can do about it since it is statically served files? Should I use angular JS settings somehow, or should I turn the .js files into proper django rendered templates?
AimerPaddle has quit
Oli joined the channel
orion83 has quit
AimerPaddle joined the channel
lordkryss has quit
micah_chatt joined the channel
it_dude joined the channel
Melamo joined the channel
TeeTime has quit
TeeTime_ joined the channel
sargas joined the channel
AimerPaddle has quit
DarkSector
Okay I am getting a QueryDict from ModelSerializer from DRF
How do I get it to json?
Do I just do a json.dumps() on that?
pilva joined the channel
it_dude has quit
temhaa has left the channel
msc_ has quit
josuebrunel joined the channel
pilva has quit
Paradisee joined the channel
dang`r`us
DarkSector, models to json is typically YourSerializerClass(instances, many=True).data
So I have this code, and I reckon it could be all done in one query, but I'm not sure how. Just in case anyone wants to take a crack at it: https://dpaste.de/U0ce (the select_related() is used later, and also need to keep the list around for something else after)