<commit_before>from django.db import models
from django.db.models import permalink
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.utils.translation import ugettext as _
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericRelation

from contacts.managers import SpecialDateManager

class Company(models.Model):
	"""Company model."""
	name = models.CharField(_('name'), max_length=200)
	nickname = models.CharField(_('nickname'), max_length=50, blank=True,
		null=True)
	slug = models.SlugField(_('slug'), max_length=50, unique=True)
	about = models.TextField(_('about'), blank=True, null=True)
	logo = models.ImageField(_('photo'), upload_to='contacts/companies/', blank=True)	

	phone_number = GenericRelation('PhoneNumber')
	email_address = GenericRelation('EmailAddress')
	instant_messenger = GenericRelation('InstantMessenger')
	web_site = GenericRelation('WebSite')
	street_address = GenericRelation('StreetAddress')
	special_date = GenericRelation('SpecialDate')
	note = GenericRelation(Comment, object_id_field='object_pk')
	
	date_added = models.DateTimeField(_('date added'), auto_now_add=True)
	date_modified = models.DateTimeField(_('date modified'), auto_now=True)
	
	class Meta:
		db_table = 'contacts_companies'
		ordering = ('name',)
		verbose_name = _('company')
		verbose_name_plural = _('companies')
	
	def __unicode__(self):
		return u"%s" % self.name
	
	@permalink
	def get_absolute_url(self):
		return ('contacts_company_detail', None, {
		    'pk': self.pk,
			'slug': self.slug,
		})
	
	@permalink
	def get_update_url(self):
		return ('contacts_company_update', None, {
		    'pk': self.pk,
			'slug': self.slug,
		})
	
	@permalink
	def get_delete_url(self):
		return ('contacts_company_delete', None, {
		    'pk': self.pk,
			'slug': self.slug,
		})

class Person(models.Model):
	"""Person model."""
	first_name = models.CharField(_('first name'), max_length=100)
	last_name = models.CharField(_('last name'), max_length=200)
	middle_name = models.CharField(_('middle name'), max_length=200, blank=True, null=True)
	suffix = models.CharField(_('suffix'), max_length=50, blank=True, null=True)
	nickname = models.CharField(_('nickname'), max_length=100, blank=True)
	slug = models.SlugField(_('slug'), max_length=50, unique=True)
	title = models.CharField(_('title'), max_length=200, blank=True)
	company = models.ForeignKey(Company, blank=True, null=True)
	about = models.TextField(_('about'), blank=True)
	photo = models.ImageField(_('photo'), upload_to='contacts/person/', blank=True)
	
	user = models.OneToOneField(User, blank=True, null=True,<commit_msg>get auth mode (User class) from settings (instead of direct auth.User) to support customized User model<commit_after>from django.db import models
from django.db.models import permalink
from django.conf import settings
from django.contrib.contenttypes import generic
from django.utils.translation import ugettext as _
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericRelation

from contacts.managers import SpecialDateManager

class Company(models.Model):
	"""Company model."""
	name = models.CharField(_('name'), max_length=200)
	nickname = models.CharField(_('nickname'), max_length=50, blank=True,
		null=True)
	slug = models.SlugField(_('slug'), max_length=50, unique=True)
	about = models.TextField(_('about'), blank=True, null=True)
	logo = models.ImageField(_('photo'), upload_to='contacts/companies/', blank=True)	

	phone_number = GenericRelation('PhoneNumber')
	email_address = GenericRelation('EmailAddress')
	instant_messenger = GenericRelation('InstantMessenger')
	web_site = GenericRelation('WebSite')
	street_address = GenericRelation('StreetAddress')
	special_date = GenericRelation('SpecialDate')
	note = GenericRelation(Comment, object_id_field='object_pk')
	
	date_added = models.DateTimeField(_('date added'), auto_now_add=True)
	date_modified = models.DateTimeField(_('date modified'), auto_now=True)
	
	class Meta:
		db_table = 'contacts_companies'
		ordering = ('name',)
		verbose_name = _('company')
		verbose_name_plural = _('companies')
	
	def __unicode__(self):
		return u"%s" % self.name
	
	@permalink
	def get_absolute_url(self):
		return ('contacts_company_detail', None, {
		    'pk': self.pk,
			'slug': self.slug,
		})
	
	@permalink
	def get_update_url(self):
		return ('contacts_company_update', None, {
		    'pk': self.pk,
			'slug': self.slug,
		})
	
	@permalink
	def get_delete_url(self):
		return ('contacts_company_delete', None, {
		    'pk': self.pk,
			'slug': self.slug,
		})

class Person(models.Model):
	"""Person model."""
	first_name = models.CharField(_('first name'), max_length=100)
	last_name = models.CharField(_('last name'), max_length=200)
	middle_name = models.CharField(_('middle name'), max_length=200, blank=True, null=True)
	suffix = models.CharField(_('suffix'), max_length=50, blank=True, null=True)
	nickname = models.CharField(_('nickname'), max_length=100, blank=True)
	slug = models.SlugField(_('slug'), max_length=50, unique=True)
	title = models.CharField(_('title'), max_length=200, blank=True)
	company = models.ForeignKey(Company, blank=True, null=True)
	about = models.TextField(_('about'), blank=True)
	photo = models.ImageField(_('photo'), upload_to='contacts/person/', blank=True)
	
	user = models.OneToOneField(settings.AUTH_USER_MODEL, blank=True, null=True,
{'fraction_non_alphanumeric': 0.13849723362484384, 'fraction_numerical': 0.009280742459396751, 'mean_word_length': 6.354330708661418, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5288076', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1792, 'n_words': 372}