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

Last change on this file since 9092 was 9070, checked in by spaetz, 12 years ago

add recent uploads page. 2) add request status back into the tile detail view

File size: 2.0 KB
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.PositiveIntegerField(max_length=4)
8  y = models.PositiveIntegerField(max_length=4)
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  class Admin:
35    pass
36
37#-----------------------------------------------------
38class Upload(models.Model):
39  file = models.FileField(upload_to='Incoming')
40  layer = models.ForeignKey(Layer,blank=True,null=True)
41  ipaddress = models.IPAddressField(blank=True,default="")
42  user_id = models.ForeignKey(User)
43  #clientping contains the upload it indicates the upload time
44  upload_time = models.DateTimeField(auto_now_add=True)
45  # priority: 1=urgent 3=slow bulk
46  priority = models.PositiveSmallIntegerField(default=3)
47  # if we need to do multi-threaded processing this shows locked uploads
48  is_locked = models.BooleanField(default=False)
49
50  def __str__(self):
51    return str(self.layer)+","+str(self.file)
52
53  class Admin:
54    pass
Note: See TracBrowser for help on using the repository browser.