django registration module with multiple registration forms - django-registration

I want to use 2 different forms for registering Seller and buyer using dhango registration module. Both forms will be different. I have created accounts/forms for both forms, but not sure how to invoke the different template for different user categories. In both the cases, it is invoking default registration_form.html.
here is my accounts/
class UserRegForm(RegistrationForm):
news_letter=forms.BooleanField(required=False, initial=True)
class SellerRegForm(RegistrationFormTermsOfService):
captcha = ReCaptchaField()


Django: Register models to admin site dynamically on request

I have some django models registered to my admin site by declaring them in my file. I however do not want specific internal users to be able to see certain tables. Is there a way to dynamically registered models to the admin site when a request is is received?
e.g something like if has a .gmail domain don't register the user's table.
from django.contrib.admin import AdminSite
admin_site = MyAdminSite()
for model_name, model in app.models.items():
model_admin = type(model_name + "Admin", (admin.ModelAdmin, ), {'list_display': tuple([ for field in model._meta.fields])}), model_admin)

Django admin - User and group extend

Iam trying to update my user model in Django's admin Panel.
I want to add a field/column in Admin panel named "Group" for Users. This field will have the option to select any value from the existing Groups (single option only/Dropdown).
I tried to search for the document but I couldnt found out the relevant information to manipulate the User Admin panel. Although I do found a few blogs and video where they have created a new app and extend the User model.
Is it possible to update Admin panel for User? Please suggest any document or blog or any approach to achieve the goal.
You will probably have to extend the user model in, and also to use Inlines to reflect the changes to the admin site. Both of these steps are performed by Julia in this video:
The documentation for Inlines can be found here.
So in your you can extend UserAdmin and in Permissions if you add groups it will create a group assignment to your user create form in admin.
class CustomUserAdmin(UserAdmin):
add_form = UserCreateForm
fieldsets = (
(None, {'fields': ('email')}),
('Permissions', {'fields': (('is_active', 'groups'), )}),

How can I protect the loopback explorer by username and password?

I've just started using loopback4 and I would like to protect the /explorer from being public. The user would initially see a page where username and password must be entered. If successful, the user is redirected to /explorer where he can see all API methods (and execute them). If user is not authenticated, accessing the path /explorer would give a response of "Unauthorized". Is there a way to easily implement this?
There is issue talking about a GLOBAL default strategy is enabled for all routes including explorer in
The way is to specify a global metadata through the options:
defaultMetadata: {
strategy: 'JWTStrategy'
registerAuthenticationStrategy(this, JWTAuthenticationStrategy)
But in terms of enabling a single endpoint added by route.get(), it's not supported yet, see code of how explorer is registered. #loopback/authentication retrieves auth strategy name from a controller class or its members, but if the route is not defined in the controller, it can only fall back to the default options, see implementation

How to access customer info on PDP page | SCA Kilamanjaro

Is there a way we can access customer info like, email and name on a product detail page and access as a variable (like a handlebar variable)?
You can use the Profile.Model and then get the instance of the profile model like ProfileModel.getInstance(). There you can get the Customers data.
The other way of doing that via backend is using the Commerce API customer. It is inside the Models.Init module.
These are the methods that is available under Customer API
emailCustomer(subject, body)
getAddress(addressid, fields)
getCreditCard(creditcardid, fields)

Accessing the user from a liferay portlet?

I'm attempting to develop a portlet for liferay.
How can I get access to the username and password (and other data liferay has) of the user that's currently logged in?
I'd also like to be able to execute some code when users change their password.
You can get the User ID by calling getRemoteUser() in the PortletRequest object. This is defined by JSR-168 therefore it's cross-portal compatible.
Once you have the ID you can fetch the additional informations by calling getUserById() (a Liferay specific service). This is something not covered by Portlet API specification, so it locks you to the Liferay.
Liferay Specific stuff, here is a code sample to be written in your Portlet Class to retrieve the User:
ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
User user = themeDisplay.getRealUser(); // it gives you the actual Logged in User
//you can also use
// User user = themeDisplay.getUser(); // this would fetch the User you are impersonating
long userId = user.getUserId();
String userName = user.getEmailAddress();
long userId = themeDisplay.getRealUserId(); // themeDisplay.getUserId();
User user = UserLocalServiceUtil.getUser(userId);
Impersonate User:
Liferay has a concept that admins (or persons with the correct set of permissions) can impersonate a particular user of the portal. Through this they can see how the portal looks to that user.
For executing the code when user change their passwords:
One approach would be to create a hook plugin and overriding the services by extending the UserLocalServiceWrapper class. Then checking for the password change and executing your code inside the your custom class.
Hope this helps.
Or you can just use javascript:
There are many nice to haves in the Liferay namespace, take a look at the not so well documented API:
Also, take a look at the web services available under localhost:8080/api/jsonws which you can invoke with a javascript call:
userId: 10199
function(obj) {
One simple and easy way to get the user in Liferay is PortalUtil.getUser function.
User user = PortalUtil.getUser(portletRequest);