#django

/

      • sydbarret
        the id is the error
      • its expecting id
      • jtiai
        Well id is the error but do you know why?
      • sydbarret
        seems because is not included on the rendering
      • jtiai
        That is wrong answer.
      • Don't guess. Check things out.
      • Specially since it's really easy to check out with debugger.
      • sydbarret
        debugger in google?
      • jtiai
        google?
      • sydbarret
        this guy is havving similar problem https://stackoverflow.com/questions/49026157/dj...
      • and someone advice it to put it as hidden
      • jtiai
        And don't read SO.
      • Which is most probably the wrong answer.
      • n0nam3 joined the channel
      • usr123
        I am using restframework. Wanted to create a view for both create and update. I get this error. https://dpaste.de/mY10. Can someone please let me know what is wrong here. Error says expected url kwarg name. I did give the kwarg name.
      • kiloreux joined the channel
      • dg_vrani has quit
      • dg_vrani joined the channel
      • knbk
        usr123: ?name=... is a GET parameter, not a URL kwarg
      • tdy joined the channel
      • you need something like path('<name:str>/', ...) in your urlconf
      • xliiv joined the channel
      • usr123
        knbk: Thanks
      • alekh joined the channel
      • PantelicGR3 joined the channel
      • felixx joined the channel
      • alekh has quit
      • foxmask
        o/
      • Impaloo joined the channel
      • fletom has quit
      • nazarewk joined the channel
      • shangxiao
        o/
      • mitaka joined the channel
      • tdy has quit
      • RCStef joined the channel
      • fletom joined the channel
      • tm007 joined the channel
      • usr123
        Does anyone use meld for git diff?
      • tdy joined the channel
      • tneva82
        Hello. Is there any sensible way to get request in pre_save signal? Trying to use it to save author of person doing edit in log. It used to work but seems when we upgraded from 1.10 to 2.0.5 something changed in django that screwed old method(now sometimes I didn't get any info, sometimes author was incorrect)
      • jtiai
        tneva82: So what was your "old methods"?
      • maks25 has quit
      • Stigster joined the channel
      • tolja
        usr123: sure
      • usr123
        tolja: So, when you compare, what are the two sections? master and current branch?
      • tolja
        Depends on what you are comparing
      • usr123
        tolja: Yeah, so how do I give it params? git difftool master currentbranch. That is fine?
      • tolja
        Can't remember, check man git diff
      • usr123
        tolja: Thanks
      • Stigster
        Greetings people! I have a bit of a model issue that I was hoping someone might offer me their two cents on. I've tried to draw it up in a UML-type diagram (https://pasteboard.co/HEIV9WR.png) and the issue is this: The subclasses of my abstract "Source" class would all be duplicated in the "SourceType" class. Yet there are attributes associated with the Source Type entity that can't be moved to either the abstract class or
      • the subclasses without breaking BCNF. Any ideas how to solve this in a more elegant way?
      • tneva82
        jtiai: I'm not sure how it anymore works but middleware that puts requests into global variable by thread and pulled when asked it from there. From the look of code think I found that from stackexchange or somewhere else
      • jtiai
        tneva82: localthread ?
      • or was it threadlocals...
      • tneva82
        _requests[current_thread()] = request <- save in middleware like this, use from threading import current_thread to get thread and return from the _requests with that
      • jtiai
        that doesn't seem right...
      • mattmcc
        Stigster: You could put the fields common to Source and SourceType in another abstract model.
      • tneva82
        jtiai: Quite likely and now obviously it isn't as it worked.
      • jtiai
        tneva82: https://docs.python.org/3/library/threading.htm... you should do something like that to store request in thread locals. (and to read it in signal)
      • tneva82
        I figured roundaway way to do it by putting in author into instance before saving and grabbing it there in pre_save but that's major PITA
      • Stigster
        mattmcc: Hm! And then inherit from both in each subclass?
      • mattmcc
        The subclasses would get it by default if they extend Source.
      • Er, sorry, misread. Yes.
      • jadajada joined the channel
      • SourceType(CommonStuff), Source(CommonStuff)
      • Although per rule of threes, it may be simpler to just duplicate the fields.
      • Stigster
        I still need to create the SourceTypes somewhere, though. As with the baseReliability / (instance)-reliability association (which is an example, the model isn't complete).
      • dodobas joined the channel
      • Source of type X has B reliability by default, this instance I of source type X has reliability R.
      • amcorreia has quit
      • Correction: Sources of type X ... (plural)
      • LiftLeft joined the channel
      • sydbarret
        mysql binary field shows values of 0 and 1 but when rendered in django all checkboxes are checked
      • Amany joined the channel
      • dodobas
        yutro
      • LiftLeft has quit
      • rpkilby joined the channel
      • LiftLeft joined the channel
      • kezabelle joined the channel
      • tdy has quit
      • Haudegen joined the channel
      • PantelicGR has quit
      • entrop joined the channel
      • cryptopian joined the channel
      • dg_vrani has quit
      • eb0t
        I HAVE an issue with an ArrayField
      • damienxx joined the channel
      • any help will be greatly appreciated
      • mattmcc
        cleaned_data is a dict, so form.cleaned_data['skills_search']
      • eb0t
        ah ok thanks mattmcc ..ill try that
      • krishna0512 joined the channel
      • lolidunno has quit
      • Stigster has quit
      • alekh joined the channel
      • rpkilby has quit
      • agrawalritesh joined the channel
      • Hobbestigrou joined the channel
      • Hobbestigrou
        hi
      • i try to migrate from django 1.9 to django 1.10 and i have test failed now
      • i try to set a session for an anomyous user
      • if i login before that works
      • any idea to fix that ?
      • sydbarret
        mysql binary field shows values of 0 and 1 but when rendered in django all checkboxes are checked
      • azulakina joined the channel
      • in my model I have clientrevert = models.BooleanField(db_column='ClientRevert', default=False)
      • in my forms clientrevert = forms.BooleanField(initial=False,required=False)
      • on template <td>{{ form.clientrevert }}</td>
      • jtiai
        Hobbestigrou: Um... If you do have sessions middleware installed you should get session automatically for all users, even for anonymous users so you don't need to set it any special way.
      • Hobbestigrou
        jtiai, i confirm i have the middleware set in the settings
      • and if i login before i have my data in the session
      • jtiai
        Oh that of course doesn't apply to certain type of tests.
      • Since tests won't go trhough middleware.
      • Hobbestigrou
        ah ok
      • i don't understand the problem
      • jtiai
        Well provide full code and the traceback in pastebin. Maybe it's something else.
      • CtrlC joined the channel
      • robinb joined the channel
      • Hobbestigrou
        i have no traceback
      • just the failed, the assert
      • Perkol has quit
      • realnot
        In django is possible to filter out all records that have a field not starting with 2 chars?
      • cryptopian
        2 particular chars?
      • realnot
        the opposite of `nonstartwith`
      • cryptopian: no any of [a-zA-Z]
      • robinb
        I'm having trouble understanding how to structure my project. I'm creating a website which on the homepage will have products, campaigns, offers and banners which can be added through the admin page. How would you structure this? Would you create apps for those different categories or make a single homepage app?
      • kezabelle
        .exclude(field__startswith?)
      • cryptopian
        The opposite of .filter() is .exclude()
      • Hobbestigrou
      • agrawalritesh has quit
      • realnot
        kezabelle, cryptopian but how I specifiy `all chars`?
      • iml_ has quit
      • cryptopian
      • jtiai
        Hobbestigrou: Hmm, pytest. I've no idea does it affect your tests somehow.
      • cryptopian
        @realnot: Link above. You can use a regex in a query to get what you need
      • Hobbestigrou
        jtiai, i have also try with the django test client
      • and i have the same problem
      • jtiai, i'm going try again
      • alekh has quit
      • fletom has quit
      • jtiai
        Hobbestigrou: Could you please use dpaste.de in the future. That sprunge is terrible - it doesn't even have code highlight...
      • realnot
        cryptopian: thanks :)
      • Hobbestigrou
      • jtiai
        still no line highlightning (which is really useful). But I don't see anything wrong so you need to pickup debugger and see why things go sideways.
      • jackhum joined the channel
      • I know that Django added session verification as a mandatory step in 1.10