casufi mail Sites current corporate cat pages models py from django db

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
casufi@mail ~/Sites/current/corporate $ cat ./pages/models.py
from django.db import models
from django.contrib.sites.models import Site
from corporate import settings
import mptt
# Create your models here.
class TypeofthePage(models.Model):
type_name = models.CharField(max_length=30)
template_name = models.FileField(upload_to = "templates")
def __unicode__(self):
return self.type_name
class Admin:
pass
class SomePage(models.Model):
page_name = models.CharField(max_length=30)
page_site = models.ForeignKey(Site)
page_type = models.ForeignKey(TypeofthePage)
parent = models.ForeignKey('self',related_name='childs', blank=True, null=True)
image_top_banner = models.ImageField(upload_to = "images",blank=True)
image_left_banner = models.ImageField(upload_to = "images", blank=True)
page_first_menu = models.BooleanField()
image_first_menu = models.ImageField(upload_to = "images", blank=True)
page_second_menu = models.BooleanField()
image_second_menu = models.ImageField(upload_to = "images", blank=True)
page_third_menu = models.BooleanField()
image_third_menu = models.ImageField(upload_to = "images", blank=True)
def __unicode__(self):
return self.page_name
class Admin:
pass
class Meta:
unique_together = ("page_name", "page_site", "parent")
class AvtoModels_Categories(models.Model):
category_page_name = models.CharField(max_length=30)
category_description = models.CharField(max_length=100)
def __unicode__(self):
return self.category_page_name
class Admin:
pass
class AvtoModels(models.Model):
Available = models.BooleanField()
special_offer = models.BooleanField()
parrent_page = models.ForeignKey(SomePage)
type = models.ForeignKey(AvtoModels_Categories)
model = models.CharField(max_length=100)
short_description = models.TextField()
long_description = models.TextField(blank=True)
description_image = models.ImageField(upload_to = "images", blank=True)
avatar_image = models.ImageField(upload_to = "images", blank=True)
price = models.DecimalField( max_digits=20, decimal_places=2, blank=True)
def __unicode__(self):
return self.model
class Admin:
list_filter = ['parrent_page']
pass
class Accessories_Categories(models.Model):
category_page_name = models.CharField(max_length=30)
category_description = models.CharField(max_length=100)
def __unicode__(self):
return self.type_name
class Admin:
pass
class Accessories(models.Model):
Available = models.BooleanField()
special_offer = models.BooleanField()
parrent_page = models.ForeignKey(SomePage)
type = models.ForeignKey(Accessories_Categories)
model = models.CharField(max_length=100)
short_description = models.TextField()
long_description = models.TextField(blank=True)
description_image = models.ImageField(upload_to = "images", blank=True)
avatar_image = models.ImageField(upload_to = "images", blank=True)
price = models.DecimalField( max_digits=20, decimal_places=2, blank=True)
def __unicode__(self):
return self.model
class Admin:
list_filter = ['parrent_page']
pass
class Services_Categories(models.Model):
category_page_name = models.CharField(max_length=30)
category_description = models.CharField(max_length=100)
def __unicode__(self):
return self.type_name
class Admin:
pass
class Services(models.Model):
Available = models.BooleanField()
special_offer = models.BooleanField()
parrent_page = models.ForeignKey(SomePage)
type = models.ForeignKey(Services_Categories)
short_description = models.TextField()
long_description = models.TextField(blank=True)
description_image = models.ImageField(upload_to = "images", blank=True)
avatar_image = models.ImageField(upload_to = "images", blank=True)
normochas = models.DecimalField( max_digits=20, decimal_places=2, blank=True)
price = models.DecimalField( max_digits=20, decimal_places=2, blank=True)
def __unicode__(self):
return self.model
class Admin:
list_filter = ['parrent_page']
pass
class Contacts_Categories(models.Model):
category_page_name = models.CharField(max_length=30)
category_description = models.CharField(max_length=100)
def __unicode__(self):
return self.type_name
class Admin:
pass
class Contacts(models.Model):
parrent_page = models.ForeignKey(SomePage)
type = models.ForeignKey(Contacts_Categories)
city = models.CharField(max_length=100)
address = models.CharField(max_length=256)
url = models.URLField()
email= models.EmailField()
location_image = models.ImageField(upload_to = "images", blank=True)
phone = models.CharField(max_length=100)
def __unicode__(self):
return self.city
class Admin:
list_filter = ['parrent_page']
pass
mptt.register(SomePage, order_insertion_by=['page_name'])