19:47 PM
uczekalla joined the channel
19:48 PM
CMSBottu joined the channel
19:49 PM
doubleo2 has quit
19:49 PM
xterm has quit
19:49 PM
delgiudices joined the channel
19:51 PM
delgiudices
19:51 PM
And the problem is the manytomany relationship between establecimiento and tipo de comida
19:51 PM
Wheneveri try establecimiento.tipodecomida_set.all() works fine
19:51 PM
But tipodecomida.establecimientos throws an error
19:51 PM
This error
19:51 PM
19:51 PM
doubleo2 joined the channel
19:51 PM
Any ideas?
19:52 PM
sargas has quit
19:54 PM
Paradisee joined the channel
19:54 PM
Paradisee
hello guys o/
19:54 PM
TheJoey
Hi Paradisee
19:54 PM
Paradisee
is there a way to do: foo = Foo.objects.all() and don't make queries when you do: foo.baz ?
19:55 PM
TheJoey
.select_related() ?
19:55 PM
aurel has quit
19:55 PM
Paradisee
mm..
19:55 PM
how does it work?
19:56 PM
19:56 PM
in the example there's this: e = Entry.objects.select_related('blog').get(id=5)
19:57 PM
but what is "blog" ?
19:57 PM
Demiurge has quit
19:57 PM
TheJoey
delgiudices: I think it's because you've modified the signature of __init__ on WPPostModelManager
19:57 PM
dang`r`us
Paradisee, a blog has entries
19:57 PM
TheJoey
Paradisee: Foo.objects.all().select_related('bar')
19:57 PM
delgiudices
TheJoey: let me check i think you’re right
19:58 PM
mlavin has quit
19:58 PM
FlyingMongoose has left the channel
19:59 PM
Thanks TheJoey it fixed my problem
19:59 PM
TheJoey
delgiudices: No problem
20:00 PM
dray3 has quit
20:01 PM
stantonk joined the channel
20:01 PM
Kayra joined the channel
20:01 PM
Kayra
How would I serialize multiple models with the rest-framework?
20:01 PM
codeme joined the channel
20:01 PM
I've found code on how to create a serializer that would do this
20:01 PM
20:01 PM
But I have no idea how I would actually use it
20:02 PM
a2b has quit
20:02 PM
solidvance has quit
20:03 PM
Demiurge joined the channel
20:03 PM
a2b joined the channel
20:06 PM
Hairy joined the channel
20:07 PM
dvlwrk joined the channel
20:08 PM
tbaxter has quit
20:08 PM
Luyt_ has quit
20:09 PM
Luyt_ joined the channel
20:09 PM
codeme
Kayra: where did you found it?
20:09 PM
tobias47n9e__ has quit
20:10 PM
Kayra
20:10 PM
codeme
ok
20:11 PM
raj` joined the channel
20:11 PM
Paradisee
TheJoey: i tried select_related, ma i need to grab parent = models.ForeignKey('self', null=True, blank=True, related_name='children') the children
20:11 PM
is there a way?
20:11 PM
arinov has quit
20:12 PM
select_related('parent') is fine, cus it is a foreign, but how do i grab children?
20:12 PM
ybathia has quit
20:12 PM
stantonk joined the channel
20:12 PM
tsujin has quit
20:12 PM
TheJoey
Paradisee: Ah, you want to use .prefetch_related() for that. It will execute a second query to retrieve all of the children
20:13 PM
nownot joined the channel
20:13 PM
msl09 joined the channel
20:14 PM
Paradisee
im gonna try it.
20:14 PM
nownot
what software, hosted or cloud, do you use to share passwords amongst team members?
20:14 PM
msl09
I'm getting a CSRF verification failed. Request aborted. message trying to use a generic formview
20:15 PM
TheJoey
nownot: I use LastPass
20:15 PM
Parameter has quit
20:15 PM
nownot
TheJoey: cost ?
20:16 PM
TheJoey
20:16 PM
nownot
meh, $24/user/year
20:16 PM
cool, good to know this is an option. thanks
20:16 PM
Kayra
codeme: Don't know if this helps
20:16 PM
20:16 PM
msl09
20:16 PM
what am I doing wrong?
20:17 PM
codeme
Kayra: so are you using Django Rest Framework?
20:17 PM
Kayra
codeme: don't know what I'd pass in so it works
20:17 PM
codeme: Yes
20:17 PM
msl09
also I'm using jinja
20:17 PM
lordkryss joined the channel
20:17 PM
melhiors has quit
20:18 PM
TheJoey
msl09: {% csrf_token %} won't quite work in Jinja.
20:18 PM
msl09: Use this instead: <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
20:19 PM
cssko joined the channel
20:19 PM
msl09
TheJoey: I can't find that in jinja documentation
20:19 PM
where would I learn that?
20:19 PM
durdenk joined the channel
20:20 PM
nownot has quit
20:20 PM
actually nevermind
20:20 PM
I'm getting the same error
20:20 PM
TheJoey
20:20 PM
msl09
<input type="hidden" name="csrfmiddlewaretoken" value="">
20:21 PM
the value is being set to empty
20:22 PM
delizin
msl09: You do have the csrf middleware enabled, right?
20:22 PM
tobias47n9e__ joined the channel
20:22 PM
msl09
well it's in the settings
20:23 PM
giarc
msl09 pretty sure your Super() call is incorrect
20:23 PM
TheJoey
msl09: Also, is this Django 1.8, using django.template.backends.jinja2.Jinja2, or something else?
20:24 PM
msl09
let me see
20:24 PM
lufi has quit
20:24 PM
'BACKEND': 'django_jinja.backend.Jinja2',
20:24 PM
MadHatter42 joined the channel
20:24 PM
tbaxter joined the channel
20:25 PM
20:25 PM
TheJoey
msl09: Also, delizin may have a point. return super(ContactView, self).form_valid(form) -- shouldn't that be LoginCacheView instead of ContactView?
20:25 PM
msl09
I already fixed that, thanks
20:26 PM
delizin
giarc's point for that one
20:26 PM
msl09
it didn't solve the problem
20:26 PM
TheJoey
Oh, right :)
20:26 PM
ulope has quit
20:26 PM
codeme
20:26 PM
TheJoey
Oh, you're not using Django's built in CSRF protection
20:26 PM
msl09
I think the exception is being thrown before the error happens
20:27 PM
giarc
msl09 did you try TheJoey's jinija csrf fix after the Super fix?
20:27 PM
jinja*
20:27 PM
targetron joined the channel
20:28 PM
Alina-malina has quit
20:28 PM
msl09
giarc: do you mean django.template.backends.jinja2.Jinja2?
20:28 PM
Jyrsa has quit
20:28 PM
Kayra
codeme: I understand that bit but then how do I initialise it
20:28 PM
grumpi has quit
20:28 PM
msg555 has quit
20:29 PM
TheJoey
msl09: I think the problem is that django-session-csrf doesn't have built-in Jinja2 support. You may be able to refer to {{ request.csrf_token }} to get the right one.
20:29 PM
giarc
msl09 i meant his template code instead of {% csrf_token %}...but if your not using the built ...
20:29 PM
slick666_work has quit
20:29 PM
msl09
I see
20:29 PM
Kayra
20:30 PM
Alina-malina joined the channel
20:30 PM
enkrypt has quit
20:31 PM
meiand
I'm using the django-allauth package for authentication with github. I have a project deployed to Heroku and I can't set the callback url to https. Anyone know what might cause this?
20:31 PM
msl09
nah {{ request.csrf_token }} is also empty
20:32 PM
mfisher has quit
20:32 PM
rafadev has quit
20:32 PM
msg555 joined the channel
20:32 PM
mfisher joined the channel
20:32 PM
grumpi joined the channel
20:33 PM
ulope joined the channel
20:34 PM
tbaxter
I have to wonder, if someone is throwing out django templates and django CSRF protection, how much of Django are they really using?
20:35 PM
Then again, I also don’t see a good reason to throw out either of those things, so what do I know.
20:35 PM
Shariq has quit
20:35 PM
malgorath
Okay this is something I have not tried in a while, I'm wanting to save a 'comment' added via form, in my Save def is it comment.save() to start it? there isn't a Comment.create() function or am I forgetting something simple?
20:35 PM
Shariq joined the channel
20:35 PM
domino14 joined the channel
20:36 PM
tbaxter
save() will be fine.
20:36 PM
It will create or update as needed.
20:36 PM
tanath_ joined the channel