#django

/

      • bradfordli123 joined the channel
      • hop
        yes
      • Haudegen joined the channel
      • fikka joined the channel
      • ironfroggy joined the channel
      • cebor_ has quit
      • cebor joined the channel
      • Combined2857 has quit
      • sunil_bansal joined the channel
      • sunil_bansal has quit
      • brainproxy joined the channel
      • merc88 joined the channel
      • r29v has quit
      • brainpro1 has quit
      • jessamynsmith
        anarchean: there are advantages to both options
      • fikka has quit
      • I think in your case I would most likely create groups with appropriate permissions, and put the users in groups
      • rpkilby has quit
      • polaris_ joined the channel
      • polaris_ has quit
      • rpkilby joined the channel
      • anarchean
        I would need an extra permission "read", tho, wouldn't I? Because there are some information that only "manager" users can access
      • polaris has quit
      • polaris joined the channel
      • jadajada has quit
      • brainpro1 joined the channel
      • geekodour08
        hello, how to specify spcial group of users as a forign key for a model?
      • I mean i am creating a model class, only users who are teachers should be able to modify it
      • fission6 joined the channel
      • fission6 has quit
      • merc88_ joined the channel
      • merc88_ has quit
      • addohm has quit
      • merc88 has quit
      • brainproxy has quit
      • microdex has quit
      • anarchean
        @geekodour08 I think what you want is to use django permissions to limit user access and create a group "teachers" that have CRUD access to the model
      • But I may not be the best reference since I'm looking for tips for the django auth system here too
      • nazarewk joined the channel
      • tonythomas joined the channel
      • jadajada joined the channel
      • amcorreia
      • amcorreia has quit
      • amcorreia joined the channel
      • XofP has quit
      • rpkilby has quit
      • fickleberry joined the channel
      • ironfroggy joined the channel
      • microdex joined the channel
      • xliiv joined the channel
      • chocoelho joined the channel
      • rpkilby joined the channel
      • shallow has quit
      • microdex has quit
      • shallow joined the channel
      • wildlander joined the channel
      • felixx has quit
      • microdex joined the channel
      • fpghost84 joined the channel
      • microdex has quit
      • Bryson has quit
      • sec^nd has quit
      • rpkilby has quit
      • rpkilby joined the channel
      • kakulukia joined the channel
      • veduardo joined the channel
      • fpghost84 has quit
      • microdex joined the channel
      • kakulukia
        i try ot understand some of the magic of django models, but here is one part idont quite understand. how can a function call with no args still result in args being passsed? django/db/models/base.py(318)__new__() -- new_class._prepare() to django/db/models/base.py(329)_prepare() -- def _prepare(cls): .. can somebody explain how this works?
      • rpkilby has quit
      • fikka joined the channel
      • sec^nd joined the channel
      • gugah joined the channel
      • doismellburning
        kakulukia: that's Python objects/classes; I don't have a good guide handy
      • microdex has quit
      • kakulukia
        doismellburning: but ive never seen this before - right in the debugger its calling _prepare without args and stepping into the function call the cls arg is filled .. where does it come from?
      • doismellburning
        kakulukia: you've never written `def foo(self):`?
      • mucco joined the channel
      • kakulukia: the classes tutorial should explain it, I think
      • but it's effectively exposed syntactic sugar; `my_obj.foo(z)` -> `call myobj.foo with myobj and z`
      • Diemuzi has quit
      • veduardo has quit
      • bkxd joined the channel
      • NfNitLoop joined the channel
      • NfNitLoop
        I assume that running `manage.py migrate` simultaneously on the same DB is a bad idea. My coworker seems to think it's fine. Which of us is insane? :p
      • knbk
        NfNitLoop: you may run into issues, especially if your db doesn't support DDL in transactions
      • NfNitLoop
        Is there any sort of documentation about whether migrate has any sort of locking protecting it? I've been skimming https://docs.djangoproject.com/en/2.0/topics/mi... but didn't find anything explicit.
      • knbk: We're running Postgres, thankfully, but even then I really wouldn't want to rely on that because there could be application-level race conditions.
      • microdex joined the channel
      • doismellburning
        NfNitLoop: I wouldn't like to do it
      • knbk
        NfNitLoop: yeah, I wouldn't risk it either. There's no docs on locking because there is no locking
      • NfNitLoop
        (ex: 'migrate' reads the schema version simultaneously, N of them kick off ALTER TABLEs, one of them locks, the other one continues later and gets errors, etc.)
      • kakulukia
        doismellburning: i did use the self arg before, but this prepare method is called when the class iscalled into existence rather than being instanciated and thus it really gets called without self/cls but still in the django code cls is there
      • doismellburning
        NfNitLoop: we use Careful Deployment Optimism to ensure it doesn't happen
      • redir joined the channel
      • NfNitLoop
        doismellburning: What's that?
      • doismellburning
        NfNitLoop: Elastic Beanstalk config, and hoping that it works one at a time ;)
      • I suspect at greater scale we'll need something better but it works well enough for now
      • r29v joined the channel
      • rpkilby joined the channel
      • NfNitLoop
        The issue is that we're doing continuous delivery to a kubernetes cluster. We'd hacked in a `manage.py migrate` before starting up the Django server, which worked OK when we only had 1 web head. Now we have many.
      • microdex has quit
      • Kindof surprised at the lack of handling of this in the kubernetes/helm space. w/ all their talk of rolling deployments, it's like they think DB schemas never change. :p
      • hylje
        they use mongodb
      • NfNitLoop
        (afk: driving home) haha. Web scale! :p
      • ironfroggy joined the channel
      • negaduck_ joined the channel
      • negaduck has quit
      • doismellburning
        NfNitLoop: ah, nasty
      • NfNitLoop: we essentially migrate_and_run, but that's because EB offers a "one at a time, srs"
      • I suspect that isn't a _strong_ guarantee but it works well enough
      • I think you're going to need to implement now what I think we'll need to eventually
      • So, if you could like, open source that, it'd be neat cheers ;P
      • (you have a ZK cluster with k8s right? lock there, job done)
      • (with the right ZK magics)
      • ruid joined the channel
      • marc_v92 joined the channel
      • bkxd has quit
      • jadajada joined the channel
      • theology
        can i access the object a form creates inside the form_valid of a Generic Class (e.g. CreateThingView) ??
      • ?*
      • nazarewk has quit
      • microdex joined the channel
      • redir joined the channel
      • lobo_d_b has quit
      • fikka has quit
      • fikka joined the channel
      • Nizumzen joined the channel
      • mcspud
        doismellburning - we do a similar thing, but with EC2s. We stand up a full fleet of web servers, and then switch them all into the ASG's and ELB's at the same time, with the primary one running any pending migrations
      • We basically deploy "front to back", so any of the background tasks that are running may fail but will be picked up again in 12 hours, and the UX doesn't break
      • microdex has quit
      • gcbirzan
        Doing that with k8s is actually incredibly hard.
      • I mean, guaranteeing any kind of ordering of how things happen.
      • You can bring up your pods and run the migration, then switch the service, but that means monitoring the state of the pod you ran. And that brings me to how painful it is to have a one time job execute in k8s :P
      • doismellburning
        yeah, this is why I don't really trust our EB method
      • marc_v92 has quit
      • rpkilby has quit
      • XofP joined the channel
      • ironfroggy joined the channel
      • xliiv joined the channel
      • redir joined the channel
      • KeyJoo has quit
      • bkxd joined the channel
      • anarchean has quit
      • geekodour08 has quit
      • b0nn
        hrm, genuine question, what is the advantace of websocket over a rest api?
      • thallada joined the channel
      • miz- has quit
      • hylje
        websockets are bidirectional