FunkyBob: field name is news[0][one], news[0][two], news[1][one]... So I tried get with request.POST.getlist('news') and request.POST.getlist('news[]')
FunkyBob
Erayaydin: news[1][is_save] <--- you never posted any field called news
Erayaydin
FunkyBob: output None
FunkyBob
or news[]
eperzhand has quit
kezabelle
ah php/ruby style array notation
FunkyBob
Erayaydin: if you want to use a non-standard custom field format... you will have to deal with processing it yourself
eperzhand joined the channel
Erayaydin
FunkyBob: How nested input array than? I want 2 depth array, I tried field-1-one
randominternetus
nope
doesn't work with that either
FunkyBob
randominternetus: nope what?
randominternetus
gives me 404
FunkyBob
randominternetus: what does?
Erayaydin: well, when it comes to passing complex structures, most people use JSON
randominternetus
this /media/static/image/1951.JPG
FunkyBob
randominternetus: did you move the files?
randominternetus
with full url gives 404
noyb has quit
I reuploaded
FunkyBob
randominternetus: are you using runserver?
randominternetus
yeah
it's dev mode
FunkyBob
did you add a url pattern to serve MEDIA_URL ?
randominternetus
no :(
What should I do?
FunkyBob
that's why you get 404
emihir0 has quit
emihir0 joined the channel
RandomSerb
given I only ran startapp foobar, to remove it, only delete files and dirs, right? there's nothing in migrations dir, and I haven't added any code
Erayaydin
FunkyBob: I use plain HTML without JS dependency and form submit without JS/Ajax. I think, I should add hidden field for iter unknown count of post
lobo_d_b joined the channel
for example,<input type="hidden" name="total" value="20" /> news-0-image, news-0-is_save, news-1-image, news-1-is_save and iter it with for in python code ? Right
FunkyBob
Erayaydin: sure, if you like
I have seen a python lib somewhere for processing that PHP style stuff...
Erayaydin
I dont like this structure but its easy to fix :P :(
moldy
any reason you don't use a formset?
camouflage has quit
brainproxy joined the channel
jrial has quit
Erayaydin
moldy: I tried, but I need modelformset with factory in admin page. It break with built-in django page
I tried to extend "base_site.html" in built-in template
FunkyBob
wait, what?
Erayaydin
It didn't go well, I think I did mistake
FunkyBob
so is all of this trying to customise admin?
Erayaydin
No, adding custom page in admin with multiformset
FunkyBob
...
Erayaydin
I try to build a crawler
FunkyBob
I keep telling people not to use admin for their site... they don't listen
I'm going to bed
Erayaydin
I am also say that
but that Interview....
FunkyBob
g'night
Erayaydin
If I make choice, I will go use Flask or vibora :P
Debnet joined the channel
JustASlacker has quit
emihir0 has quit
emihir0 joined the channel
jtiai joined the channel
emihir0 has quit
adsworth has quit
GraysonBriggs joined the channel
fikka has quit
Xaldafax joined the channel
theWhisper_ joined the channel
Debnet has quit
fpghost84 joined the channel
sec^nd has quit
fpghost84
Can I use a django-filter custom FilterSet on a DRF Viewset? I add filterset_class but it seems to be ignored completely
fikka joined the channel
daydreamm joined the channel
Maybe it only works on APIView not viewsets?
mvanorder__ joined the channel
moldy
yes to the first question, maybe to the second
mvanorder__ has quit
brainproxy has quit
fpghost84
Yes I can use a custom filterset on a viewset, but maybe it only works on a view? seems contradictory
kezabelle
Viewsets are APIViews IIRC?
jaykay has quit
fikka has quit
jgadelange joined the channel
moldy
fpghost84: ah, missed that you said ViewSet in the first question
fpghost84
all the example in the docs I can find use ListAPIView and filter_class added....I'm using a model viewset, and added the same, and absolutely no filtering takes place it seems
I have filter_backends = (DjangoFilterBackend, filters.OrderingFilter)
filter_class?
you mean filterset_class?
brainproxy joined the channel
felixx has quit
fikka joined the channel
moldy
hmm, should work
i'd pdb into some interesting locations
how did you check if it's working?
fpghost84
filter_class works :o
but the docs say filterset_class??
what made you think (correctly) filter_class?
I think they changed from filter_class - > filterset_class in latest version, and it seems I'm using the old one, not consistent with docs
oh well, crisis over. thanks
moldy
fpghost84: DRF docs use filter_class, django-filter docs filterset_class
mreznik has quit
fikka has quit
twtduck
Hey people, how might I use a button to run some django code without refreshing the page?
moldy
i'm guessing that attribute is looked up by the filter backend itself
twtduck: ajax
fpghost84
moldy: thanks....don't suppose you know how to filter on an attribute of a field too? like I have a datetimefield and I want to filter on the .year? Do I need a custom filter method?
v0lksman
I want to remove all tabs, spaces and new line chars from the begin and end of a string. can I do str.strip(r'\t\s\r\n') ? or should I import re and do it that way?
kezabelle
strip() already removes whitespace characters
moldy
fpghost84: iirc this is documented in the django-filter docs, `__year` might work, but not sure
v0lksman
even if you define that chars? I thought that it overrides what it strips
moldy
v0lksman: so don't define them?
kezabelle
it does ... but you're defining whitespace characters ... which is what it does by default
v0lksman
I need to define them because whitespace != tabs and new line
kezabelle
yes it does
moldy
if you want to strip exactly those 4 chars and nothing else, than you can do it like you said, yes
v0lksman
it wasn't removing them hence this road I'm on
fikka joined the channel
kezabelle
"<tab>...</tab>".strip() will remove the tabs
(ditto \n)
randominternetus has quit
v0lksman
it was new line specifically that made me start looking deeper
fpghost84
moldy: hmm, I thought it would be that, but it seems that notation for related fields, and throws exception
tm007 has quit
v0lksman
but I'll test further
kezabelle
len("\tlol\t".strip()) == 3
moldy
"\tfoo\t".strip() --> 'foo'
kezabelle
ditto if the \t is \n
lobo_d_b has quit
moldy
fpghost84: you can also hook in a method or such. check their docs.
kezabelle
I strongly suspect your actual problem is whitespace between character ranges
ie: "\ntest\nwhee\n" won't remove the middle "\n" ...
in which case you'd either need to splitlines() or use regex or whatever, yeah.
v0lksman
no...it was users copying and pasting a string into a search field and capturing the newline so the string would have a new line on it
(and fail the search)
originally I was using rstrip too but switched to strip as it makes more sense