File tree Expand file tree Collapse file tree 3 files changed +21
-48
lines changed
Expand file tree Collapse file tree 3 files changed +21
-48
lines changed Original file line number Diff line number Diff line change 1- Experimenting with using a dockerized Piccolo Admin with an existing (legacy) database.
1+ Dockerized Piccolo Admin to use existing (legacy) database.
22
33### Usage
44
@@ -41,12 +41,12 @@ tables:
4141 # An example of additional Piccolo Admin configuration
4242 Actor :
4343 visible_columns :
44- - actor_id
4544 - first_name
4645 visible_filters :
4746 - actor_id
4847 - first_name
4948 menu_group : Movies
49+ link_column : first_name
5050 Address :
5151 visible_columns :
5252 - address_id
@@ -57,6 +57,7 @@ tables:
5757 - address
5858 - city_id
5959 menu_group : Location
60+ rich_text_columns : address
6061 City :
6162 visible_columns :
6263 - city_id
@@ -73,6 +74,10 @@ tables:
7374 - country_id
7475 - country
7576 menu_group : Location
77+
78+ sidebar_links :
79+ Piccolo Admin : https://piccolo-admin.readthedocs.io/en/latest/index.html
80+ Piccolo ORM : https://piccolo-orm.readthedocs.io/en/latest/index.html
7681` ` `
7782
7883For these changes to take effect, you must stop the container and rebuild it with.
Original file line number Diff line number Diff line change @@ -119,12 +119,17 @@ async def main():
119119 except TypeError :
120120 rich_text_columns = None
121121 # link column
122- link_column = [
123- column
124- for column in table ._meta .columns
125- if column ._meta .name
126- == BASE_CONFIG [capitalize_table_name ].get ("link_column" , None )
127- ]
122+ try :
123+ link_column = [
124+ column
125+ for column in table ._meta .columns
126+ if column ._meta .name
127+ == BASE_CONFIG [capitalize_table_name ].get (
128+ "link_column" , None
129+ )
130+ ][0 ]
131+ except IndexError :
132+ link_column = None
128133 # menu_group
129134 menu_group = BASE_CONFIG [capitalize_table_name ].get (
130135 "menu_group" , None
@@ -136,7 +141,7 @@ async def main():
136141 visible_columns = visible_columns ,
137142 visible_filters = visible_filters ,
138143 rich_text_columns = rich_text_columns ,
139- link_column = None if link_column == [] else link_column [ 0 ] ,
144+ link_column = link_column ,
140145 menu_group = menu_group ,
141146 )
142147 )
Original file line number Diff line number Diff line change 11tables :
2- # An example of additional Piccolo Admin configuration
3- # Actor:
4- # visible_columns:
5- # - actor_id
6- # - first_name
7- # visible_filters:
8- # - actor_id
9- # - first_name
10- # menu_group: Movies
11- # link_column: first_name
12- # Address:
13- # visible_columns:
14- # - address_id
15- # - address
16- # - city_id
17- # visible_filters:
18- # - address_id
19- # - address
20- # - city_id
21- # menu_group: Location
22- # rich_text_columns: address # it only works in the Text type column
23- # City:
24- # visible_columns:
25- # - city_id
26- # - city
27- # visible_filters:
28- # - city_id
29- # - city
30- # menu_group: Location
31- # Country:
32- # visible_columns:
33- # - country_id
34- # - country
35- # visible_filters:
36- # - country_id
37- # - country
38-
2+ # Additional tables configurations go here
393sidebar_links :
40- # Piccolo Admin: https://piccolo-admin.readthedocs.io/en/latest/index.html
41- # Piccolo ORM: https://piccolo-orm.readthedocs.io/en/latest/index.html
4+ # External links go here
You can’t perform that action at this time.
0 commit comments