استخدام pandora client/Creating custom fields and filters

من ويكي أضِف
اذهب إلى التنقل اذهب إلى البحث

Adding New Fields

To add new fields to pandora item, you have to add their definition code to the file yourSitename.jsonc that exists in the path pandora/pandora.

Field like event, year, month and day could be created by adding their code to item keys. Search about --> "itemKeys": [ and add the fields after any field inside this array like that:

        {
            "id": "event",
            "title": "Event",
            "type": "text" 
        },
        {
            "id": "year",
            "title": "Year", 
            "type": "year",
            "additionalSort": [{"key": "director", "operator": "+"}, {"key": "title", "operator": "+"}],
            "autocomplete": true,
            "columnWidth": 60,
           "filter": true
        },
        {
            "id": "month",
            "title": "Month",
            "type": "text"        
         },

Adding New Filters

To add new filters that to pandora user interface that help users in searching, add your custom filters to the same file that is used in adding fields. Search about --> "filters": [ and add your new filter line of code after any existing filter in the order you want like that:


                {"id": "event", "sort": [{"key": "items", "operator": "-"}]},  
                {"id": "year", "sort": [{"key": "name", "operator": "-"}]},               
                {"id": "month", "sort": [{"key": "items", "operator": "-"}]}

You can modify these custom fields or any existing fields by editing them. To remove fields, just remove their code from this configuration file.


تحديث الواجهة وعلاقتها بملفات

  • عند التعديل على الخانات، قد نرغب بتحديث ملف infoView المكتوب ب جافا سكربت من أجل المزيد من التحكم، يمكن إيجاد هذه الملفات في /srv/pandora/static/js حيث يكون إسم الملف infoView.SITE_ID.js وتعديلها، بعدها ربما يجب تشغيل ./manage.py update_static