I see, that makes sense. I will use my own then, guess a signal wont work for sending these messages to my messaging queue
Koterpillar
...and it's undocumented, so don't rely on it
FunkyBob
iirc a Form can tell you which fields it updated
jas02_ has quit
Electrometro
I wanted to know like who requested the change, the changed from to type stuff
FunkyBob
you won't get who in a post-save signal
Electrometro
Yeah, that is why I was thinking if I could send my own kwargs down that would be nice
Koterpillar
you can, technically
FunkyBob
because the ORM can't even assume there is a "who"
Koterpillar
^
you can keep around an execution context singleton of some sort, and set it in the middleware
FunkyBob
yes, you can hack it in... but... blech
Electrometro
Right now I am just doing it in the view, but that doesn't really cover the admin
Koterpillar
who cares about admin?
Electrometro
Well, I've done soemthing dumb and only allowed some action that are really super to happen in the admin but I need those to also send the messages (an after thought)
waterCreature has quit
Like create staff users (admin only, but I need to send the user create command to our other servers)
pokEarl joined the channel
eperzhand has quit
eperzhand joined the channel
pupil joined the channel
c17r joined the channel
eperzhand has quit
FunkyBob
Electrometro: you really shouldn't be using the DB Admin interface for your management interface
Electrometro
I completely agree. I just wanted some very infrequent super admin stuff to happen there.
Bryson joined the channel
I will refactor to have the APIs use it. Moving the message sending to the save/delete of the model. Going to pass in kwargs from the serializer context. Should work ok
tulioz joined the channel
SimpleName joined the channel
kbck has quit
re1_ has quit
massover joined the channel
SimpleName has quit
kyheo joined the channel
arifin4web joined the channel
SimpleName joined the channel
nikivi has quit
kyheo has quit
liothe has quit
ironfroggy joined the channel
ironfroggy has quit
dodobrain joined the channel
tulioz has quit
tulioz joined the channel
Rialynn has quit
tau has quit
EyePulp joined the channel
dardevelin joined the channel
iiie joined the channel
Bryson has quit
souravbadami
I'm getting this ' Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.' repeatedly after resetting the database too. How to get rid of it ? I'm using Django app.
I tried migrate and makemigrations, no luck.
I'm on heroku.
Maggie joined the channel
goldfish has quit
Maggie has quit
Maggie joined the channel
aavrug joined the channel
M|6 joined the channel
bmon
Hi all, if I have custom validations for a model which can only be edited from /admin should I put the validations on the model or in the admin?
Koterpillar
souravbadami: are your migrations committed and pushed?
jas02 joined the channel
souravbadami
Koterpillar: Yep!
mattmcc
bmon: There's no built-in hook for admin-specific validation. Put it on the model, and it'll be run by the regular ModelForm validation process.
ellmetha has quit
Koterpillar
souravbadami: then you should be getting the same on localhost; are you?
souravbadami
Okay, I have a situation. Earlier it worked using this. I use mysql locally and postgresql on heroku. So does that matter ?
Koterpillar
souravbadami: try postgres locally?
souravbadami
Hmm, On it.
Koterpillar
also, which migrations does it create on heroku?
Bryson joined the channel
souravbadami
some changes on a mode.
*model.
pundurs joined the channel
bmon
mattmcc: Thanks :)
Koterpillar
souravbadami: post those, please
ejb has quit
keimlink has quit
M|6 has quit
souravbadami
Migrations for 'app':
app/migrations/0002_auto_20161129_0304.py:
- Delete model mynewusers
- Add field owner to newreport
jas02 has quit
jas02_ joined the channel
Koterpillar
are you sure heroku app is up to date?
ensure it is
if it's still the same, post the models and migrations for this app
shangxiao joined the channel
souravbadami
Yes, It is. Just pushed to confirm.
kingarmadillo has quit
There's a single model with 4 charfields.
Koterpillar
can you run 'git status' on heroku?
and git log
jas02_ has quit
jessamynsmith
you can do: heroku run ls to see what's there
Koterpillar
the point is to compare your models to the models on Heroku
jessamynsmith
souravbadami, Koterpillar you should definitely be running makemigrations locally, committing and pushing the migrations, and just run migrate on heroku
Koterpillar
and also, unless you want to answer 10 more questions about models, just post them in full
souravbadami
I'm running it like
heroku run python manage.py migrate
jessamynsmith
that seems correct
and what output do you get back?
it completes successfuly?
Koterpillar
I believe that spins another (temporary?) dyno that is destroyed afterwards
so you lose all the changes from makemigrations
souravbadami
I'm getting this ' Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.' repeatedly after resetting the database too. How to get rid of it ? I'm using Django app.
I tried migrate and makemigrations, no luck.
I'm on heroku.
pokEarl has quit
jessamynsmith
souravbadami: if you are using postgresql, you can run: heroku pg:psql
that lets you poke around the db
if you're using sqlite, that isn't going to work on heroku
(filesystem is ephemeral)
Koterpillar
souravbadami: paste the full output of what your models look like, and what do they look like on heroku (heroku run cat app/models.py)
the_rat joined the channel
jessamynsmith
Koterpillar: if you're using the filesystem for db on heroku, that definitely worn't work,and if you are using a db addon, that's independent of the dynos
souravbadami
I'm using db addon.
Koterpillar
jessamynsmith: that's what I suspected, so their new migration gets lost immediately (which is rather good, actually)
iiie has quit
jessamynsmith
souravbadami: postgres?
souravbadami
yes
jessamynsmith
ok, cool, then you can easily check if the migrations are logged in the db: heroku pg:psql
Koterpillar
jessamynsmith: they aren't even created
tdy has quit
jessamynsmith: and if they manage to create any, it'll be a headache because they are not in Git
jessamynsmith
Koterpillar: souravbadami is trying to makemigrations on heroku? that will most definitely not work
yeah, exactly, migrations need to be in git
Koterpillar
(14:16:33) souravbadami: heroku run python manage.py migrate
souravbadami
It worked earlier, As I said.
jessamynsmith
Koterpillar: that's running migrations on heroku, which is correct, assuming they've already been created with makemigrations and committed
Koterpillar
souravbadami: post what I asked for
felixn has quit
iiie joined the channel
the_rat has quit
jessamynsmith: right; I'm guessing makemigrations is also run on Heroku; no direct evidence in chat but let's see the models
pupil1 joined the channel
pupil has quit
schinckel
Is there something misleading in the docs that suggests you should create migrations anew on production, because it's something we see quite frequently.
nkuttler
schinckel: depends on your dev process
Koterpillar
schinckel: I think there should be an explicit point saying "don't lose migrations"
schinckel: and then "commit migrations"
several times
schinckel
Yeah.
nkuttler
schinckel: if you don't need migrations go ahead and delete them