source: subversion/sites/other/tilesAtHome_tahngo/requests/models.py @ 9722

Revision 9722, 2.1 KB checked in by spaetz, 6 years ago (diff)

got ordering just the wrong way

Line 
1from django.db import models
2from django.contrib.auth.models import User
3from tah.tah_intern.models import Layer, Blank
4
5#-----------------------------------------------------
6class Request(models.Model):
7  x = models.PositiveSmallIntegerField()
8  y = models.PositiveSmallIntegerField()
9  min_z = models.PositiveSmallIntegerField(default=12)
10  max_z = models.PositiveSmallIntegerField(default=17)
11  layers = models.ManyToManyField(Layer,null=True)
12  #status: 0=unhandled, 1=Handed out, 2=Finished
13  status = models.PositiveSmallIntegerField(default=0)
14  # priority: 1=urgent 3=slow bulk
15  priority = models.PositiveSmallIntegerField(default=3)
16  ipaddress = models.IPAddressField(blank=True,default="")
17  request_time = models.DateTimeField(auto_now_add=True)
18  #clientping contains the last "I am still working on it" when active, on upload it indicates the upload time
19  clientping_time = models.DateTimeField(blank=True,default="")
20  #client_id = models.PositiveIntegerField(blank=True,default=0)
21  client = models.ForeignKey(User,blank=True,null=True)
22
23  def __str__(self):
24    return "%s|%s|%s|%s" % (self.x,self.y,self.min_z,self.layers_str)
25
26  @property
27  def layers_str(self):
28    return  ','.join([a['name'] for a in self.layers.values()])
29
30  @property
31  def status_str(self):
32    return  ['unhandled','active','finished'][self.status]
33
34
35#-----------------------------------------------------
36class Upload(models.Model):
37  file = models.FileField(upload_to='Incoming')
38  layer = models.ForeignKey(Layer,blank=True,null=True)
39  ipaddress = models.IPAddressField(blank=True,default="")
40  user_id = models.ForeignKey(User)
41  client_uuid = models.PositiveSmallIntegerField(blank=True, default=0)
42  #clientping contains the upload it indicates the upload time
43  upload_time = models.DateTimeField(auto_now_add=True)
44  # priority: 1=urgent 3=slow bulk
45  priority = models.PositiveSmallIntegerField(default=3)
46  # if we need to do multi-threaded processing this shows locked uploads
47  is_locked = models.BooleanField(default=False)
48
49  def __str__(self):
50    return str(self.layer)+","+str(self.file)
51
52  class Meta:
53    ordering = ['upload_time']
Note: See TracBrowser for help on using the repository browser.