mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 09:12:11 +01:00 
			
		
		
		
	Added column deposit_type to MembershipsTable
This commit is contained in:
		@@ -4401,6 +4401,22 @@
 | 
			
		||||
    {
 | 
			
		||||
        "model": "permission.permission",
 | 
			
		||||
        "pk": 296,
 | 
			
		||||
        "fields": {
 | 
			
		||||
            "model": [
 | 
			
		||||
                "wei",
 | 
			
		||||
                "weimembership"
 | 
			
		||||
            ],
 | 
			
		||||
            "query": "{\"club__weiclub__year\": [\"today\", \"year\"]}",
 | 
			
		||||
            "type": "view",
 | 
			
		||||
            "mask": 2,
 | 
			
		||||
            "field": "",
 | 
			
		||||
            "permanent": false,
 | 
			
		||||
            "description": "Voir toutes les adhésions au WEI courant"
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "model": "permission.permission",
 | 
			
		||||
        "pk": 297,
 | 
			
		||||
        "fields": {
 | 
			
		||||
            "model": [
 | 
			
		||||
                "wei",
 | 
			
		||||
@@ -4509,7 +4525,7 @@
 | 
			
		||||
                160,
 | 
			
		||||
                212,
 | 
			
		||||
                222,
 | 
			
		||||
                296
 | 
			
		||||
                297
 | 
			
		||||
            ]
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
@@ -4698,7 +4714,8 @@
 | 
			
		||||
                178,
 | 
			
		||||
                183,
 | 
			
		||||
                294,
 | 
			
		||||
                295
 | 
			
		||||
                295,
 | 
			
		||||
                296
 | 
			
		||||
            ]
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -187,6 +187,35 @@ class WEIMembershipTable(tables.Table):
 | 
			
		||||
    def render_year(self, record):
 | 
			
		||||
        return str(record.user.profile.ens_year) + "A"
 | 
			
		||||
 | 
			
		||||
    def render_registration__deposit_type(self, record):
 | 
			
		||||
        if record.registration.first_year:
 | 
			
		||||
            return format_html("∅")
 | 
			
		||||
        if record.registration.deposit_type == 'check':
 | 
			
		||||
            # TODO Install Font Awesome 6 to acces more icons (and keep compaibility with current used v4)
 | 
			
		||||
            return format_html("""
 | 
			
		||||
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width="1.5em" height="1.5em"
 | 
			
		||||
        fill="currentColor" style="position: relative; left: -0.15em;">
 | 
			
		||||
            <path d="
 | 
			
		||||
                M128 128C92.7 128 64 156.7 64 192L64 448C64 483.3 92.7 512 128 512L512 512
 | 
			
		||||
                C547.3 512 576 483.3 576 448L576 192C576 156.7 547.3 128 512 128L128 128z
 | 
			
		||||
                M360 352L488 352C501.3 352 512 362.7 512 376C512 389.3 501.3 400 488 400L360 400
 | 
			
		||||
                C346.7 400 336 389.3 336 376C336 362.7 346.7 352 360 352z
 | 
			
		||||
                M336 264C336 250.7 346.7 240 360 240L488 240C501.3 240 512 250.7 512 264
 | 
			
		||||
                C512 277.3 501.3 288 488 288L360 288C346.7 288 336 277.3 336 264z
 | 
			
		||||
                M212 208C223 208 232 217 232 228L232 232L240 232C251 232 260 241 260 252
 | 
			
		||||
                C260 263 251 272 240 272L192.5 272C185.6 272 180 277.6 180 284.5
 | 
			
		||||
                C180 290.6 184.4 295.8 190.4 296.8L232.1 303.8C257.4 308 276 329.9 276 355.6
 | 
			
		||||
                C276 381.7 257 403.3 232 407.4L232 412.1C232 423.1 223 432.1 212 432.1
 | 
			
		||||
                C201 432.1 192 423.1 192 412.1L192 408.1L168 408.1C157 408.1 148 399.1 148 388.1
 | 
			
		||||
                C148 377.1 157 368.1 168 368.1L223.5 368.1C230.4 368.1 236 362.5 236 355.6
 | 
			
		||||
                C236 349.5 231.6 344.3 225.6 343.3L183.9 336.3C158.5 332 140 310.1 140 284.5
 | 
			
		||||
                C140 255.7 163.2 232.3 192 232L192 228C192 217 201 208 212 208z
 | 
			
		||||
            " />
 | 
			
		||||
        </svg>
 | 
			
		||||
    """)
 | 
			
		||||
        if record.registration.deposit_type == 'note':
 | 
			
		||||
            return format_html("<i class=\"fa fa-exchange\"></i>")
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        attrs = {
 | 
			
		||||
            'class': 'table table-condensed table-striped table-hover'
 | 
			
		||||
@@ -194,7 +223,7 @@ class WEIMembershipTable(tables.Table):
 | 
			
		||||
        model = WEIMembership
 | 
			
		||||
        template_name = 'django_tables2/bootstrap4.html'
 | 
			
		||||
        fields = ('user', 'user__last_name', 'user__first_name', 'registration__gender', 'user__profile__department',
 | 
			
		||||
                  'year', 'bus', 'team', 'registration__deposit_given', )
 | 
			
		||||
                  'year', 'bus', 'team', 'registration__deposit_given', 'registration__deposit_type')
 | 
			
		||||
        row_attrs = {
 | 
			
		||||
            'class': 'table-row',
 | 
			
		||||
            'id': lambda record: "row-" + str(record.pk),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user