#django

/

      • jay-m joined the channel
      • poorBastard joined the channel
      • maryokhin joined the channel
      • jonky
        i think i've made a serious design mistake
      • mattmcc
        Did you use a flaming logo?
      • johnny2600 has quit
      • jtiai
        Why makemigrations does say nothing changed even these are purely new models?
      • FunkyBob
        because the app isn't in INSTALLED_APPS ?
      • dodobas
        jtiai: did you add ... ^^^ that
      • jonky
        no, my logi is an invisiblewidget that auto-plays russian oper and meshuggah simultaneously
      • jtiai
        They are since I got few complaints about OneToOne and ForeignKey with unique.
      • Well it would help to install actual apps to virtualenv as well...
      • Now they're found but still, no changes detected...
      • jonky
        but seriously, i have an api(using DRF) with several mixins that do some calculations based on the user. In development I was using session authentication to test the interface, but tokenauthentication is what I will need in production. however the user-based calculations took place in dispatch, but with tokenauth the user seems to be set AFTER dispatch, making the user always anonymous.
      • Itkovian joined the channel
      • does turning each of the mixins into permission classes seem to be the best idea?
      • capella-da-star joined the channel
      • maryokhin has quit
      • maryokhin joined the channel
      • jtiai
        Do I need to explicitly list all apps for migrations? Since once I did that for one app it created proper migrations...
      • ojii|work has quit
      • sagaragarwal94 joined the channel
      • limbera_ joined the channel
      • jay-m has quit
      • jay-m joined the channel
      • ojii|work joined the channel
      • brat197 joined the channel
      • the_rat joined the channel
      • v0r0nwe has quit
      • limbera_
        i'm trying to setup a flask app (using httpd and mod_wsgi) on the same box as a wordpress app being served by httpd
      • i am struggling to figure out what to list as the servername for my vhost for the python app
      • ah whoops, this was intended from the httpd channel, apoligies.
      • ojii|work
        :D
      • servername is the domain for your vhost, isn't it?
      • limbera_
        yeah i assume so, not entirely sure i normally use nginx and django - but i'm using flask to build some extensions to a wordpress site (interfacing with te WP rest api)
      • ojii|work
        limbera_: looking at https://httpd.apache.org/docs/2.2/vhosts/exampl... it looks like it's the hostname for the vhost
      • deb joined the channel
      • keimlink joined the channel
      • limbera_
        my use case is a little different, i want hostname.com to load my wordpress site (which it is) and i want hostname.com/payment to load my flask app
      • v0r0nwe joined the channel
      • ojii|work
        oh
      • keimlink_ joined the channel
      • so in your wordpress vhost, add a <Directory> with your wsgi config
      • nah that's not it
      • WSGIScriptAlias /payment/ path-to-your-wsgi-file. that's the one i think
      • kezabelle
        set the wsgiscripalias to /payment ?
      • yeah, what ojii said.
      • limbera_
        thank you
      • ojii|work
        damn it's been a while since I had to deal with apache
      • v0r0nwe has quit
      • molavy joined the channel
      • wili has quit
      • v0r0nwe joined the channel
      • molavy
        hi, i want make a single queryset from two models, both models have one field named mdl_plan_process with same value
      • kezabelle
        why does it need to be a queryset?
      • keimlink has quit
      • (and also, if they're separate models, basically not happening)
      • jcugat has quit
      • bordeltabernacle joined the channel
      • molavy
        how can i do this, mdl_review, mdl_plan both have a field named mdl_plan_process with same value, i want merge this two models fields before serialze
      • d0p joined the channel
      • jcugat joined the channel
      • mdl_review has this fields: review_status, mdl_plan_process, and mdl_plan has this fields: title, body, mdl_plan_process
      • richb8 joined the channel
      • d0p
      • keep that in mind
      • keimlink_ has quit
      • ojii|work
        sounds like there should be a relation (one-to-one? many-to-many? one-to-many?) between those models.
      • ikke joined the channel
      • v0r0nwe has quit
      • richb8 has left the channel
      • keimlink joined the channel
      • kezabelle
        molavy: sorted(chain(qs1, qs2), key=attrgetter('mdl_plan_process')) or something, I suppose. It's not a queryset, though, because that doesn't make sense.
      • (unless there's a relation, as ojii says)
      • keimlink_ joined the channel
      • ojii|work
        the "equal mdl_plan_process" sounds like it really should be a db-level relation
      • teddybeermaniac joined the channel
      • xBBTx joined the channel
      • xBBTx
        FunkyBob: any ETA on when pluggable-explosives will be merged in sniplates master?
      • graingert joined the channel
      • capella-da-star joined the channel
      • heyts joined the channel
      • garygraham joined the channel
      • lordkryss joined the channel
      • keimlink has quit
      • Katharsis
        how to use custom processors (which return some data) for all views but in one app?
      • a don't need this data in all views project
      • moldy
        Katharsis: a mixin, a decorator, or a plain function call
      • b1 joined the channel
      • kezabelle
        a context processor, too
      • moldy
        Katharsis: or use a context processor and ignore the fact that some views don't need it
      • benbacardi joined the channel
      • kezabelle
        meh, you have request in the processor, you can usually figure out the app from the path, at which point, just don't add it to the context if it's not relevant
      • erve joined the channel
      • moldy
        not nice, but works :p
      • heyts has quit
      • garygraham has quit
      • benbacardi
        Is there a way to access the form and/or it’s cleaned_data object from inside get_success_url in a FormView?
      • molavy
        ojii|work: two seperate model that both has to one model another model relation, i make query on them and want merge fields in this queryset results
      • FunkyBob
        xBBTx: when people have tested it and shown it beneficial
      • slav0nic joined the channel
      • molavy
        before serialize, i want something like this: fields status, body, title,
      • LondonAppDev joined the channel
      • status is from mdl_review and body,title are from mdl_plan
      • poppingtonic joined the channel
      • xBBTx
        FunkyBob: allright, I'm working on a feature in a project now and running against that branch. Do you want feedback on github or how would you like to see that happen?
      • erve has quit
      • molavy
        kezabelle: sorted(chain(qs1, qs2), key=attrgetter('mdl_plan_process')) dont merge fields in this two querysets
      • xBBTx
        it's probably not going to see a release this year, but I'm aiming for early 2016 :-)
      • kezabelle
        molavy: what?
      • why would it merge anything?
      • xBBTx
        benbacardi: self.get_form() ?
      • ohrstrom has quit
      • poppingtonic
        I'm implementing full-text-search in my django project and would like to add an annotation for rank. Using django.db.models.aggregates takes me part of the way, but how do I get around the fact that the function resolve_expression needs exactly one source_expression? How do I add the correct source_expression?
      • b1 joined the channel
      • benbacardi
        xBBTx: I’m using 1.7, and that requires form_class, so I pass it self.get_form_class(), and it tells me the form I get back doesn’t have a cleaned_data attribute
      • Tanger has quit
      • xBBTx
        benbacardi: sorry, you need to fetch the class as well, look at django.views.generic.edit.ProcessFormView
      • benbacardi: you need to call is_valid again to trigger validation
      • benbacardi
        xBBTx: Ah ok, thanks
      • xBBTx
        since it's passing you a new form instance
      • molavy
        kezabelle: mdl_review, mdl_plan both have a field named mdl_plan_process with same value, i want merge this two models fields before serialze
      • benbacardi
        That’s a shame, it’d be nice to get a way to get the already-validated form
      • b1 joined the channel
      • molavy
        mdl_review has this fields: review_status, mdl_plan_process, and mdl_plan has this fields: title, body, mdl_plan_process
      • xBBTx
        you could also override form_valid and set the form in the view as an attribute and read that one
      • molavy
        i want get this, merge this two model according to mdl_plan_process
      • xBBTx
        benbacardi: https://dpaste.de/WruB this would do the job I take
      • kezabelle
        so … do that then? once you have it in python you can do whatever with it
      • benbacardi
        xBBTx: Yeah, that’s what I’m doing, I just wondered if there was a built-in way to do it - thanks :-)
      • kendas_ joined the channel
      • kezabelle
        molavy: use defaultdict(list) and iterate over your results, using mdl_plan_process as the key, and insert as necessary; at the end, you'll have a dict whose keys are your unique collections, and values are the matching ones
      • kingplusplus
        does BaseCommand spawn a new process?
      • jay-m has quit
      • jay-m joined the channel
      • mattmcc
        No
      • jtiai
        Why manage.py makemigrations says no changes detected if I don't provide any app but if I put app there migrations are created...
      • yomilk joined the channel
      • kendas_ has quit
      • the_rat_ joined the channel
      • nurulwai joined the channel
      • xBBTx
        jtiai: the obvious answer would be that Django doesn't know at which application to look, but I think it would be better to just throw a CommandError saying that you need to specify an app
      • or look at all installed_apps
      • it's a bit unintuitive at the moment
      • molavy
        kezabelle: is there a sample code about defaultdict usage
      • moldy
        hmm, i always thought if you don't specify an app, it will make migrations for all apps?
      • Nanor joined the channel
      • Nanor
        I'm building a Q query with queries = [Q(skills=s) for s in skills]
      • How can I set the query to OR rather than AND