forked from erp-dev/erp
fix: printing job admin auto complete for product field
This commit is contained in:
@@ -368,6 +368,13 @@ class PrintingJobAdmin(admin.ModelAdmin):
|
|||||||
)
|
)
|
||||||
list_filter = ('created_at', 'printing_order__customer__name')
|
list_filter = ('created_at', 'printing_order__customer__name')
|
||||||
actions = ['advance_to_next_state_action', 'step_back_one_state_action', 'reset_progress_action']
|
actions = ['advance_to_next_state_action', 'step_back_one_state_action', 'reset_progress_action']
|
||||||
|
autocomplete_fields = (
|
||||||
|
'merchant',
|
||||||
|
'printing_order',
|
||||||
|
'product',
|
||||||
|
'business_object',
|
||||||
|
'created_by',
|
||||||
|
)
|
||||||
|
|
||||||
def save_model(self, request, obj, form, change):
|
def save_model(self, request, obj, form, change):
|
||||||
"""保存 PrintingJob 时使用 service 层"""
|
"""保存 PrintingJob 时使用 service 层"""
|
||||||
|
|||||||
@@ -69,3 +69,17 @@ class PrintingJobAdminSearchTestCase(TestCase):
|
|||||||
|
|
||||||
self.assertFalse(may_have_duplicates)
|
self.assertFalse(may_have_duplicates)
|
||||||
self.assertEqual(list(queryset), [self.job])
|
self.assertEqual(list(queryset), [self.job])
|
||||||
|
|
||||||
|
def test_printing_job_admin_uses_autocomplete_for_large_relations(self):
|
||||||
|
model_admin = printing_admin.PrintingJobAdmin(printing_models.PrintingJob, self.site)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
model_admin.autocomplete_fields,
|
||||||
|
(
|
||||||
|
'merchant',
|
||||||
|
'printing_order',
|
||||||
|
'product',
|
||||||
|
'business_object',
|
||||||
|
'created_by',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user