class TransportMark(AbstractImg): ttype = models.ForeignKey(TransportType, verbose_name=_('Transport'), related_name='tmarks', on_delete=models.CASCADE) name = std_text_field(_('Name')) description = models.TextField(_("Description"), blank=True) name_en = std_text_field(_('English name')) class Meta: verbose_name = _("Transport mark") verbose_name_plural = _("Transport mark") def __str__(self): return "%s :: %s" % (self.ttype.name, self.name)
class AbstractEmployer(AbstractImg, AbstractWTime): is_company = models.BooleanField(verbose_name=_('Employer is company'), default=False) name = std_text_field(_('Company name')) w_position = std_text_field(_('Work position')) description = models.TextField(verbose_name=_('Activities description '), blank=True, default='') class Meta: verbose_name = _("Employer") verbose_name_plural = _("Employers") abstract = True
class AnimalKind(AbstractImg): animal = models.ForeignKey(AnimalType, verbose_name=_('Animal'), related_name='kind', on_delete=models.CASCADE) name = std_text_field(_('Name')) description = models.TextField(_("Description"), blank=True) name_en = std_text_field(_('English name')) class Meta: verbose_name = _("Animal kind") verbose_name_plural = _("Animals kinds") def __str__(self): return "%s :: %s" % (self.animal.name, self.name)
class DeliveryAddress(AbstractLocation): user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('User'), related_name='deliveryaddr', on_delete=models.CASCADE) first_name = std_text_field(_('First Name')) middle_name = std_text_field(_('Middle Name')) last_name = std_text_field(_('Last Name')) phone = models.CharField(max_length=20, verbose_name=_('Phone'), default='', blank=True) skype = models.CharField(max_length=50, verbose_name=_('Skype'), default='', blank=True) class Meta: verbose_name = _("Delivery Address") verbose_name_plural = _("Delivery Addresses") def __str__(self): result = '' if self.zipcode != '' and self.zipcode is not None: result += self.zipcode if self.country is not None: result += ', ' + self.country.name if self.region is not None: result += _(', region ') + self.region.name if self.city is not None: result += _(', city ') + self.city.name if self.street != '' and self.street is not None: result += _(', street ') + ' ' + self.street if self.house_number != '' and self.house_number is not None: result += _(', house ') + self.house_number if self.building != '' and self.building is not None: result += _(', building ') + self.building if self.flat_number != '' and self.flat_number is not None: result += _(', flat ') + self.flat_number if self.last_name != '' and self.last_name is not None: result += ', ' + self.last_name if self.first_name != '' and self.first_name is not None: result += ' ' + self.first_name if self.middle_name != '' and self.middle_name is not None: result += ' ' + self.middle_name if self.phone != '' and self.phone is not None: result += _(', phone-') + self.phone if self.skype != '' and self.skype is not None: result += _(', skype-') + self.skype return result
class ShopCallback(AbstractIP): created_date = models.DateTimeField(_("Created date"), default=now) clientname = std_text_field(_('Client Name')) clientphone = std_text_field(_('Client Phone')) description = models.TextField(verbose_name=_("Description"), blank=True) closed = models.BooleanField(verbose_name=_("Closed"), default=False) quickorder = models.BooleanField(verbose_name=_("Quick order"), default=False) class Meta: ordering = ['-created_date'] verbose_name = _('Shop Callback') verbose_name_plural = _('Shop Callbacks') def __str__(self): return "%s - %s" % (self.clientname, self.created_date)
class AbstractEducation(models.Model): institution = std_text_field(_('Institution')) education_end = models.IntegerField(verbose_name=_('End of education'), choices=EDUCATION_END, default=current_year) education_type = models.IntegerField(verbose_name=_('Type of education'), choices=EDU_CHOICES, default=EDU_UNKNOWN) instructor = std_text_field(_('Instructor')) diploma = std_text_field(_('Diploma')) specialty = std_text_field(_('Specialty')) prof_edu = models.BooleanField(_('Profile education'), default=False) addon = std_text_field(_('Additional info')) position = models.PositiveSmallIntegerField(verbose_name=_('Priority'), db_index=True, default=0, blank=True) class Meta: verbose_name = _("Education") verbose_name_plural = _("Educations") abstract = True
class TypeLifestyle(AbstractOrder): name = std_text_field(_('Type on lifestyle')) class Meta: ordering = ['name', ] verbose_name = _("Type on lifestyle") verbose_name_plural = _("Types on lifestyle")
class TypeProfession(AbstractOrder): name = std_text_field(_('Type on profession')) class Meta: ordering = ['name', ] verbose_name = _("Type on profession") verbose_name_plural = _("Types on profession")
class TypeNational(AbstractOrder): name = std_text_field(_('Type on national sign')) class Meta: ordering = ['name', ] verbose_name = _("Type on national sign") verbose_name_plural = _("Types on national sign")
class SkinColor(AbstractOrder): name = std_text_field(_('Skin color')) class Meta: ordering = ['name', ] verbose_name = _("Color of skin") verbose_name_plural = _("Colors of skin")
class EyeColor(AbstractOrder): name = std_text_field(_('Eye color')) class Meta: ordering = ['name', ] verbose_name = _("Eye color") verbose_name_plural = _("Eyes colors")
class TypeBodyModification(AbstractOrder): name = std_text_field(_('Type body modification')) class Meta: ordering = ['name', ] verbose_name = _("Type body modification") verbose_name_plural = _("Types body modifications")
class HairColor(AbstractOrder): name = std_text_field(_('Hair color')) class Meta: ordering = ['name', ] verbose_name = _("Hair color") verbose_name_plural = _("Hair colors")
class TypeFeatureAppearance(AbstractOrder): name = std_text_field(_('Feature of appearance')) class Meta: ordering = ['name', ] verbose_name = _("Feature appearance type") verbose_name_plural = _("Feature appearances types")
class TypeBodyHuman(AbstractOrder): name = std_text_field(_('Body Type')) class Meta: ordering = ['name', ] verbose_name = _("Body Type") verbose_name_plural = _("Body Types")
class TypeHistorical(AbstractOrder): name = std_text_field(_('Type in historical projects')) class Meta: ordering = ['name', ] verbose_name = _("Type in historical projects") verbose_name_plural = _("Types in historical projects")
class HairLength(AbstractOrder): name = std_text_field(_('Length of hair')) class Meta: ordering = ['name', ] verbose_name = _("Length of hair") verbose_name_plural = _("Length of hair")
class HairTexture(AbstractOrder): name = std_text_field(_('Texture of hair')) class Meta: ordering = ['name', ] verbose_name = _("Texture of hair") verbose_name_plural = _("Textures of hair")
class TypeBrightAppearance(AbstractOrder): name = std_text_field(_('Type on bright appearance')) class Meta: ordering = ['name', ] verbose_name = _("Type on bright appearance") verbose_name_plural = _("Types on bright appearance")
class ClothingSize(models.Model): international = std_text_field(_('International')) russian = models.PositiveSmallIntegerField(verbose_name=_('Russian size'), blank=True, null=True, default=None) eu = models.PositiveSmallIntegerField(verbose_name=_('EU size'), blank=True, null=True, default=None) uk = models.PositiveSmallIntegerField(verbose_name=_('UK size'), blank=True, null=True, default=None) us = models.PositiveSmallIntegerField(verbose_name=_('US size'), blank=True, null=True, default=None) dest = models.PositiveSmallIntegerField(verbose_name=_('Size for'), choices=DST_FOR_CHOICES, default=DST_FOR_UNKNOWN) class Meta: verbose_name = _("Clothing size") verbose_name_plural = _("Clothing sizes") def __str__(self): return "%s / %s" % (self.international, self.russian)
class TypeNationalHuman(AbstractOrder): name = std_text_field(_('National Type')) class Meta: ordering = ['name', ] verbose_name = _("National Type") verbose_name_plural = _("National Types")
class Basket(AbstractDate): user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('User'), related_name='basket', blank=True, null=True, on_delete=models.SET_NULL) quantity = models.IntegerField(verbose_name=_('Quantity')) product = models.ForeignKey(Product, verbose_name=_('Product'), related_name='basket', on_delete=models.CASCADE) session_key = models.CharField(max_length=40, verbose_name=_('Session key'), blank=True) addon = std_text_field(_('Add-on text')) class Meta: verbose_name = _("Basket") verbose_name_plural = _("Baskets") @property def sum(self): return self.quantity * int(self.product.with_discount) def __str__(self): # noinspection PyBroadException try: return "%s" % self.user.username except: return "%s" % self.pk
class TypeAppearanceHuman(AbstractOrder): name = std_text_field(_('Type of appearance')) class Meta: ordering = ['name', ] verbose_name = _("Type of appearance") verbose_name_plural = _("Types of appearance")
class Review(AbstractIP, AbstractImg): user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('User'), related_name='reviews', null=True, blank=True) created_date = models.DateTimeField(_("Created date"), default=now) name = std_text_field(_('Name')) w_position = std_text_field(_('Position')) message = models.TextField(verbose_name=_("Message"), blank=True, default='') visible = models.BooleanField(verbose_name=_("Visible"), default=False) vip = models.BooleanField(verbose_name=_("Vip"), default=False) class Meta: ordering = ['-created_date'] verbose_name = _('Review') verbose_name_plural = _('Reviews') def __str__(self): return "%s - %s" % (self.name, self.created_date)
class AbstractEmployee(AbstractImg): agent_name = std_text_field(_('Agent name')) agent_phone = models.CharField(max_length=20, verbose_name=_('Mobile phone of agent'), blank=True, default='') agent_email = models.EmailField(verbose_name=_('Agent Email'), blank=True, null=True) agent_only = models.BooleanField(_('Contact only with agent'), default=False) agent_on = models.TimeField(verbose_name=_('Agent work time from'), blank=True, null=True) agent_off = models.TimeField(verbose_name=_('Agent work time to'), blank=True, null=True) permanent_work = std_text_field(_('Permanent place of work')) awards = std_text_field(_('Awards, achievements, titles')) payment_from = models.IntegerField(verbose_name=_('Amount payment from'), null=True, blank=True) payment_to = models.IntegerField(verbose_name=_('Amount payment to'), null=True, blank=True) additionally = models.TextField(verbose_name=_("Additionally"), blank=True, default='') source_about_resource = std_text_field(_('Source about our resource')) agency = models.ManyToManyField(Agency, verbose_name=_('In agency base'), blank=True) class Meta: verbose_name = _("Employee") verbose_name_plural = _("Employees") abstract = True def delete(self, *args, **kwargs): # noinspection PyBroadException try: remove_thumbnails(self.agent_img.path) remove_file(self.agent_img.path) except: pass super(AbstractEmployee, self).delete(*args, **kwargs)
class AbstractTypeActor(models.Model): type_national = models.ManyToManyField(TypeNational, verbose_name=_('Type of national sign'), blank=True) type_national_desc = std_text_field(_('Explain type national')) type_profession = models.ManyToManyField(TypeProfession, verbose_name=_('Type on profession'), blank=True) type_profession_desc = std_text_field(_('Explain type profession')) type_lifestyle = models.ManyToManyField(TypeLifestyle, verbose_name=_('Type on lifestyle'), blank=True) type_lifestyle_desc = std_text_field(_('Explain type lifestyle')) type_bright_appearance = models.ManyToManyField(TypeBrightAppearance, verbose_name=_('Type on bright appearance'), blank=True) type_bright_appearance_desc = std_text_field(_('Explain type bright appearance')) type_historical = models.ManyToManyField(TypeHistorical, verbose_name=_('Type in historical projects'), blank=True) type_historical_desc = std_text_field(_('Explain type historical')) class Meta: verbose_name = _("Type of actor") verbose_name_plural = _("Types of actors") abstract = True
class AbstractPersonalData(models.Model): citizen_of_russia = models.BooleanField(_('Russia citizenship'), default=True) citizenship = models.CharField(max_length=30, verbose_name=_('Citizenship'), blank=True) foreign_passport = models.BooleanField(_('Foreign passport'), default=False) foreign_passport_expired = models.DateField(verbose_name=_('Foreign passport expired'), blank=True, null=True) inn = models.CharField(max_length=12, verbose_name=_('INN'), blank=True) insurance = models.CharField(max_length=12, verbose_name=_('Certificate of insurance'), blank=True) passport_series = models.CharField(max_length=40, verbose_name=_('Passport series'), blank=True) passport_num = models.CharField(max_length=40, verbose_name=_('Passport number'), blank=True) passport_issued = std_text_field(_('Passport issued')) passport_date = models.DateField(verbose_name=_('Date of passport issued'), blank=True, null=True) passport_registration = std_text_field(_('Passport registration')) class Meta: verbose_name = _("Personal Data") verbose_name_plural = _("Personal Data") abstract = True
class AbstractNnmwareProfile(AbstractDate, AbstractImg, PicsMixin): uid = models.UUIDField(default=uuid4, editable=False, db_index=True) main = models.BooleanField(_('Main profile'), default=False) first_name = std_text_field(_('First Name'), max_length=50) middle_name = std_text_field(_('Middle Name'), max_length=50) last_name = std_text_field(_('Last Name'), max_length=50) viewcount = models.PositiveIntegerField(default=0, editable=False) enabled = models.BooleanField(verbose_name=_("Enabled in system"), default=False) birthdate = models.DateField(verbose_name=_('Date birth'), blank=True, null=True) gender = models.CharField(verbose_name=_("Gender"), max_length=1, choices=GENDER_CHOICES, blank=True) is_employer = models.BooleanField(verbose_name=_("Account is employer"), default=False) is_public = models.BooleanField(verbose_name=_("Account is public"), default=False) agent_img = models.ImageField(verbose_name=_("Agent avatar"), max_length=1024, upload_to="img/%Y/%m/%d/", blank=True, height_field='agent_img_height', width_field='agent_img_width') agent_img_height = models.PositiveIntegerField(null=True, blank=True, verbose_name=_('Agent avatar height')) agent_img_width = models.PositiveIntegerField(null=True, blank=True, verbose_name=_('Agent avatar height')) @property def events_count(self): return self.events.count() @property def get_name(self): if self.first_name and self.last_name: return self.first_name + ' ' + self.last_name else: return self.user.username def __str__(self): return self.get_name class Meta: verbose_name = _("Profile") verbose_name_plural = _("Profiles") abstract = True def get_absolute_url(self): return reverse('employer_view', args=[self.pk]) @property def get_agent_avatar(self): if self.agent_img: return self.agent_img.url return setting('DEFAULT_AVATAR', 'noavatar.png')
class Education(AbstractImg): institution = models.ForeignKey(Institution, verbose_name=_('Institution'), related_name='edu', blank=True, null=True) education_end = models.IntegerField(verbose_name=_('End of education'), choices=EDUCATION_END, default=current_year) master_course = std_text_field(_('Master of course')) diploma_work = std_text_field(_('Diploma work')) diploma_role = std_text_field(_('Role')) specialty = std_text_field(_('Specialty')) prof_edu = models.BooleanField(_('Profile education'), default=False) nonprof_name = std_text_field(_('Non-profile course name')) class Meta: verbose_name = _("Education") verbose_name_plural = _("Educations")
class AbstractLocation(models.Model): country = models.ForeignKey(Country, verbose_name=_('Country'), blank=True, null=True, related_name="%(class)s_cou") region = models.ForeignKey(Region, verbose_name=_('Region'), blank=True, null=True, related_name="%(class)s_reg") city = models.ForeignKey(City, verbose_name=_('City'), blank=True, null=True, related_name="%(class)s_cit") stationmetro = models.ForeignKey(StationMetro, verbose_name=_('Station of metro'), null=True, blank=True, related_name='%(class)s_metro') zipcode = models.CharField(max_length=20, verbose_name=_('Zipcode'), blank=True) street = std_text_field(_('Street')) house_number = std_text_field(_('Number of house'), max_length=5) building = std_text_field(_('Building'), max_length=5) flat_number = std_text_field(_('Number of flat'), max_length=5) class Meta: verbose_name = _("Location") verbose_name_plural = _("Locations") abstract = True def geoaddress(self): try: return "%s %s, %s" % (self.house_number, self.street, self.city) except: return None @property def get_fulladdress(self): result = '' if self.country: result += self.country.get_name + ', ' if self.region: result += self.region.get_name + ', ' if self.city: result += self.city.get_name + ', ' if self.street: result += self.street + ' ' if self.street: result += self.street + ' ' if self.house_number: result += self.house_number + ' ' if self.building: result += self.building + ' ' if self.flat_number: result += self.flat_number return result