class Course(models.Model): vendor = models.TextField() year_start = models.PositiveSmallIntegerField(help_text="YYYY") year_end = models.PositiveSmallIntegerField(help_text="YYYY", blank=True, null=True, default=None) is_expiration = models.BooleanField() title = models.TextField() description = tinymce.models.HTMLField(blank=True) link = models.URLField(blank=True, null=True, default=None) small_icon = models.ImageField(blank=True, null=True, default=None) tags = models.ManyToManyField('tags.Tag', null=True) class Meta: ordering = ('-year_start', ) def year_range_str(self): if self.is_expiration: return "{} - {}".format(self.year_start, self.year_end) else: return self.year_start def __str__(self): return "{year} {vendor} - {title}".format(year=self.year_start, vendor=self.vendor, title=self.title)
class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name='Location', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=200, verbose_name='Название для боковой панели')), ('short_description', models.TextField(blank=True, verbose_name='Краткое описание')), ('long_description', tinymce.models.HTMLField(blank=True, verbose_name='Полное описание')), ('lng', models.FloatField(verbose_name='Долгота')), ('lat', models.FloatField(verbose_name='Широта')), ('properties_title', models.CharField(default='', max_length=200, verbose_name='Название точки на карте')), ('properties_placeId', models.UUIDField( default=uuid.uuid4, editable=False, verbose_name='Уникальный идентификатор локации')), ], ), migrations.CreateModel( name='Image', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('order', models.SmallIntegerField(default=0, verbose_name='Позиция в списке')), ('image', models.ImageField(upload_to='', verbose_name='Файл')), ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='places.location', verbose_name='Место')), ], options={ 'ordering': ['order'], }, ), ]
class SocialMedia(models.Model): display_name = models.TextField() url = models.URLField() small_icon = models.ImageField(blank=True, null=True, default=None) def __str__(self): return self.display_name
class Experience(models.Model): company = models.TextField() company_small_logo = models.ImageField(blank=True, null=True, default=None) company_link = models.URLField(blank=True, null=True, default=None) month_start = models.PositiveSmallIntegerField() year_start = models.PositiveSmallIntegerField() is_current_job = models.BooleanField(default=False) month_end = models.PositiveSmallIntegerField(blank=True, null=True, default=None) year_end = models.PositiveSmallIntegerField(blank=True, null=True, default=None) title = models.TextField() description = tinymce.models.HTMLField() location = models.TextField() tags = models.ManyToManyField('tags.Tag', null=True) class Meta: ordering = ('-year_start', ) def month_year_range_str(self): range = "{month_start:0>2d}/{year_start} - ".format( month_start=self.month_start, year_start=self.year_start) if self.is_current_job: range += "Present" else: range += "{month_end:0>2d}/{year_end}".format( month_end=self.month_end, year_end=self.year_end) return range month_year_range_str.short_description = "Dates" # This is so the admin page has correct column header def __str__(self): return "{range} | {company} | {title}".format( range=self.month_year_range_str(), company=self.company, title=self.title)
class Education(models.Model): year_start = models.PositiveSmallIntegerField() year_end = models.PositiveSmallIntegerField() degree = models.TextField(help_text="e.g. Associates of Arts, or AA") major = models.TextField() minor = models.TextField(blank=True, default='') school_name_full = models.TextField() school_name_acronym = models.CharField(default='', max_length=10) description = models.TextField(blank=True, default='') gpa = models.FloatField( blank=True, null=True, default=None, validators=[MinValueValidator(0.0), MaxValueValidator(4.0)]) small_icon = models.ImageField(blank=True, null=True, default=None) class Meta: ordering = ('-year_start', ) def year_range_str(self): return "{start} - {end}".format( start=self.year_start, end=self.year_end if self.year_end else "Present") year_range_str.short_description = "Dates" # This is so the admin page has correct column header def __str__(self): return "{years} : {school} - {major}".format( years=self.year_range_str(), school=self.school_name_acronym, major=self.major)
class Post(models.Model): created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) title_slug = models.SlugField() title = models.TextField() content = tinymce.models.HTMLField() tags = models.ManyToManyField('tags.Tag', null=True) class Meta: ordering = ('-updated', ) def __str__(self): return self.title
class Project(models.Model): year_start = models.PositiveSmallIntegerField() year_end = models.PositiveSmallIntegerField(blank=True, null=True, default=None) is_wip = models.BooleanField() git_url = models.URLField(blank=True, null=True, default=None) title = models.TextField() title_slug = models.SlugField() # This is the full project page content full_content = tinymce.models.HTMLField() # This is the condensed version for the resume page resume_content = tinymce.models.HTMLField() project_logo = models.ImageField(blank=True, null=True, default=None) tags = models.ManyToManyField('tags.Tag', null=True) class Meta: ordering = ('-year_start', ) def __str__(self): return "{year} - {title}".format(year=self.year_start, title=self.title) def get_date_range_str(self): range = "{year_start} - ".format(year_start=self.year_start) if self.is_wip: range += "Present" else: range += "{year_end}".format(year_end=self.year_end) return range
class Migration(migrations.Migration): initial = True dependencies = [ ("accounts", "0001_initial"), ] operations = [ migrations.CreateModel( name="Category", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("title", models.CharField(max_length=50, verbose_name="Title")), ], options={ "verbose_name": "Category", "verbose_name_plural": "Categories", }, ), migrations.CreateModel( name="Newsletter", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("email", models.EmailField(max_length=254, verbose_name="Email")), ( "timestamp", models.DateTimeField(auto_now=True, verbose_name="Timestamp"), ), ], options={ "verbose_name": "newsletter", "verbose_name_plural": "newsletters", }, ), migrations.CreateModel( name="Post", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("title", models.CharField(max_length=100, verbose_name="Title")), ("overview", models.TextField(default="", verbose_name="Overview")), ( "timestamp", models.DateTimeField(auto_now=True, verbose_name="Timestamp"), ), ("content", tinymce.models.HTMLField(default="<p>Hello World</p>")), ( "featured", models.BooleanField(default=False, verbose_name="Featured"), ), ( "thumbnail", models.ImageField( blank=True, default="testing.jpeg", upload_to="thumbnail", verbose_name="Thumbnail", ), ), ("slug", models.SlugField(blank=True, null=True, verbose_name="Slug")), ( "author", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="accounts.author", verbose_name="Author", ), ), ( "category", models.ManyToManyField(related_name="post", to="blog.Category", verbose_name="Category"), ), ], options={ "verbose_name": "Post", "verbose_name_plural": "Posts", }, ), migrations.CreateModel( name="Comment", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "timestamp", models.DateTimeField(auto_now=True, verbose_name="Timestamp"), ), ("content", models.TextField(verbose_name="Content")), ( "post", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="comment", to="blog.post", verbose_name="post", ), ), ( "user", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="accounts.author", verbose_name="user", ), ), ], options={ "verbose_name": "comment", "verbose_name_plural": "comments", }, ), ]
class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name="BlogPost", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("blog_title", models.TextField()), ("pub_date", models.DateField(verbose_name="Date published")), ("blog_summary", models.TextField()), ("blog_slug", models.SlugField(unique=True)), ("blog_text", tinymce.models.HTMLField()), ], ), migrations.CreateModel( name="BlogComment", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("comment_text", models.TextField(max_length=750)), ("votes", models.IntegerField(default=0)), ( "blog", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="tomdougiamas.blogpost", ), ), ("pub_date", models.DateField(verbose_name="Date published")), ( "author", models.ForeignKey( on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, ), ), ], ), migrations.CreateModel( name="Project", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("project_title", models.CharField(max_length=50)), ("project_description", tinymce.models.HTMLField()), ], ), ]