#86 Revocation rendering if needed
* renders revocation warning on the index view if a revocation exists
This commit is contained in:
		
							parent
							
								
									23c04c8883
								
							
						
					
					
						commit
						5e79f16e1e
					
				@ -84,14 +84,17 @@ class InterventionTable(BaseTable, TableRenderMixin):
 | 
			
		||||
        Returns:
 | 
			
		||||
 | 
			
		||||
        """
 | 
			
		||||
        html = ""
 | 
			
		||||
        html += self.render_link(
 | 
			
		||||
            tooltip=_("Open {}").format(_("Intervention")),
 | 
			
		||||
            href=reverse("intervention:detail", args=(record.id,)),
 | 
			
		||||
            txt=value,
 | 
			
		||||
            new_tab=False,
 | 
			
		||||
        context = {
 | 
			
		||||
            "tooltip": _("Open {}").format(_("Intervention")),
 | 
			
		||||
            "content": value,
 | 
			
		||||
            "url": reverse("intervention:detail", args=(record.id,)),
 | 
			
		||||
            "has_revocations": record.legal.revocations.exists()
 | 
			
		||||
        }
 | 
			
		||||
        html = render_to_string(
 | 
			
		||||
            "table/revocation_warning_col.html",
 | 
			
		||||
            context
 | 
			
		||||
        )
 | 
			
		||||
        return format_html(html)
 | 
			
		||||
        return html
 | 
			
		||||
 | 
			
		||||
    def render_c(self, value, record: Intervention):
 | 
			
		||||
        """ Renders the checked column for an intervention
 | 
			
		||||
@ -127,7 +130,7 @@ class InterventionTable(BaseTable, TableRenderMixin):
 | 
			
		||||
        Returns:
 | 
			
		||||
 | 
			
		||||
        """
 | 
			
		||||
        parcels = value.parcels.all().values_list(
 | 
			
		||||
        parcels = value.parcels.values_list(
 | 
			
		||||
            "gmrkng",
 | 
			
		||||
            flat=True
 | 
			
		||||
        ).distinct()
 | 
			
		||||
@ -139,7 +142,6 @@ class InterventionTable(BaseTable, TableRenderMixin):
 | 
			
		||||
        )
 | 
			
		||||
        return html
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def render_r(self, value, record: Intervention):
 | 
			
		||||
        """ Renders the recorded column for an intervention
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								templates/table/revocation_warning_col.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								templates/table/revocation_warning_col.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
{% load i18n fontawesome_5 %}
 | 
			
		||||
 | 
			
		||||
{% if has_revocations %}
 | 
			
		||||
    <strong>
 | 
			
		||||
        <a href="{{url}}" title="{% trans 'Revocations exists' %}">
 | 
			
		||||
            {% fa5_icon 'ban' %}
 | 
			
		||||
            {{content}}
 | 
			
		||||
        </a>
 | 
			
		||||
    </strong>
 | 
			
		||||
{% else %}
 | 
			
		||||
    <a href="{{url}}" title="{{tooltip}}">
 | 
			
		||||
        {{content}}
 | 
			
		||||
    </a>
 | 
			
		||||
{% endif %}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user