tests don't take long by themselves, I think I just have ridiculously slow test database creation / clearing for some reason <_<
yomilk joined the channel
twoolie joined the channel
CouperAlex has quit
dyu joined the channel
yomilk has quit
jscott1989 joined the channel
zipper
I want to upload files to a directory whose name is the username of the currently logged in user. My idea is:
class Upload(models.Model, request):
johnraz joined the channel
username = request.post['username']
Naeblis
How can I override the methods for Managers and QuerySets at one place? Eg: If I have to override filter(), right now, I do it in both the custom Manager and the custom QuerySet classes.
zipper: erm... no.. that's just try to use that string literal as a prefix
zipper: your problem will be trying to get the username to the upload_to callable
Naeblis: why do you want to override it?
zipper
FunkyBob yes
Nanor joined the channel
FunkBob that's the only way I could see it working
Naeblis
because I want some custom filtering done...
kyrix joined the channel
FunkyBob
Naeblis: yeah, um... you'll have to give me something more if you want useful help
I mean, why would you overrid filter, instead of adding a custom queryset or manager method?
zipper
FunkyBob okay let me try implement this at the view level or something.
Naeblis
FunkyBob: I'm using DRF along with django-filter, which means the results that I want are available via the filter() method, and I want to override that.
FunkyBob
Naeblis: for now your best bet for "write it once" solution is to use the PassThroughManager from django-model-utils
what does django-filter do?
and why would it require you to overrid filter?
we keep coming back to this one question, which you circle but never actually answer
drager
I'm trying to use django-taggit but when I specify for example 6 tags the site freezes and I have no idea why. Views; https://dpaste.de/KGcsT/ Forms; https://dpaste.de/m0SbP/ The pdb is just to check where it freezes.
drager: isn't there a TagField provided by taggit for forms?
Nanor
Hey, I'm trying to use django-ckeditor in my admin pages but when it tries to GET the ckeditor.js it's looking in the wrong place. How can I change where it looks?
FunkyBob
Naeblis: as I said, django-model-utils has the very well tested PassThroughManager
but hey... just ignore the people trying to help you... what would we know?
Naeblis
no need to be snarky about it. Thanks for your help.
FunkyBob
Naeblis: I'm still trying to figure out why you want to override filter at all?
Naeblis
^ because explaining that would take some time.
drager
FunkyBob: Not sure, I'll check
kyrix
Naeblis, still, are you using class based views :)
FunkyBob
Naeblis: explaining it might help find a simple solution
Naeblis
kyrix: no views at all. :p
kyrix
Naeblis, you said you are also using django-filter
it's starting to sound like you're trying to move your application code [interpreting the filtering] into the queryset ...?
Naeblis
sure, but doing things at the "view-level" the way I want to go. Doing it at the "model-level" would be better.
*isn't
yep
drager
Hm, funny error
(126, "Incorrect key file for table 'C:\\Windows\\TEMP\\#sqldf0_a_2.MYI'; try to repair it")
FunkyBob
so you want to try to apply a wrapper to filter to change the filter args?
Ariel_Calzada joined the channel
thuonjowi has quit
Naeblis
FunkyBob: how do you mean?
d4rkr4i joined the channel
drager
It's about the diskspace?
FunkyBob
Naeblis: Why do you want to override the filter method? why not add your own method ?
Naeblis
because then I would have to customize DRF to use that method too, I think.
FunkyBob
why not just give DRF your own Filtering class?
Naeblis
If it can be done via overriding filter and using the already built-in mechanisms, why not use that though?
FunkyBob
because the correct way to do it is to provide DRF with your own custom filtering class
Nanor
Hey, I'm trying to use django-ckeditor in my admin pages but when it tries to GET the ckeditor.js it's looking in the wrong place. How can I change where it looks?
Naeblis
FunkyBob: I dunno. filter() is working fine as it is. I just wanted to remove the code from 2 places...
FunkyBob
Naeblis: in fact, I just read in their docs DRF uses django-filter... so...
G1eb joined the channel
Naeblis: follow the docs for custom admin media...
Nanor: even
Nanor: follow the docs for custom admin media
Nanor: or custom form media
Nanor: so you're _already_ overriding filter?
FUCKING STUPID NICK COMPLETE
Naeblis
heh
yeah
FunkyBob
Naeblis: so you're already overriding filter?
and you want to avoid the duplication
Naeblis
mhm
kezabelle joined the channel
FunkyBob
then, as I said way way way back at the start... use django-model-utils PassThroughManager
Naeblis
which was my original question
FunkyBob
kyrix gave that same solution
hwrd|work has quit
personally, I'd be wary of anything I found on SO
Naeblis
:o
yomilk joined the channel
Hipikat has left the channel
iulians has left the channel
yomilk has quit
brambo
you mean the internet doesn't know everything?
Maior
a/win 49
nkuttler
popular != correct
petrounias joined the channel
brambo
SO is "suppose" to be the place where the "knowledgeable" people go to ask for help
nkuttler
i thought knowledgeable people rtfm
Maior
brambo: most of the questions on SO are dross
brambo
agreed, if i have a problem, i usually find at least 10 SO posts that are horribly asked and may have a piece to the actual answer I'm looking for
nkuttler
s/the actual/one probably not optimal/
drager
FunkyBob: Still freezes using the TagField
brambo
nkuttler: Manuals are boring and long
lol
nkuttler
brambo: and reading is hard, i know. let's go shopping!
brambo
I'll get my purse
theskumar joined the channel
I'll admit I use to be a lazy bones that wouldn't RTFM, but lately it seems like documentation for some things have gotten much better to so it's easier to understand