django - Project platform suggestion for web application with proper User Auth and integration support -
So, I have an idea of creating a web app. I'm new to this business, but I'm a programmer I liked Python and I thought I should start with the Django. I ran into a problem with built-in Django users and systems
In short, I'm using DJJong's built-in user ath and I think it's easy to use in my user field (foreign Key), but it is not. I have spoken and asked questions but only got a very complex answer or I have to use the Admin section if I want something like that.
My simple requirement is that whenever the user saves anything in their profile, the user should have a population of the population so that I can refer to it. For me, it seems like the most basic requirement of any web app.
Am I wrong? I need feedback. If the degeneration is not good for this then I am ready to know any other good framework or platform if needed. In essence, I am using Janzo's built-in user ath and thought it would be easy.
Fill in my model my user field (foreigner), but it is not.
It will not be magically just you can do that the model is separated from the request, so it will be in your view, or a model method (perhaps MVC / MTV design separates database from visual / control logic I do not know what's the structure with it: Unless you write functionality to yourself, the database does not know that some user tables And what to do with currently logged in users (different from data). In general, the Python / Déjengo philosophy is: better than explicitly intricated. If you want to see this behavior in any way, you can potentially write: You can overwrite the method of saving on a model that also accepts alternate user logic. save < / Code>) that has been passed to the active user. Now the solution:
example = MyForm.save (commit = false) #commits = false DB prevents save. Example.user = request.user instance.save ()
def save (self, * args, ** kwargs): user = kwargs.pop (user, none) self.user = user super (MyModel, self). Save (* Args, ** kwargs) mymodel = MyModel () Mymodel.save (user = request.user)
Comments
Post a Comment