dpgaspar / Flask-AppBuilder

Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/
BSD 3-Clause "New" or "Revised" License
4.71k stars 1.36k forks source link

in general: is it possible to remove firstname, lastname, username from the User entity ? #2267

Open AttaM1rza opened 3 months ago

AttaM1rza commented 3 months ago

I want to make the registration process easy as possible, by removing unesseccary information. I can add my own attributes like phone_number by creating a new class and inheriting from User, but the problem is:

>>> I dont need firstname, lastname and username... How can I change the User entity ?

I saw that these variables are used all over the codebase (for example in the login route, registration route, regsistrationUserModel, ...)

I thought of using a custom form and add_post(self, item) to overwrite the firstname, lastname, username, with the provided user email before persiting to the datasbase ... but is there a better (cleaner) way ?

Yoyasp commented 2 months ago

You could override the user_model variable in a custom security manager. However i doubt it is worth the effort, first and last name are optional i believe, so why not just let users enter it if they want to, but ignore in all your custom application code