|
| 1 | +# ############################################################################## |
| 2 | +# |
| 3 | +# OSIS stands for Open Student Information System. It's an application |
| 4 | +# designed to manage the core business of higher education institutions, |
| 5 | +# such as universities, faculties, institutes and professional schools. |
| 6 | +# The core business involves the administration of students, teachers, |
| 7 | +# courses, programs and so on. |
| 8 | +# |
| 9 | +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) |
| 10 | +# |
| 11 | +# This program is free software: you can redistribute it and/or modify |
| 12 | +# it under the terms of the GNU General Public License as published by |
| 13 | +# the Free Software Foundation, either version 3 of the License, or |
| 14 | +# (at your option) any later version. |
| 15 | +# |
| 16 | +# This program is distributed in the hope that it will be useful, |
| 17 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | +# GNU General Public License for more details. |
| 20 | +# |
| 21 | +# A copy of this license - GNU General Public License - is available |
| 22 | +# at the root of the source code of this program. If not, |
| 23 | +# see http://www.gnu.org/licenses/. |
| 24 | +# |
| 25 | +# ############################################################################## |
| 26 | +from osis_document.contrib import FileField |
| 27 | + |
| 28 | + |
| 29 | +class FileFieldModelMixin: |
| 30 | + """ |
| 31 | + A mixin that provides a property to get all FileField field names of a model. |
| 32 | + """ |
| 33 | + @property |
| 34 | + def document_fields(self): |
| 35 | + return [ |
| 36 | + field.name for field in self._meta.get_fields() |
| 37 | + if isinstance(field, FileField) |
| 38 | + ] |
0 commit comments