wow "These format characters are not used in Django outside of templates. They were designed to be compatible with PHP to ease transitioning for designers."
Watabou joined the channel
jaagr
BlueOrg: Just write the user signup package stand-alone and use it in both of your applications.
shinobi_one: lol, what characters? <?php ?
hillaj joined the channel
BlueOrg
jaagr so I'm going to have 2 databases with their own Users? so a User in app1 can't use the same credentials to log into app2?
waverider
BlueOrg, yes, sounds like what you want
jaagr
BlueOrg: well, depends on how you design the authentication... you can use the same database, even the same table if you'd like
simp
when using an abstract base class for a child model, do i need to do anything else then the usual field describing for django to generate SQL?
shinobi_one
jaagr: ... the template builtin "date" uses PHP style format characters instead of python strftime strptime :O
waverider
jaagr, why make things complicated :)
jaagr
waverider: when did I make things complicated?
simp
or do i need to write the SQL by hand, because manage.py sql 'appname' isn't giving any output for this child model
BlueOrg
I was wanting to unify the log in process in the first place. If User logs in app1 he should be able to log into app2 also with the same credentials. I wanted to know how I can share the credentials.
jaagr
waverider: thought I explained it well =)
BlueOrg
jaagr, waverider :)
waverider
basic auth with 2 dbs works excellent. No need for "custom backend" ?!
jaagr
BlueOrg: Then you would use the exact same auth. system
[diecast] has quit
garet has quit
gabrielo_ joined the channel
waverider
BlueOrg, for me it becomes less clear what you want. But sounds like you should read about authorization as well (not only authentication). You can have one authentication system and db for all users and provide differen permissions on apps (or url, object, etc.)
BlueOrg
jaagr okay. so i wouldn't need to make any modifications to the auth system, is it? So if a user is created in app1 and is stored in app1.db when he hits app2's url and tries some CRUD operation there he would still be authenticated with credentials from app1.db? It seems a little mysterious to me.
bkeating_ has quit
[diecast] joined the channel
waverider ^^ is that a little more clearer? Thank you, i'm still picking up django at work.
BlueOrg, google django multiple databases (this is no big deal these days) and also look at authorization
jaagr
he won't need multiple databases for it
he explicitly said he want's the same users for both apps
ustunozgur joined the channel
waverider
jaagr, just re-read his messages and he said he will need to update stuff in multiple dbs (as business logic)
yes, i mean for other stuff
jaagr
waverider: regarding auth?
waverider
" Hello, I'm writing a website using django. In my project structure I have multiple apps. All do some kind of CRUD operations in multiple databases."
jaagr
doesn't matter, does it? he still wants his auth to be shared
BlueOrg
jaagr "So if a user is created in app1 and is stored in app1.db when he hits app2's url and tries some CRUD operation there he would still be authenticated with credentials from app1.db? It seems a little mysterious to me."
waverider
So BlueOrg: one db for authentication, you write some authorization logic for your different apps (you can even implement some sort of "sign up for app2 as well", that's your custom logic)
jaagr, multiple db-s is not related to auth
jaagr
waverider: in this case, it's related to authentication
snurfery joined the channel
waverider
I was answering another part of his initial question, this part: "All do some kind of CRUD operations in multiple databases."
for auth, yes a single db
jaagr
BlueOrg: don't tie the authentication to a specific app. If the apps are shared, use a shared part.. the authorization could be explicit for the apps in say
radimnov has quit
BlueOrg
jaagr there are some operations in each app that would require a user to log in, i didn't want to create a hassle by asking them to sign up for app1 and app2 separately. if a user signs in through one app then it should also be valid in the other app. that was the gist. :)
jaagr okay.
foist joined the channel
any specific concepts/packages i could google for? thank you. :)
foist
Anyone use Django Rest Framework? I could use a little help with permissions.
waverider
django authentication, django authorization
garet joined the channel
hackedhead has left the channel
ustunozgur has quit
they are in django core
jaagr
BlueOrg: Yeah, that's why you would use a shared storage for authentication.. But the authorization for the two apps would be separate.
waverider
separate like in two dbs?
BlueOrg
jaagr hm, how would that happen?
jaagr
waverider: as in divided into app1/app2
mihow joined the channel
ustunozgur joined the channel
tbaxter_
I'm confused. Are we talking about different apps, or different projects?
jaagr
BlueOrg: ok, lets say you have a table with users.
BlueOrg
jaagr okay...
jaagr
BlueOrg: all registered users go into that table with authentication information.. then you have a table with permissions.. some permissions are for app1, and some for app2.. users belonging to only app1 only get those permissions.. and vice versa..
BlueOrg: just read the django auth docs
cppCzar joined the channel
BlueOrg
jaagr aah. okay. so if i authenticate them in the beginning before they go to either domain.com/app1/ or domain.com/app2 and store that info and have a table for permissions for both app1 and app2 that should effectively solve the problem, right?
klaut has quit
jaagr okay. will do! Thank you! :)
honestemu has quit
jaagr
BlueOrg: Yes.
BlueOrg
thank you and waverider for patiently walking me through this! :)
jaagr
BlueOrg: Since they are are on the same domain, you don't have to worry about anything else than the session
ustunozgur has quit
waverider
BlueOrg, no problem. The most important part is that one usualy clears things in his head first of all :).
jaagr
And that often happens after talking about it for a while =)
jaagr is referring to himself.
waverider
jaagr, that's what it usually happens to me!
by the time I finish the question with the whole context, I usually know the answer :D
jaagr
hehe yeah
HowardwLo joined the channel
simp
here's a short model called TemperatureDaemon, for some reason django isn't generating SQL for the model, anyone happen to have any clues to why that could be? https://dpaste.de/KxFx
it uses an abstract base class
sorry for asking the question again, it's formed a bit better this time :)
jaagr
Any good coding tunes to recommend? Use Your Illusion 1/2 is getting old!
[diecast] has quit
simp: it's not generating anything at all?
waverider
simp, I am not 100% sure if that first string param does the right thing for all field types, you migh want to check that
simp
it generates the sql needed for other models, but not this one
jaagr
simp: Where is the TemperatureDaemon getting the `model` from?
`models`*
simp
another app, and it's imported in top
hutchison has quit
BlueOrg
jaagr just a small clarification. in the models.py files of my apps i know more need to define a User model right if i'm handling the auth in another app that the user encounters when he hits the / url? I could directly use login_required() in my apps after providing the nesscarry permissions for the apps?
simp
the server daemon validates the code and finds no errors
nicholasserra has quit
waverider
simp, why would you want to have in the same class (via inheritance) linux daemon code and database model code anyway? Makes no sense. Just instatiate a model object (=db row) in the daemon where you need it.
two different things should be in two different classes
robbyoconnor joined the channel
*very different
jaagr
BlueOrg: Make a new app called user/auth/whatever...
BlueOrg: Then just require login for the views that requires authentication
nicholasserra joined the channel
simp
waverider: to have different daemons that can be started and stopped separately
basti-mbp has quit
BlueOrg
jaagr okay. thanks!
jaagr
BlueOrg: Don't tie the authentication/authorization to a specific app. Since it will be shared between the two
waverider
simp, and you want a db row per daemon? You need to reference that db row via a plain variable.
basti-mbp joined the channel
basti-mbp has quit
BlueOrg, do you have a reason to not use the default django.contrib.auth.models.User and need to write your own user class?
LucSaffre has quit
simp
waverider: that's exactly what i want. so i need to create another model that takes the info from TemperatureDaemon and then writes it to the DB?
while moving the temperatureDaemon somewhere else ofcourse
waverider
hmm, simp, models provide exactly that: write data to db. Have you followed the django tutorials? :)
meilinger joined the channel
ustunozgur joined the channel
BlueOrg
waverider yes, i have some other fields i need to add to my User model apart from the ones specified by django.contrib.auth.models.User class.
waverider
BlueOrg, that is commonly done through django user profile (google that)
which is just another custom table linked to the user
hmm, one sec, this way might be obsolete, let me check
simp
waverider: yes i have, but it's the first daemon i'm writing for it, all the other stuff has been reading probes. i'm quite new to django so it's good to get some feedback for the code every now and then :)
jaagr
BlueOrg: Write a Profile class and use a ProxyUser