I have dashboard for my users, and they'll differ based on the user type. Can I have both running under the same url, but be parsed by different views?
mattmcc
Sure, one view can behave differently based on request.user
Or it can serve as a simple dispatcher to other views.
jessamynsmith has quit
fikka has quit
RandomSerb
mattmcc: so, I need 3 views: one main, that will check a condition, and then call my_view_1(request) or my_view_1(request), and in those 2 views I'll have return render...?
zeus1 joined the channel
my_view_1(request) or my_view_2(request)
sh3iny joined the channel
mattmcc
That's how I'd do it.
ticketbot has quit
ticketbot joined the channel
RandomSerb
makes sense, thanks
jtiai joined the channel
mattmcc: also, what I don't understand about decorator redirect, like @login_required: it redirects anonymous user to login page, setting the `next` parameter to previous url, which is good. Now, how do I make user actually get to said next url after login, given I have custom login view?
mattmcc
If you're not using the default login view, then yes, you'd have to handle doing the redirect yourself.
Are you sure you can't replace your custom view with a LoginView subclass?
mattmcc: is the way I'm doing it now 'bad' in any way except that 'you should make it easier by utilizing already made loginview'?
mattmcc
Eh, I wouldn't say it's bad, but it puts a burden on you to keep up with changes to the default view.
Back before the login view was a CBV, there might've been an argument for going the fully custom route.
rjdp9736
has any one handled SaaS application with twilio integration? I am worried about the right way of doing billing/transactions for SaaS clients usage of Twilio resources i.e calling charges/ phone number purchases etc
I think there are pitfalls in implementing this and need some advice from someone who has worked on similar usecase
pathrocle joined the channel
take_flight joined the channel
fikka joined the channel
fikka has quit
RandomSerb
mattmcc: the problem is I don't understand how'd I subclass LoginView properly
k_sze[work] joined the channel
would I simply override get and post methods, or there's more to it?
tvm joined the channel
or, in my use-case, simply override only post method?
actually, only get method
fikka joined the channel
GinFuyou
RandomSerb, you want to redirect user on login?
RandomSerb
GinFuyou: I want to redirect user to next url when using @login_required
mattmcc said it's better to subclass LoginView than the way I'm doing it right now - https://dpaste.de/QBa7
GinFuyou
RandomSerb, yes but do get your "next" parameter?
RandomSerb
I could have simply used default loginview, but I need to change placeholders and class params on fields for my AuthenticationForm
GinFuyou: do I get it? yes
GinFuyou
As for LoginView you'll probably want to extend form_valid(), touching post() or get() usually not very clean
fikka has quit
RandomSerb
GinFuyou: only thing I need `custom` for my login is class html parameter to my fields.
rpkilby has quit
and placeholder
rpkilby joined the channel
xliiv joined the channel
mattmcc
There's a get_form method that handles instantiating the form object. So that'd be where you mess with field attributes.
mattmcc, I will tell you my scenario and stripe is not fiiting into my scenrio
fikka joined the channel
i have a SaaS app which has sort of call centre implemented via twilio , I want to manage billing for SaaS clients usage of Twilio resources i.e calling charges/ phone number purchases et
cjwelborn joined the channel
sms
FunkyBob: At least they threw that Lamborghini Diablo into the deal, I'm sure that's why you've been so inactive lately!
rjdp9736
mattmcc, I am using subaccounts feature in twilio to bifurcate each organisation's billing who have signed up for my app
do you reckon stripe to be fit for this usecase ?
FunkyBob
sms: yah... trying to offload it ASAP
mattmcc
I would assume the Twilio API allows you to query for usage data, which you could use to fill out a Stripe invoice for a given billing period.
fikka has quit
mitaka joined the channel
sms
FunkyBob: I'll take it off your hands for 15 kilos of soy (just make sure you don't let anybody know what soy is code for)
FunkyBob
sms: "soy" ... gotcha *taps side of nose knowingly*
RCStef joined the channel
take_flight joined the channel
duoi
i didnt realise django-nap was sold
its been legacy for a while and i know drf superseded it, but i thought it was just the maintainer not doing it, not because it was sold
thats nuts
but congrats to them i guess
sms
FunkyBob: Thanks, I'll have somebody over to pick it up and the soy should be in your PO box
mattmcc blinks.
mattmcc
This is a strange conversation.
FunkyBob
mattmcc: recently a couple of people somehow thought nap (a) preceded DRF, and (b) was dead.... I assume duoi and sms are just riffing on the joke
I know I am... nap is alive and well
nisstyre joined the channel
take_flight has quit
Disavowed joined the channel
wildlander has quit
fikka joined the channel
rpkilby has quit
cryptopian joined the channel
emihir0 joined the channel
k_sze[work] has quit
sms
FunkyBob: Oh what, I didn't realize it was a meme. There was a Buzzfeed publication about django-nap. That's when you know it's official!
rpkilby joined the channel
emihir0 has quit
emihir0 joined the channel
kezabelle joined the channel
emihir0 has quit
emihir0 joined the channel
k_sze[work] joined the channel
cryptopian has quit
azulakina has quit
jarshwah_ joined the channel
jarshwa__ joined the channel
elbarto_e has quit
phiofx joined the channel
jarshwah has quit
vdamewood joined the channel
jarshwah_ has quit
jarshwa__: That's a lot of underscores!
FunkyBob: How have you been lately? I heard you had a Pycon talk?
jarshwa__ has quit
schinckel
More than one...
sms
schinckel: Thank you for correcting me!
I didn't realize FunkyBob has ascended to a serial Pycon presenter
stevanr_ joined the channel
schinckel
(Well, one of them is _technically_ a DjangoConAU talk, but meh)