Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the new registration invitation code function of MrDocv0.2.10

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

MrDocv0.2.10 new registration invitation code function how to use, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Unwittingly, the update of MrDoc has gone through more than a dozen versions. Although updates are not frequent, each update has new features or optimizations in the user experience. In this update of v0.2.10, Mr. zmister.com of the state added the function of registration invitation code for MrDoc. Registration invitation code function, in some minority or industry nature of the use of websites or more, mainly used to limit and control registered users. In the previous version, MrDoc only enables or closes registration throughout the site, and some partners do not want to add users manually, but also have the need to be open to some people, so the registration invitation code function is here.

First, turn on the registration invitation code function

In the "site Management" of the background management interface, we can turn on the function of registering the invitation code (this function is turned off by default). And it should be noted that if the "disable Registration" option is enabled, the setting of the "enable Registration Code" option is invalid, and the [disable Registration] priority is higher than [enable Registration Code].

When enabled, the form of the registration page will have an extra input box of "Registration Code", as shown in the following figure:

Manage the registration invitation code

After enabling the registration invitation code function, we need to create a registration invitation code, which is also done on the background management page.

Click this link and there will be a page dedicated to managing the registration invitation code:

Click the "add Registration Code" button in the upper left corner, and an information box will pop up for us to add a registration code:

The default maximum number of use of the registration code is 1. If you need to set something else, you can enter it yourself. The registration invitation code is randomly generated in the background and does not need to be filled in by yourself. Once created, the registration code can be used when new users register. For each successful registration of a user, the number of times the registration code has been used will add up to 1. If the number of times the registration code has been used is equal to the maximum number of times the registration code has been used, then the status of the registration code will become invalid. Using this registration code when the user registers at this time will prompt "the registration code is invalid". At the same time, we can click the "Delete" button at the end of the registration code entry to delete the registration code. The control of the function of the registration code is relatively simple, so the interactive operation is relatively less, the above is the full introduction of the use of the registration code function. Let's introduce its internal structure. III. Model structure

The model structure of the registration code is very simple. There are seven fields in the model table, which are:

Registration invitation code

Valid registration quantity

Quantity used

Registration code status

Users who use this registration code

Creator

Creation time

It is defined in the Django ORM model as follows: these fields are basically sufficient for the current scenario, and if other requirements and situations arise later, we will see how to design and extend them.

Fourth, the principle of registration code generation

Finally, let's introduce the generation of registration code. As mentioned earlier, the registration code is automatically generated in the background. Its principle is mainly as follows:

Define a string combination of numbers, uppercase letters, and lowercase letters

Use the choices () method of the random library to randomly get 10 single characters to form a string

Query in the database for its existence, if so, continue to generate one and query, and if not, select it.

The core code is shown in the following figure: after reading the above, have you mastered how to use the new registration invitation code function of MrDocv0.2.10? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report