I'm using FTP as a remote storage for my django app. How do I get sorl_thumbnail or easy_thumbnail (not sure if that's possible) to work with the remote storage?
zlalanne has quit
Ankhers joined the channel
frog32 has quit
monokrome
terryleigh: You want to have Django use FTP as a storage backend?
or you are trying to upload your code to an FTP server?
terryleigh
monokrome: no just media files.
monokrome
Static media files or ones that are user uploaded?
I definitely wouldn't recommend using FTP for that though
daidoji1 has quit
mattmcc
FTP is a terrible remote storage.
daidoji1 joined the channel
rmwdeveloper
is there any elegant way of combining CreateView and UpdateView ?
mattmcc
rmwdeveloper: Not really, they're separate for a reason.
havingFun joined the channel
A combined view would be littered with conditionals.
rmwdeveloper
true, thanks
mattmcc
But you can of course move common code in your two views into a mixin class.
rmwdeveloper
mattmcc: is it alright to redirect to the updateview in the createview's dispatch method if the object exists?
kukosk joined the channel
scottburns has quit
mkoistinen has quit
mattmcc
rmwdeveloper: What's your actual use case?
Or rather, how would you determine that an object already existed when a user tried to create it?
terryleigh has quit
rmwdeveloper
mattmcc:i guess in the createview query the database to see if the object exists, and if it doesnt then redirect to updateview
right now,
mattmcc
What would it use for the lookup?
rmwdeveloper
a foreign key thats in the request
schinckel
mattmcc: Was it you who showed me how to use the redirect shortcut directly in a urlconf?
(or was it not even that shortcut..?)
rmwdeveloper
i want to have one form that, if the object exists, route to updateview, if it doesnt route to createview
ben_vulpes joined the channel
mossplix_ has quit
mattmcc
rmwdeveloper: So you could handle that in CreateView's dispatch method.
schinckel: Dunno..
rmwdeveloper
mattmcc: thanks
mossplix_ joined the channel
kukosk
maybe a more python related question, but hope someone will help ... I needed to write a view specific decorators for my app, and had views.py inside it, so i removed it, created views app (inside the mentioned app), pasted the old file contents into the __init__.py, and added decorators.py file with the decorators ... is this kind of structure used for this kind of problem?
schinckel
Mmm. I was just trying to see if I could avoid writing a single line view function.
mattmcc
Doesn't lambda req: redirect(...) work?
schinckel
Yeah, it probably will. I thought there was a way to do it even sneakily than that.
ghostmoth joined the channel
havingFun has quit
mkoistinen joined the channel
mossplix_ has quit
daidoji1 has quit
simvez joined the channel
targetron joined the channel
daidoji1 joined the channel
maryokhin joined the channel
kukosk
I know I can do this in plain python, and that it works, just wanted to ask if you do this in django
alexhayes
ust throwing it out there again... I'm trying to fix an issue (https://github.com/jakewins/django-money/issues...) in which I'd like to use django.db.models.sql.query.Query.names_to_path() to retrieve the final_field. It seems that the calling arguments to names_to_path() has changed between Django 1.6-1.7 (fair enough... it didn't even exist in 1.4-1.5), is there a backwards compatible way to retrieve the resolving field for a lookup?
Just*
simvez
Hi folks, let's say I have a {{ books }} variable in my template containing..well.. a books queryset. Is there a way to check if book ID 7 is inside this variable?
schinckel
simvez: That's not really the sort of thing you want to be doing in a template, more in a view.
havingFun joined the channel
If you already have the _instance_ in your context, you could do {% if book_7 in books %}, but it _will_ hit the database.
F1LT3R joined the channel
(even if you have already iterated over the books queryset, IIRC)
simvez
Schinckel : I know, but in my case the ID i want to search for comes from an MFTT tree. It's more like "if node.id is in {{books}}". I didnt figure out how to add stuff to the MFTT array yet.
JBreit joined the channel
jladage has quit
F1LT3R has quit
juztin has quit
dlam joined the channel
txomon|home has quit
ghostmoth
why might one install a project into itself? i’ve seen `python setup.py develop` as part of installation steps in prjects before and can’t figure out what it’s there for
i’ve removed it and everything seems the same, but setup is twice as fast. seems like it might be some extra cleverness
the_rat has quit
CrowX-
when I create user with "user = User.objects.get_or_create(userName, userMail)", how do I know which order I should supply the arguments in?
alexhayes: what exactly are you trying to retrieve, and what have you already got? can you explain the problem you have a little better?
estebistec joined the channel
and I'll take a quick look to see if I can find anything
also - which django version are you targeting? 1.8 or a variety of versions?
ForSpareParts joined the channel
limbera
euguhhhhhh the curse of the damn email
i don't even think this is possible, but this is whats happening to me currently
contrib.auth password reset form is successfully sending reset password emails to MY email address
(in fact to two of my email addresses)
but not to any other email addresses
using normal core.mail.send_mail() works all the time
so there must be something funky going on with the auth mail that i am not aware of
but then again, how is it only sending to my specific 2 email addresses :/
mihow has quit
mihow joined the channel
kanja has quit
alexhayes
jarshwah: Targeting 1.4-1.8+
lorddaed_ has quit
clandest joined the channel
limbera
is there a way to set priority of password reset emails?
alexhayes
jarshwah: Essentially I'm trying to get the actual field that a lookup resolves to. For instance, lets say we have .filter(foo__bar__myfield=F('id')) I want to get the field that 'id' resolves to. I have the model, so it's a matter of traversing the model and it's relationships. I can do this manually but I thought it would be something that is accessible in the Django API.
elbaschid joined the channel
jarshwah
would model._meta.get_field(expression_node.name) (or something similar..) not work ?
targetron has quit
hmm expression nodes have changed significantly between 1.7 and 1.8, I should look further back
alexhayes
jarshwah: Perhaps, does that do the resolution if say for example: .filter(foo__bar__myfield=F('thing__balh__otherfield'))
(trying now)
jarshwah
also, that'll only work for F() based expression nodes.. they don't all have `name` attributes
clandest
if I have a User object how can I call on variables like username or password? I tried user.username, but that doesnt work http://pastebin.com/F26RAPzV
NomadJim joined the channel
mihow has quit
trustyhank has quit
jarshwah
clandest: that *should* work, if `user` is actually a `User` .. can you show the view where you put user in the context?
simvez
Hi folks, let's say I have a bunch of "entries" with foreignkeys towards a "blog". Is there a way to modify the Blog model so that any query made to it will return an object with a blog.interesting_entries property? ("interesting_entries" would be a queryset of mine).
jarshwah: Looks like it only operates on it's own model (ie.. doesn't traverse down)
havingFun joined the channel
jarshwah: I've almost got a working version that is creating a dummy Query(model).setup_joins - just feels very very dirty
jarshwah
yeah I was just about to suggest setup_joins, but I was comparing the signature across versions
alexhayes
jarshwah: yeh, it's pretty different
jarshwah
you're operating in private API territory here though :P
alexhayes
also... no guarantee it won't change in the future.
yes
jarshwah
if (1,4) < django.version < (1,5): blah ..
might be a way to do version specific stuff
jrickman has quit
1.8 expressions have a public API
but they no longer resemble anything before 1.8
Ariel_Calzada joined the channel
alexhayes
Yeh I had heard/read about that. The tests in django-money only cover 1.4-1.6 however ideally I'd like to support 1.7 (as that is how I discovered the problem in the first place with my own tests)
jarshwah
in 1.8 you'd get an expression and check if expression.output_field.get_internal_field() == 'Money..'