change salary model field to DecimalField

This commit is contained in:
2021-06-24 13:09:44 +00:00
parent 3c893bcfba
commit 5e790aae12
5 changed files with 45 additions and 8 deletions

View File

@@ -8,7 +8,13 @@ class JobPostingAdmin(admin.ModelAdmin):
form = JobPostingForm form = JobPostingForm
model = JobPosting model = JobPosting
list_display = ["company_name", "job_name", "salary", "number_of_hours", "publish_date"] list_display = [
"company_name",
"job_name",
"salary",
"number_of_hours",
"publish_date",
]
admin.site.register(JobPosting, JobPostingAdmin) admin.site.register(JobPosting, JobPostingAdmin)

View File

@@ -7,7 +7,14 @@ from .models import JobPosting
class JobPostingForm(forms.ModelForm): class JobPostingForm(forms.ModelForm):
class Meta: class Meta:
model = JobPosting model = JobPosting
fields = ["company_name", "job_name", "salary", "number_of_hours", "pdf_location", "publish_date"] fields = [
"company_name",
"job_name",
"salary",
"number_of_hours",
"pdf_location",
"publish_date",
]
labels = { labels = {
"company_name": _("Firmenname"), "company_name": _("Firmenname"),
@@ -19,5 +26,7 @@ class JobPostingForm(forms.ModelForm):
help_texts = { help_texts = {
"pdf_location": _("Verwendbare Formate: PDF"), "pdf_location": _("Verwendbare Formate: PDF"),
"salary": _("in Euro angeben; monatliches Gehalt bei >1h, sonst Stundenlohn."), "salary": _(
"in Euro angeben; monatliches Gehalt bei >1h, sonst Stundenlohn."
),
} }

View File

@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2021-06-24 13:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blackboard', '0002_auto_20210515_1916'),
]
operations = [
migrations.AlterField(
model_name='jobposting',
name='salary',
field=models.DecimalField(decimal_places=1, max_digits=6, verbose_name='Gehalt'),
),
]

View File

@@ -19,8 +19,10 @@ class JobPosting(models.Model):
company_name = models.CharField(verbose_name="Firmenname", max_length=128) company_name = models.CharField(verbose_name="Firmenname", max_length=128)
job_name = models.CharField(verbose_name="Berufsbezeichnung", max_length=128) job_name = models.CharField(verbose_name="Berufsbezeichnung", max_length=128)
salary = models.PositiveSmallIntegerField( salary = models.DecimalField(
verbose_name="Gehalt", verbose_name="Gehalt",
max_digits=6,
decimal_places=1,
) )
number_of_hours = models.DecimalField( number_of_hours = models.DecimalField(
default=40, default=40,

View File

@@ -8,7 +8,9 @@ from .models import JobPosting
def index(request): def index(request):
job_postings_cutoff = timezone.now().date() - timedelta(30) # 30days from now job_postings_cutoff = timezone.now().date() - timedelta(30) # 30days from now
job_postings = JobPosting.all_job_postings.filter(publish_date__gt=job_postings_cutoff) job_postings = JobPosting.all_job_postings.filter(
publish_date__gt=job_postings_cutoff
)
bb_info = CustomFlatPage.objects.filter(title__iexact="blackboard").first() bb_info = CustomFlatPage.objects.filter(title__iexact="blackboard").first()
bb_empty = CustomFlatPage.objects.filter(title__iexact="blackboard empty").first() bb_empty = CustomFlatPage.objects.filter(title__iexact="blackboard empty").first()