#django

/

      • netheranthem has quit
      • webpigeon has quit
      • jonez has quit
      • exaroth joined the channel
      • XofP has quit
      • webpigeon joined the channel
      • adw1n joined the channel
      • SecondForm_Glenn has quit
      • jonez joined the channel
      • Troy1 joined the channel
      • durdenk has quit
      • exaroth joined the channel
      • shredding joined the channel
      • FunkyBob
        wow, somehow I was running with a pre-release django 1.11
      • so the on_delete argument to ForeignKey wasn't required
      • shredding has quit
      • newdimension
        I'm using both class based views and Modelform. Is it an either or kind of situation? Because I keep thinking that I should just work with the class and remove the modelform
      • FunkyBob
        ...
      • class based views use modelforms
      • well, class-based _generic_ views use modelforms
      • like CreateView or UpdateView
      • if you don't give them one, they'll generate one as needed
      • Troy1 joined the channel
      • AndrewGearhart joined the channel
      • jodth07 has quit
      • hyperair has quit
      • KeyJoo has quit
      • newdimension
        I'm using modelforms because I'm adding values for crispy-forms. But other than that I feel that class based views are self-sufficient. What is the need for the modelform?
      • jobelenus joined the channel
      • FunkyBob
        a ModelForm is a Form that infers the fields it needs from a Model
      • it also has helpers, like the save method, for updating the model instance it's editing
      • and the ability to grab its initial values from a model isntance
      • as for crispy-forms... it pushes too much presentation into code, IMHO
      • newdimension
        What do you use instead? Just plan forms.field and html?
      • *plain
      • FunkyBob
        django-sniplates if I want to control form rendering
      • newdimension
        Thanks, I'll look into it
      • lacrymology has quit
      • hyperair joined the channel
      • I see in BaseModelForm they're checking if Instance is None. I need to check if I'm updating an existing entry or creating a new one. Does BaseModelForm create a new instance if not given before or after my own code runs?
      • (If I'm creating a new one, I'm setting an initial data)
      • Code for clarity: https://dpaste.de/mFf3
      • AndrewGearhart has quit
      • I answered my own question. Since I'm calling self.init django will assign a new instance to instance so my check will always fail
      • jobelenus
        Anyone have an idea why a form would tell me an entry in `choices` in a form would throw an `invalid_choice` error? https://dpaste.de/3r9x the field itself successfuly validates, so i really dont know what the hell is going on
      • miz- has quit
      • iancurtis joined the channel
      • Combined2857 joined the channel
      • Combined2857 has quit
      • chicocvenancio has quit
      • FunkyBob
        yay, my tests are finding bugs :/
      • mcspud
        Thats the point isn't it :P
      • jobelenus
        heh nice FunkyBob
      • blackcross joined the channel
      • newdimension
        In a modelform I need to determine if we're dealing with a create or update view. I believe one way is to check whether the request has a pk. But reading through the code I'm curious as to how BaseModelForm is getting the Instance variable.
      • lolidunno
        I'm finally starting to write tests for these codes I inherited
      • spent the past fortnite just writing tests
      • FunkyBob
        django.core.exceptions.FieldError: Unsupported lookup 'eq' for FloatField or join on the field not permitted.
      • jobelenus
        newdimension: its passed in via constructor. but the form shouldn’t care. if it does, make two forms and subclass the differences away
      • FunkyBob
        oh, exact... duh
      • mcspud
        hah
      • Can't float fields be compared?
      • really?
      • FunkyBob
        field=value is implicitly field__exact=value
      • jobelenus
        ^
      • mcspud
        oh
      • newdimension
        jobelenus: Do you know where I can find the code that passes the variable? I'd like to learn how it works
      • jobelenus
        MyForm(instance=foo)
      • thats it
      • mcspud
        I have that demo right meow FunkyBob, although it looks like the sales guy has been through everything
      • jobelenus
        __init__
      • mcspud
        PRetty good
      • FunkyBob
        mcspud: g'luck
      • mcspud
        We'll see
      • jobelenus
        newdimension: its the instance argument in the __init__
      • mcspud
        I think the only time I've felt this nervous about an unfinished product was when I presented one to the board of Wesfarmers
      • newdimension
        jobelenus: Yes, I'm trying to understand what calls __init__ and populats Instance
      • mcspud
        They were a little technically inept though so that was ok :)
      • duoi
        mcspud pm
      • jobelenus
        newdimension: you’re populating it when you instantiate the class.. `__init__` is the method called when you instantiate the class
      • blackcross
        I have a download view, which I am using to serve sensitive files which are encrypted using encFS, but are also available in a decrypted folder, only accessible with a key (user Token) and a valid filename. It works fine in testing (on the production server using python manager.py runserver xyz.com:8000 , but in production using uwsgi, I get HttpResponseNotFound(), permissions are correct for
      • the folder and files, they are under the same user:group as the django project. What could be going wrong? http://dpaste.com/3HAY6H6
      • chicocvenancio joined the channel
      • sorry, thought I used dpaste.de
      • jobelenus
        Can anyone help me with a form field `choices`/“Select a valid choice” problem? https://dpaste.de/3r9x the choice its telling me is invalid is a valid choice… I’m unsure whats wrong here
      • blackcross
        if anyone else knows a better way to encrypt files via django or postgresql, then serve them unencrypted, please let me know :)
      • anrgywombat joined the channel
      • anrgywombat is now known as dtzitz
      • jobelenus
        blackcross: is it just an auth problem?
      • blackcross
        jobelenus, no, think it is a filepath problem
      • otherwise i'd get a 403
      • jobelenus
        well can you get into shell on prod and run through it line by line?
      • blackcross
        yes
      • jobelenus
        b/c runserver and apache/wsgi/whatever else it going to produce a different starting path
      • blackcross
        ahh
      • gotcha
      • jobelenus
        we always define a `PROJECT_ROOT` in settings
      • so that test will have one set, and prod will have another set
      • which are the same
      • FunkyBob
        as opposed to using the default BASE_DIR ?
      • jobelenus
        well, end up being the same
      • right
      • so the code doesnt matter what process is running it
      • blackcross
        ty, will debug it that way
      • jobelenus
        sure thing
      • exaroth joined the channel
      • just throw up a test page that puts the base_dir/pwd into html so you see where the server process thinks it is.
      • roger_rabbit joined the channel
      • adwin_ joined the channel
      • newdimension has quit
      • newdimension joined the channel
      • jobelenus has quit
      • Info-Screen has quit
      • Info-Screen joined the channel
      • georgemarshall joined the channel
      • newdimension has quit
      • ycon_ joined the channel
      • wqz joined the channel
      • wqz
        hi
      • FunkyBob:I re-described the problem completely at here https://dpaste.de/8HPk
      • Back2Basics joined the channel
      • FunkyBob
        wqz: ah, that's nice and detailed
      • infinitesum joined the channel
      • jodth07 joined the channel
      • wqz
        FunkyBob:Help me look, thank you
      • FunkyBob
        I recommend you open a ticket, and post those details in it and to the django-dev mailing list
      • jarshwah_: oi... y ou suffered oracle, yes?
      • I'm trying to remember who the main oracle uses are
      • shai?
      • wqz
        FunkyBob:I can't send a mail in my office, maybe after work and send a mail.I think it's a bug.
      • FunkyBob
        yes, it very well may be
      • open a ticket, please
      • also, I've kicked off the discussion in #django-dev if you want to go there
      • wqz
        FunkyBob:OK, ths.
      • FunkyBob
      • that looksl ike the place to 'fix'
      • blackcross
        hm
      • FunkyBob
        wuld be quite straight forward to apply your altered SQL,, in fact
      • wqz
        I am a novice, I first study how to open a ticket now.
      • ycon_ joined the channel
      • FunkyBob
        ok
      • but if you look at that link now, I think you'll see it's simple
      • wqz
        OK
      • FunkyBob
        and so easy to test locally a fix
      • wqz
        yes, I agree.
      • FunkyBob
        in fact, I think your solution may even be beter performance
      • schinckel: you and freakboy3742 are last to have your fingers on that code , oddly
      • blackcross
        so, looks like my directory, /var/www/decrypted which I am using as my encFS decryption directory is of course a mounted volume, I believe this is causing my serve error, since when I try to do sudo chown -R user.user /var/www/decrypted it saids I do not have permission, even though I do have sudo permission, how would I go about serving files from a mounted directory?