mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
Forms initial data (#6365)
* Use PATCH for edit form * Add "localhost:8000" server option * Add initialData property for forms - Allows user to specify an initial dataset to override default values * Override field values when constructing form props * Remove debug messages * Wrap ApiForm in FormProvider - Allows lower elements to access all form data without rebuild - Pass all form data through to adjustFilters routine * Fixes for RelatedModelField - Ensure that the saved data are cleared when filters change * Fix debug message for token creation * Fix address rendering for modals * Refactor "address" forms - Use new "hook" form structure * Update Contacts table * Prevent related model fields from fetching on initial form open - Only fetch when the drop-down is actually opened - Significantly reduces the number of API calls * Fix for ChoiceField - Display label / description / placeholder text * Fix for DateInput - Correct conversion of datatype * Implement "new purchase order" form - Uses modal form hook - Supply initial data - Adjust filters according to selected company * Add new company from company table * Edit company from detail page * More table updates - StockLocation - PartCategory * Update more tables / forms: - PartParameter table - PartParameterTemplate table - Cleanup unused imports * Update ProjectCode table * CustomUnits table * Update RelatedPart table * Update PartTestTemplate table * Cleanup PartParameterTable * Add "IPN" column to PartParameterTable * Update BuildOrder table * Update BuildDetail page * PurchaseOrderLineItem table * Simplify - Move fields which are only used in one location * Create new salesorder with context - Also consolidate translated strings - Also improve consistency of inline rendering (with missing image) * Revert change to RenderInlineModel * Fix for build table - Use apiUrl wrapper around ApiEndpoint * Fix parameter for PurchaseOrderTable * Adjust server selector - Only show localhost:8000 if in dev mode * Tweak URL * Add extra test to playground - Check initial value works for nested field * Cleanup playground * Cleanup unused vars * memoize fields * Fix typo host -> host * Fix part editing * Cleanup unused * update group table
This commit is contained in:
@ -253,6 +253,12 @@ class GetAuthToken(APIView):
|
||||
# User is authenticated, and requesting a token against the provided name.
|
||||
token = ApiToken.objects.create(user=request.user, name=name)
|
||||
|
||||
logger.info(
|
||||
"Created new API token for user '%s' (name='%s')",
|
||||
user.username,
|
||||
name,
|
||||
)
|
||||
|
||||
# Add some metadata about the request
|
||||
token.set_metadata('user_agent', request.META.get('HTTP_USER_AGENT', ''))
|
||||
token.set_metadata('remote_addr', request.META.get('REMOTE_ADDR', ''))
|
||||
@ -263,10 +269,6 @@ class GetAuthToken(APIView):
|
||||
|
||||
data = {'token': token.key, 'name': token.name, 'expiry': token.expiry}
|
||||
|
||||
logger.info(
|
||||
"Created new API token for user '%s' (name='%s')", user.username, name
|
||||
)
|
||||
|
||||
# Ensure that the users session is logged in (PUI -> CUI login)
|
||||
if not get_user(request).is_authenticated:
|
||||
login(request, user)
|
||||
|
Reference in New Issue
Block a user