These are chat archives for django/django

28th
Jun 2018
MilanRgm
@MilanRgm
Jun 28 2018 01:50 UTC
Hell any django developer online here? I need one help regarding adding the product to cart
Curtis Maloney
@funkybob
Jun 28 2018 03:48 UTC
?
which product to what cart?
Mahen Gandhi
@imlegend19
Jun 28 2018 03:53 UTC
What are @csrf_exempt and @api_view in Django?
Curtis Maloney
@funkybob
Jun 28 2018 03:56 UTC
csrf_exempt is a decorator for views to tell the csrf machinery to ignore them
api_view is a decorator from some 3rd party app...
Mahen Gandhi
@imlegend19
Jun 28 2018 03:57 UTC
Csrf machinery?
Curtis Maloney
@funkybob
Jun 28 2018 03:58 UTC
well, primarily the CSRF middelware
Mahen Gandhi
@imlegend19
Jun 28 2018 03:58 UTC
Ok thx @funkybob
Himanshu Shankar
@iamhssingh
Jun 28 2018 07:43 UTC

@imlegend19 api_view is related to djangorestframework and it is not meant to be asked here, I guess.

Just for your info, you can use this decorator to directly create functions (w/o creating a class) which will behave as it was created inside a class that inherits APIView.

Christopher Sabater Cordero
@cs-cordero
Jun 28 2018 12:58 UTC
I'm having this really strange issue where if I run python manage.py makemigrations --dry-run on my local machine, it yields No changes detected., but on my CI server, checking out to the same branch and running the makemigrations command actually detects changes on one of my models
i'm kind of at a loss for how this could happen, does anyone have any ideas?
I'm running Django 1.11.6 on both environments
Chris Goodwin
@hannylicious
Jun 28 2018 13:00 UTC
So is it supposed to be seeing changes or not? Did you change the model?
Christopher Sabater Cordero
@cs-cordero
Jun 28 2018 13:01 UTC
It's supposed to not see any changes
Sometimes our team does make changes to models but forgets to run makemigrations and push the migration files to the server
so as a early smoke test, we wanted to run makemigrations --check --dry-run at the top of our CI build
and basically exit out early if django detects whether we forgot to run makemigrations
thing is, when i ensure that all migration files are up to date on my local machine, the CI server seems to think we're missing one, even when checked out to the branch
Chris Goodwin
@hannylicious
Jun 28 2018 13:05 UTC
Strange. Historically everything looks fine? No one went in and fiddled with anything accidentally then tried to revert it or something wild?
Christopher Sabater Cordero
@cs-cordero
Jun 28 2018 13:06 UTC
yup
i even tried deleting all migration files locally, and then re-creating them
then pushed the re-created migration files to the server
and then the server thought that i was, again, missing migration files
Chris Goodwin
@hannylicious
Jun 28 2018 13:12 UTC
Weird, the migration table on the server - it shows a migration that didn't happen then?
Christopher Sabater Cordero
@cs-cordero
Jun 28 2018 13:14 UTC
i didn't think makemigrations cares about what migrations have run or haven't been run?
i could have sworn that it just statically looks at migration files and compares them against your model declarations
Chris Goodwin
@hannylicious
Jun 28 2018 13:20 UTC
When someone migrates in django, it records that on the the table in the DB (unless the model is unmanaged). My guess is at some point, someone somewhere migrated something but didn't commit it or reverted it or something so the repo doesn't have that migration, but the DB is still registering it as having ocurred.
Christopher Sabater Cordero
@cs-cordero
Jun 28 2018 13:24 UTC
this issue still occurs even if i nuke the database and recreate it on the server
basically even if i make everything a fresh reinstall, i'm still getting this issue for some reason
Chris Goodwin
@hannylicious
Jun 28 2018 13:30 UTC
That is surprising - if you nuke and recreate, it shouldn't even be an issue. That is strange in that case!
Christopher Sabater Cordero
@cs-cordero
Jun 28 2018 13:30 UTC
yup thats what i told myself in my brain
lol
i'm so dumbfounded at why this is occurring
at this point i'm thinking it has something to do with a field it's trying to migrate or something
but that shouldn't even be an issue either
still, i'm running out of leads for how to diagnose the issue
Chris Goodwin
@hannylicious
Jun 28 2018 13:32 UTC
Yeah, at least for me, without seeing the code or having a better idea of the setup I'm not sure why that would occur.
Manjit Kumar
@manjitkumar
Jun 28 2018 19:12 UTC
Hello,
May I ask if anyone using https://github.com/kmmbvnr/django-fsm with latest Django==2.0.6? They have mentioned support for 1.11 only, just wanted to check if I could use it in 2.0.6.