Skip to content

Commit 32779c3

Browse files
Merge pull request #28 from usermicrodevices/develop
fix list display
2 parents e5b23bf + 9e6a636 commit 32779c3

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

core/admin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class CustomModelAdmin(CoreBaseAdmin, admin.ModelAdmin):
248248

249249

250250
class RecordAdmin(CustomModelAdmin):
251-
list_display = ('id', 'get_doc', 'get_product', 'get_cost', 'get_price', 'get_count', 'get_sum_cost', 'get_sum_price', 'extinfo')
251+
list_display = ('id', 'get_doc', 'product', 'get_cost', 'get_price', 'get_count', 'get_sum_cost', 'get_sum_price', 'extinfo')
252252
list_display_links = ('id',)
253253
search_fields = ('id', 'doc__owner__name', 'doc__contractor__name', 'doc__type__name', 'doc__tax__name', 'doc__sale_point__name', 'doc__author__username', 'extinfo')
254254
list_select_related = ('product', 'doc')
@@ -260,9 +260,9 @@ def get_doc(self, obj):
260260
return format_html('<a href="{}/core/doc/?id={}" target="_blank">[{}] {} {}</a>', settings.ADMIN_PATH_PREFIX, obj.doc.id, obj.doc.id, obj.doc.type.name, obj.doc.registered_at.strftime('%Y-%m-%d %H:%M'))
261261
get_doc.short_description = _('document')
262262

263-
def get_product(self, obj):
263+
def product(self, obj):
264264
return format_html('<a href="{}/refs/product/?id={}" target="_blank">{}</a>', settings.ADMIN_PATH_PREFIX, obj.product.id, obj.product.name)
265-
get_product.short_description = _('product')
265+
product.short_description = _('product')
266266

267267
def get_count(self, obj):
268268
color = 'green' if obj.doc.type.income==True else 'red'
@@ -292,16 +292,16 @@ def get_sum_price(self, obj):
292292

293293

294294
class RegisterAdmin(CustomModelAdmin):
295-
list_display = ('id', 'get_rec', 'get_doc', 'get_product', 'get_cost', 'get_price', 'get_count', 'get_sum_cost', 'get_sum_price')
295+
list_display = ('id', 'rec', 'get_doc', 'get_product', 'get_cost', 'get_price', 'get_count', 'get_sum_cost', 'get_sum_price')
296296
list_display_links = ('id',)
297297
search_fields = ('id', 'rec__doc__owner__name', 'rec__doc__contractor__name', 'rec__doc__type__name')
298298
list_filter = (ProductRecordFilter, DocRecordFilter, 'rec__doc__type')
299299
list_editable = ['rec']
300300
autocomplete_fields = ['rec']
301301

302-
def get_rec(self, obj):
302+
def rec(self, obj):
303303
return format_html('<a href="{}/core/record/?id={}" target="_blank">R{}</a>', settings.ADMIN_PATH_PREFIX, obj.rec.id, obj.rec.id)
304-
get_rec.short_description = _('record')
304+
rec.short_description = _('record')
305305

306306
def get_doc(self, obj):
307307
return format_html('<a href="{}/core/doc/?id={}" target="_blank">[{}] {} {}</a>', settings.ADMIN_PATH_PREFIX, obj.rec.doc.id, obj.rec.doc.id, obj.rec.doc.type.name, obj.rec.doc.registered_at.strftime('%Y-%m-%d %H:%M'))

0 commit comments

Comments
 (0)