https://dpaste.de/rW1A#L12,19 so the question is why is my filter being interpreted as created_by_id in line 12 when it should be type like in line 19.
The union is from a weird permission back end I made
That lets people see all the objects they create as well as those they have roles for
So you can't apply additional filters to a union, is that correct?
fnstudio has quit
NomadJim_ joined the channel
knbk
not really sure about filters, but there's a lot you can't do on union querysets
powermac
sharktopus: Thanks, I got sucked into a meeting, i'll try that request.post trick
morenoh149
how does debugging a django app look like? in ipdb or pudb. meaning how do I get started?
BeerLover joined the channel
NomadJim has quit
BeerLove_ has quit
mRWaffles
Well shit.
You are right "In addition, only LIMIT, OFFSET, COUNT(*), and ORDER BY (i.e. slicing, count(), and order_by()) are allowed on the resulting QuerySet."
danner joined the channel
frege joined the channel
nopolitica has quit
aossama has quit
steelcowboy
If I have nginx proxy Django and I give it some endpoint /app, in my main project's urls.py do I need to do '^/app/djangoendpoint/' or is there an nginx setting so I can only pass the /djangoendpoint part of the URL?
sharktopus
you can configure it to work in any way you desire
both nginx and django route regex give you the flexibility to go either way with it
steelcowboy
Ah, oh. What's the nginx setting so I could get rid of the /app part when handing it off the Django?
steelcowboy: that's almost certainly not what you want, since all internal links will be missing the /app prefix. what WSGI server are you using?
steelcowboy
Oh, whoops. Gunicorn
jmill joined the channel
mRWaffles
Why can't you filter a unioned queryset :(
Ryanar joined the channel
sharktopus
knbk: what if dude is versioning some APIs with nginx as the proxy and router
knbk
steelcowboy: or well, it is what you want, but you need to add ``proxy_set_header SCRIPT_NAME /app/`` or something
ironbeard joined the channel
sharktopus: ??
that doesn't change the fact that you want internal links to include the path prefix
sharktopus
not necessarily
ironbeard
I'm using ModelForm and would like a given field to contain it's instances' pk in the class/id name. How can I go about doing this?
sharktopus
i just gave a case where it isnt necessarily true that you'd want the path prefix to be different at each django instance
in any case it doesnt matter enough to argue about :)
nopolitica joined the channel
steelcowboy
I'm confused. knbk are you saying I shouldn't chop the URL before I send it to Gunicorn?
sharktopus
steelcowboy: if you're looking for advice and not an answer then I'd say don't munge your URLs at all
steelcowboy
So in nginx location /app { ... } and in urls.py r'^app/endpoint/'?
sharktopus
yes that is my preference
less cognative load
less confusion about what routes where
its just all very explicit
mlavin joined the channel
you can look at just your urls.py files and feel confident you understand what goes where, if nginx is doing path rewriting you now need to think about and possibly check two locations
and that's assuming your nginx configuration isnt dynamic in some way
fpghost84 has quit
roomcayz joined the channel
knbk
steelcowboy: ok I found a working setup
if you want it that way, you need to rewrite the url to cut of /app/, and use ``proxy_set_header Script-Name '/app/';``
frege has quit
Eih joined the channel
that way Django knows that all urls should start with /app/, e.g. when reversing urls
frege joined the channel
but you won't have to add /app/ to all your url patterns
aossama has quit
frege has quit
frege joined the channel
aossama joined the channel
lorddaedra joined the channel
danner joined the channel
frege has quit
lorddaedra
is it possible to get model name "MyModel" inside default_func function, called in MyModel.uuid = models.UUIDField(..., default=default_func, ...)
frege joined the channel
knbk
lorddaedra: a callable default doesn't get any parameters, but you can use a partial to pass in the model: ``def default_func(model_cls): ...`` and ``default=functools.partial(default_func, MyModel)``
polaris joined the channel
danner joined the channel
lorddaedra
understand, thank you...
jhfisc joined the channel
jmill has quit
lamduh joined the channel
lamduh has left the channel
cubillosxy_py
hi, recenrly I update my django 1.9 -> 1.11 , but i have problem when i run -python manage collectstatic django.core.exceptions.SuspiciousFileOperation: The joined path (/Users/c02stf74fvh3/desarrollo/rapigodjango/fonts/fontawesome-webfont.eot) is located outside of the base path component (/Users/c02stf74fvh3/desarrollo/rapigodjango/rapigodjango/static)
I'm not very experienced with webservers so excuse my limited knowledge of nginx configuration haha
danner joined the channel
frege has quit
frege joined the channel
yaplej
Hi, Im trying to parse a complex slug with multiple variations. Ethernet1, Ethernet1,FastEthernet10,FastEthernet0/1,FastEthernet1/0/9,FastEthernet2/0/32,GigabitEthernet4/0/3
I found it much easier to just enclose each slug with () from the source and strip () off later. No problem with that right?
My URL can be like this: /001049000000/GigabitEthernet9/0/32/FOC12345/WS-C3750-48PS-S/Cisco Systems Inc. where 9/0/32 are part of a single slug.
frege has quit
tonythomas joined the channel
steelcowboy
knbk: What do you think?
frege joined the channel
Gandalfar has quit
ironbeard has quit
Gandalfar joined the channel
yaplej
To make it easier I thought to just enclose each slug in () like this /(001049000000)/(GigabitEthernet9/0/32)/(FOC12345)/(WS-C3750-48PS-S)/(Cisco Systems Inc.) so its easier to separate each slug.
knbk
steelcowboy: I just realised I never got it working in the first place, so I just set the FORCE_SCRIPT_NAME setting in Django
jccn
yaplej I'm really not sure what you're trying to do. If you're trying to decide what URL pattern scheme you are planning to use I think that one looks god-awful
glassresistor has quit
jmill has quit
knbk
steelcowboy: if you just set FORCE_SCRIPT_NAME = '/app/' in your setting, and do the rewrite, it should work, though it's not the cleanest way
frege has quit
steelcowboy
Hm, weird. Alright, well thank's for your help!
jccn
I don't know why you need to encode / into the url without subsitution
but you could do the parsing with regular expressions
steelcowboy
thanks. Don't know why I had that random apostrophe haha
frege joined the channel
jccn
if you understand regular expressions and have some kind of reason to proceed with that monstrous url scheme