Add more details to the iCal sync admin overview page
This commit is contained in:
		
							parent
							
								
									16177f853d
								
							
						
					
					
						commit
						079847ae4e
					
				
					 2 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -5,5 +5,6 @@ from davinci.icalendar.models import ICalSync
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ICalSyncAdmin(admin.ModelAdmin):
 | 
					class ICalSyncAdmin(admin.ModelAdmin):
 | 
				
			||||||
    form = ICalSyncForm
 | 
					    form = ICalSyncForm
 | 
				
			||||||
 | 
					    list_display = ['name', 'target', 'purge', 'humanized_sync_interval', 'last_sync', 'active']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
admin.site.register(ICalSync, ICalSyncAdmin)
 | 
					admin.site.register(ICalSync, ICalSyncAdmin)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,6 +24,10 @@ class ICalSync(models.Model):
 | 
				
			||||||
    def __str__(self):
 | 
					    def __str__(self):
 | 
				
			||||||
        return f'{self.name} to {self.target} every {humanize.precisedelta(self.sync_interval)}'
 | 
					        return f'{self.name} to {self.target} every {humanize.precisedelta(self.sync_interval)}'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @property
 | 
				
			||||||
 | 
					    def humanized_sync_interval(self):
 | 
				
			||||||
 | 
					        return humanize.precisedelta(self.sync_interval)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_events(self):
 | 
					    def get_events(self):
 | 
				
			||||||
        data = ical_utils.get_ical_from_url(self.ical_url)
 | 
					        data = ical_utils.get_ical_from_url(self.ical_url)
 | 
				
			||||||
        return ical_utils.split_events(data)
 | 
					        return ical_utils.split_events(data)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue