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

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

delete superfluous .htaccess file. Add a 'is_locked' attribute to Uploads

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