This commit is contained in:
@@ -1,11 +1,40 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from import_export.admin import ImportExportModelAdmin
|
from import_export.admin import ImportExportModelAdmin
|
||||||
|
from import_export import resources
|
||||||
|
from import_export.fields import Field
|
||||||
from .models import JobData
|
from .models import JobData
|
||||||
|
from django.utils.text import Truncator
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
|
||||||
|
class JobResource(resources.ModelResource):
|
||||||
|
# Map 'csv_column_name' from the file to 'model_variable_name' in your DB
|
||||||
|
job_position = Field(attribute='job_position',column_name='Job Position')
|
||||||
|
company = Field(attribute='company',column_name='Company')
|
||||||
|
URL = Field(attribute='URL',column_name='URL')
|
||||||
|
status = Field(attribute='status',column_name='Status')
|
||||||
|
date_saved = Field(attribute='date_saved',column_name='Date Saved')
|
||||||
|
date_applied = Field(attribute='date_applied',column_name='Date Applied')
|
||||||
|
type = Field(attribute='type',column_name='Type')
|
||||||
|
resume = Field(attribute='resume',column_name='Resume')
|
||||||
|
#cover_letter = Field(attribute='cover_letter',column_name='Cover Letter')
|
||||||
|
location = Field(attribute='location',column_name='Location')
|
||||||
|
job_description = Field(attribute='job_description',column_name='Job Description')
|
||||||
|
salary = Field(attribute='salary',column_name='Salary')
|
||||||
|
contact = Field(attribute='contact',column_name='Contact')
|
||||||
|
source = Field(attribute='source',column_name='Source')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = JobData
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(JobData)
|
@admin.register(JobData)
|
||||||
class JobAdmin(ImportExportModelAdmin):
|
class JobAdmin(ImportExportModelAdmin):
|
||||||
list_display = ('job_position',)
|
list_display = ('job_position','company','URL','status','date_saved','date_applied','type','resume','location','short_description','salary','contact','source')
|
||||||
fields = ['job_position']
|
#fields = ['job_position','company','URL','status','date_saved','date_applied','type','resume','cover_letter','location','job_description','salary ','contact','source']
|
||||||
|
resource_classes = [JobResource]
|
||||||
|
def short_description(self, obj):
|
||||||
|
return Truncator(obj.job_description).words(10, truncate=' ...')
|
||||||
|
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 4.2.30 on 2026-06-22 10:25
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('job', '0006_alter_jobdata_url'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='jobdata',
|
||||||
|
name='date_applied',
|
||||||
|
field=models.CharField(max_length=100, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='jobdata',
|
||||||
|
name='date_saved',
|
||||||
|
field=models.CharField(max_length=100, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 4.2.30 on 2026-06-22 10:28
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('job', '0007_alter_jobdata_date_applied_alter_jobdata_date_saved'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='jobdata',
|
||||||
|
name='cover_letter',
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
status_CHOICES = (
|
status_CHOICES = (
|
||||||
('Rejected','Rejected'),
|
('Rejected','Rejected'),
|
||||||
('Applied','Applied')
|
('Applied','Applied'),
|
||||||
|
('Negotiating','Negotiating'),
|
||||||
|
('Bookmarked','Bookmarked'),
|
||||||
|
('Accepted','Accepted')
|
||||||
)
|
)
|
||||||
|
|
||||||
class JobData(models.Model):
|
class JobData(models.Model):
|
||||||
@@ -10,11 +14,11 @@ class JobData(models.Model):
|
|||||||
company = models.CharField(max_length=100, null=True)
|
company = models.CharField(max_length=100, null=True)
|
||||||
URL = models.URLField(max_length=1000,null=True)
|
URL = models.URLField(max_length=1000,null=True)
|
||||||
status = models.CharField(max_length=100,choices=status_CHOICES, null=True)
|
status = models.CharField(max_length=100,choices=status_CHOICES, null=True)
|
||||||
date_saved = models.DateField('Published', blank=True, null=True)
|
date_saved = models.CharField(max_length=100, null=True)
|
||||||
date_applied = models.DateField('Published', blank=True, null=True)
|
date_applied = models.CharField(max_length=100, null=True)
|
||||||
type = models.CharField(max_length=100, null=True)
|
type = models.CharField(max_length=100, null=True)
|
||||||
resume = models.URLField(max_length=200, null=True)
|
resume = models.URLField(max_length=200, null=True)
|
||||||
cover_letter = models.URLField(max_length=200, null=True)
|
#cover_letter = models.URLField(max_length=200, null=True)
|
||||||
location = models.CharField(max_length=100, null=True)
|
location = models.CharField(max_length=100, null=True)
|
||||||
job_description = models.CharField(null=True)
|
job_description = models.CharField(null=True)
|
||||||
salary = models.CharField(null=True)
|
salary = models.CharField(null=True)
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2.30 on 2026-06-22 10:24
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('redirect', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='redirectdata',
|
||||||
|
name='addedDate',
|
||||||
|
field=models.DateField(blank=True, null=True, verbose_name='Published'),
|
||||||
|
),
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user