Dirk Vogt | f130c75 | 2016-08-23 14:45:01 +0200 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | from django.db import models |
| 3 | import datetime |
| 4 | |
| 5 | def crashreport_file_name(instance, filename): |
| 6 | return '/'.join(['saved_crashreports', instance.uuid, str(datetime.date.today().year), str(datetime.date.today().month), str(datetime.date.today().day), filename]) |
| 7 | |
| 8 | |
| 9 | class Crashreport(models.Model): |
| 10 | uuid = models.CharField(max_length=200) |
Dirk Vogt | 1433f7c | 2016-09-20 15:30:56 +0200 | [diff] [blame^] | 11 | report_type = models.CharField(max_length=200) |
| 12 | app_version = models.IntegerField() |
Dirk Vogt | f130c75 | 2016-08-23 14:45:01 +0200 | [diff] [blame] | 13 | uptime = models.CharField(max_length=200) |
| 14 | build_fingerprint = models.CharField(max_length=200) |
| 15 | boot_reason = models.CharField(max_length=200) |
| 16 | power_on_reason = models.CharField(max_length=200) |
| 17 | power_off_reason = models.CharField(max_length=200) |
| 18 | aux_data = models.CharField(max_length=200) |
| 19 | date = models.DateTimeField() |
| 20 | crashreport_file = models.FileField(upload_to=crashreport_file_name,null=True, blank=True) |