Intervention Detail View
* adds (WIP) detail view for interventions * renames typo in conservations_file_number to conservation_file_number * adds simple has_access check for intervention objects for given users * renames occurences of "Registered" to "Recorded" (verzeichnen) * adds an informing message for detail view of intervention objects which are not editable for a user * adds GeometryAdmin * adds fallback DEFAULT_SRID for Geometry model * adds translations
This commit is contained in:
+15
-2
@@ -25,7 +25,7 @@ class Intervention(BaseObject):
|
||||
registration_office = models.ForeignKey(Organisation, on_delete=models.SET_NULL, null=True, related_name="+")
|
||||
registration_file_number = models.CharField(max_length=1000, blank=True, null=True)
|
||||
conservation_office = models.ForeignKey(Organisation, on_delete=models.SET_NULL, null=True, related_name="+")
|
||||
conservations_file_number = models.CharField(max_length=1000, blank=True, null=True)
|
||||
conservation_file_number = models.CharField(max_length=1000, blank=True, null=True)
|
||||
|
||||
process_type = models.CharField(max_length=500, null=True, blank=True)
|
||||
law = models.CharField(max_length=500, null=True, blank=True)
|
||||
@@ -107,4 +107,17 @@ class Intervention(BaseObject):
|
||||
while Intervention.objects.filter(identifier=new_id).exists():
|
||||
new_id = self._generate_new_identifier()
|
||||
self.identifier = new_id
|
||||
super().save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def has_access(self, user: User):
|
||||
""" Access check
|
||||
|
||||
Checks whether a given user has access to this intervention
|
||||
|
||||
Args:
|
||||
user ():
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
return self.users.filter(username=user.username).exists()
|
||||
|
||||
Reference in New Issue
Block a user