These are chat archives for django/django

8th
Dec 2016
Roel
@roelzkie15
Dec 08 2016 03:45
Help please i believe it should work but why? Extending Django UserModel Failed
Roel
@roelzkie15
Dec 08 2016 05:31
i notice that my error occurs because django.contrib.admin is migrated before django.contrib.auth when using AUTH_USER_MODEL substituting the django User model. That is why it keeps yielding the foreignkey constraint error. How can i fixed this? Please help
Roel
@roelzkie15
Dec 08 2016 05:48
i was able to solve it by running python manage.py makemigrations authentication before running migrate!
Antonis Christofides
@aptiko
Dec 08 2016 08:06

@brjadams I think it's clean alright. I'd probably write it like this:

names = {
    "authors": ", ".join(whatever),
    # ...
}

but yours is fine too. Doing something smarter might make it look more elegant, but after you'd look at that code again a year later it would take you more time to understand it.

sheepsy90
@sheepsy90
Dec 08 2016 09:30
Hello - quick question -we are on django 1.10.3 and when using the admin page in google chrome the csrfmiddlewaretoken is different in the div in the form body than in the cookie - when submitting the form it fails with a csrf error - when replacing the value in the div in the form with the one from the cookie it works - any ideas why django admin pages play out a wrong csrftoken in the form body?
Andrei Kotsubailo
@ajkotsubailo
Dec 08 2016 09:33
@sheepsy90 can you reproduce this in “Incognito” mode?
sheepsy90
@sheepsy90
Dec 08 2016 09:35
yes same problem there
Andrei Kotsubailo
@ajkotsubailo
Dec 08 2016 09:41
@sheepsy90 You know I also have diferrent values in form and in cookie, but I don't remeber why they must be equal - maybe problem somewhere else
maybe you can give more details about your setup
sheepsy90
@sheepsy90
Dec 08 2016 09:43
We use this session engine SESSION_ENGINE = "django.contrib.sessions.backends.cache"
Normal csrfmiddleware
Andrei Kotsubailo
@ajkotsubailo
Dec 08 2016 09:48
how about to return to default settings? just to check. And if it start working - check your cache engine setup
sheepsy90
@sheepsy90
Dec 08 2016 09:51
will try that thanks
I just wonder as - we are not having any hands in the admin page and use vanilla there - how the admin page form on model change plays out a wrong csrf token in the form
Andrei Kotsubailo
@ajkotsubailo
Dec 08 2016 09:59
“wrong csrf token” - what do you mean wrong? Why do you think that cookie and form must contain same value?
sheepsy90
@sheepsy90
Dec 08 2016 10:06
I mean wrong in a sense as the one in the form doesn't work and leads toa 403
Andrei Kotsubailo
@ajkotsubailo
Dec 08 2016 10:06
And also - do you have this(as first)
MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware’,
...
sheepsy90
@sheepsy90
Dec 08 2016 10:06
nope we don't have this
Should we?
Andrei Kotsubailo
@ajkotsubailo
Dec 08 2016 10:12
let me first ask - did you try “default” django settings without any caching?
sheepsy90
@sheepsy90
Dec 08 2016 10:20
not yet - just gathered another data point - the csrfmiddlewaretoken in the cookie stays the same all the time the one in the templates with {% csrf... %} changes on each apge load
Andrei Kotsubailo
@ajkotsubailo
Dec 08 2016 10:27
“the one in the templates with {% csrf... %} changes on each apge load” - looks interesting, but I think better to solve problem step-by-step
Alex10Alex
@Alex10Alex
Dec 08 2016 16:34
подскажите выпадает ошибка : if not issubclass(cls, AppConfig):
TypeError: issubclass() arg 1 must be a class
Andrei Kotsubailo
@ajkotsubailo
Dec 08 2016 19:49
@Alex10Alex а что у вас в cls?
Kaushal Kumar
@kaushal087
Dec 08 2016 19:56
I have integrated Python social auth in my django app. I am using this command to run the server.
python manage.py runserver test.dev:1111
But facebook gives me this error
Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.
Ok got it ... I made some changes and it started working ..
Kha
@nlhkh
Dec 08 2016 21:02
is there an equivalent of find_each from ActiveRecord in Django?