#django

/

      • sbasso joined the channel
      • bradfordli123 joined the channel
      • exaroth joined the channel
      • OskrGrme has quit
      • bradfordli123 has quit
      • sbasso has quit
      • hamdjan has quit
      • mcspud
        (y)
      • Slack has gotten me so used to emojis
      • :\
      • FunkyBob
        haha
      • hamdjan joined the channel
      • b0nn
        what's the (y) emoji? on IRC it looks like genitalia
      • amcorreia
        thumbs up
      • FunkyBob
        orly?
      • b0nn
        ;+1; ?
      • oh, I mean :+1: is thumbs up for me on slack
      • DrCuriosity
        I'd like to have a +1 emoji on for reactions on Slack/Discord that's actually a "+1".
      • :heavy_plus_sign: kinda works, though.
      • b0nn
        back in my day we just responded with 'lol'
      • titodrew joined the channel
      • regardless of the meaning or intetn :)
      • intent
      • amcorreia
        now people prefer to be sarcastic
      • DrCuriosity
        Maybe it's hanging around goths too long, but I've always preferred "heh" to "lol".
      • RandomSerb
        Hello. In django admin, I have foreign keys like so C>B>A. Now, A will have multiple Bs, and some of them will have the same title, so, I'm wondering, to avoid confusion in Admin, how to prepend A's title to B's, so that object in B can be named A MyTitle
      • FunkyBob
        def __str__(self): return '{} {}'.format(self.a, self.title)
      • RandomSerb
        FunkyBob: and I put that in meta verbose_name? or in model class?
      • FunkyBob
        model class
      • adwin_ joined the channel
      • RandomSerb
        works like a charm, as always. Thanks!
      • FunkyBob
        np
      • RandomSerb
        FunkyBob: one question though: have you ever provided someone with long answer, wrong one, or with anything that's obsolete/redundant ? :)
      • just askin'
      • FunkyBob
        yep
      • to all cases
      • I am, after all, human.
      • RandomSerb
        I don't trust you. Anyhow, your answer to my question: if I apply it to C in my usecase, and B, I actually get A - B - C obj :)
      • which is soooo nice :)
      • the_rat joined the channel
      • limbera joined the channel
      • FunkyBob
        beware of the extra DB hits it may cause for the related objects
      • phenicie has quit
      • DrCuriosity
        Would that be something that you can cascade down in the models' save methods, to avoid the later DB hit?
      • the_rat has quit
      • FunkyBob
        select_related and prefetch_related can help
      • RandomSerb
        FunkyBob: but that's admin panel, most likely only one user. Also, that's related to branches, so not a lot of changes there.
      • so I don't really care much about that.
      • minot joined the channel
      • dodobrain has quit
      • orf_ has quit
      • re1 has quit
      • hilltop_ joined the channel
      • hilltop_
        Hi all. Looking at speeding up my app's DB performance. I'm thinking about having a separate database for each school served by the app. Where should I look for info on that/is that a good idea? I'd need to programmatically create new DB as new schools sign up.
      • sol1x has quit
      • JSharpe has quit
      • hamdjan has quit
      • SecondForm_Glenn has quit
      • adwin_ has quit
      • netheranthem has quit
      • exaroth joined the channel
      • hamdjan joined the channel
      • ss942 has quit
      • chowmeined joined the channel
      • limbera has quit
      • limbera joined the channel
      • eb0t joined the channel
      • Lobstaman3 joined the channel
      • Seaninho joined the channel
      • mcspud
        hilltop_ whats the actual problem
      • miz- has quit
      • RandomSerb
        when I do something like User.objects.create_user, it just prepares the query or it actually executes it?
      • amcorreia
        I think you should read about lazy evaluation
      • RandomSerb
        I have a Store model, that has OneToOne on User model. What I'm trying to do now is to create a form that will create both User and Store objects
      • FunkyBob
        to my blog!
      • limbera
        ol mate tin brain
      • FunkyBob
        every time I see it, I remember all the yaks in line for me to update/upgrade it...
      • restyle, want to do in scss, which will require kopytka, which will require python3, as well as a file manager...
      • which means either finishing django-filem, or doing a vue.js rewrite of it
      • and, as always, nobody is interested in helping with that :(
      • hilltop_
        @mcspud I'm not sure how to create a new DB for each school (or to access it), but alos not sure if this is legitimately a good plan to improve performance (to not have to query through so many records)
      • sbasso joined the channel
      • mcspud
        FunkyBob - I'll do the frontend
      • But I'm using RxJS for everything
      • OskrGrme joined the channel
      • sbasso has quit
      • FunkyBob
        hrm
      • RandomSerb
        FunkyBob: what isn't explained in this post is how do I get to connect those 2
      • as in, I'd need to register a new user, then use its ID to use in Store object
      • FunkyBob
        user = user_form.save() ; profile = profile_form.save(commit=False); profile.user = user; profile.save()
      • as you see on the form.save docs
      • RandomSerb
        FunkyBob: but I only have one form actually on that page
      • FunkyBob
        RandomSerb: as I try to explain in the blog post... one HTML <form> can be processed by multiple Django Form classes
      • redaudit has quit
      • in fact, I make that point at the start and the end...
      • souravbadami has quit
      • makes me wonder if you read the post, or just the code?
      • souravbadami joined the channel
      • cramm has quit
      • mcspud: I think vue.js would be an excellent fit for this case... but you're welcome to try your approach
      • mcspud
        VueJS is just the rendering, all of the async stuff needs to be driven by something
      • :D
      • (I highly, highly recommend rxjs)
      • Info-Screen has quit
      • OskrGrme has quit
      • FunkyBob
        mcspud: give it a shot... the repo's right there on github :)
      • cramm joined the channel
      • Info-Screen joined the channel
      • dodobrain joined the channel
      • nunchuck has quit
      • eperzhand has quit
      • Lobstaman3 has quit
      • RandomSerb
        FunkyBob: just the code, my bad. So, basically, I need to use pure html form, use hidden fields for user and try to match up those in forms.py?
      • FunkyBob
        wtf???
      • gugah has quit
      • you need to use a <form> like you always had
      • no idea why you're talking about hidden fields...
      • RandomSerb
        FunkyBob: well, I use only one form now, the registration form
      • and I use it in for loop in template tag
      • {%for field in data.form %}
      • limbera has quit
      • exaroth joined the channel
      • FunkyBob
        that's fine
      • RandomSerb
        FunkyBob: but, for instance, store doesn't have username field. Is there a way to map that somehow?
      • given it's required field for user model
      • FunkyBob
        map what?
      • each form will ONLY look at inputs it knows
      • OskrGrme joined the channel
      • RandomSerb
        FunkyBob: so I need to create userform with only one field, username
      • but how would I populate that?
      • belmoussaoui joined the channel
      • or I'm missing something here
      • FunkyBob
        wait, what?
      • I thought you were trying to create User and Shop in one step?
      • RandomSerb
        FunkyBob: yes I am
      • but you say to get that use 2 forms. I don't currently have form for user creation written in forms.py
      • FunkyBob
        so?
      • you have it somewhere, yes?
      • mucco has quit
      • RandomSerb
        FunkyBob: nope
      • FunkyBob
        not even from django.contrib.auth.forms ?
      • RandomSerb
        FunkyBob: well, I presume there is one there by default
      • FunkyBob
        there is
      • I'm confused about what you find confusing in this process
      • you need one Form class for each Model
      • RandomSerb
        FunkyBob: so now, if I say user_form = UserForm(request.POST, instance=request.user)
      • what will happen?
      • gugah joined the channel