before first push
This commit is contained in:
commit
a8a45195c1
Binary file not shown.
@ -30,13 +30,6 @@ ALLOWED_HOSTS = []
|
|||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
"unfold", # before django.contrib.admin
|
|
||||||
"unfold.contrib.filters", # optional, if special filters are needed
|
|
||||||
"unfold.contrib.forms", # optional, if special form elements are needed
|
|
||||||
"unfold.contrib.inlines", # optional, if special inlines are needed
|
|
||||||
"unfold.contrib.import_export", # optional, if django-import-export package is used
|
|
||||||
"unfold.contrib.guardian", # optional, if django-guardian package is used
|
|
||||||
"unfold.contrib.simple_history",
|
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.humanize',
|
'django.contrib.humanize',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
|
|||||||
Binary file not shown.
@ -1,115 +1,10 @@
|
|||||||
from django.contrib import messages
|
|
||||||
from . import models
|
|
||||||
# from .utils import extract_summary_from_pdf
|
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
|
||||||
from django.contrib.auth.admin import GroupAdmin as BaseGroupAdmin
|
|
||||||
from django.contrib.auth.models import User, Group
|
|
||||||
from .models import FormTemplate, FormStage, FormField, FormSubmission, FieldResponse
|
|
||||||
from unfold.forms import AdminPasswordChangeForm, UserChangeForm, UserCreationForm
|
|
||||||
from unfold.admin import ModelAdmin
|
|
||||||
|
|
||||||
|
from .models import FormTemplate, FormStage, FormField,FieldResponse,FormSubmission
|
||||||
|
|
||||||
admin.site.unregister(User)
|
admin.site.register(FormTemplate)
|
||||||
admin.site.unregister(Group)
|
admin.site.register(FormStage)
|
||||||
|
admin.site.register(FormField)
|
||||||
|
admin.site.register(FormSubmission)
|
||||||
|
admin.site.register(FieldResponse)
|
||||||
|
|
||||||
|
|
||||||
@admin.register(User)
|
|
||||||
class UserAdmin(BaseUserAdmin, ModelAdmin):
|
|
||||||
form = UserChangeForm
|
|
||||||
add_form = UserCreationForm
|
|
||||||
change_password_form = AdminPasswordChangeForm
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Group)
|
|
||||||
class GroupAdmin(BaseGroupAdmin, ModelAdmin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.JobPosting)
|
|
||||||
class JobPostingAdmin(ModelAdmin):
|
|
||||||
list_display = ('title','description','qualifications')
|
|
||||||
|
|
||||||
|
|
||||||
# @admin.register(models.Job)
|
|
||||||
# class JobAdmin(ModelAdmin):
|
|
||||||
# list_display = ('title', 'is_published', 'posted_to_linkedin', 'created_at')
|
|
||||||
# list_filter = ('is_published', 'posted_to_linkedin')
|
|
||||||
# search_fields = ('title', 'description_en', 'description_ar')
|
|
||||||
|
|
||||||
# @admin.action(description="Parse selected resumes")
|
|
||||||
# def parse_resumes(modeladmin, request, queryset):
|
|
||||||
# for candidate in queryset:
|
|
||||||
# if candidate.resume:
|
|
||||||
# summary = extract_summary_from_pdf(candidate.resume.path)
|
|
||||||
# candidate.parsed_summary = str(summary)
|
|
||||||
# candidate.save()
|
|
||||||
# messages.success(request, f"Parsed {queryset.count()} resumes successfully.")
|
|
||||||
|
|
||||||
@admin.register(models.Candidate)
|
|
||||||
class CandidateAdmin(ModelAdmin):
|
|
||||||
list_display = ('first_name','last_name','phone', 'email', 'job', 'applied', 'created_at')
|
|
||||||
list_filter = ('applied', 'job')
|
|
||||||
search_fields = ('name', 'email')
|
|
||||||
# readonly_fields = ('parsed_summary',)
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.TrainingMaterial)
|
|
||||||
class TrainingMaterialAdmin(ModelAdmin):
|
|
||||||
list_display = ('title', 'created_by', 'created_at')
|
|
||||||
search_fields = ('title', 'content')
|
|
||||||
|
|
||||||
|
|
||||||
class FormFieldInline(admin.TabularInline):
|
|
||||||
model = FormField
|
|
||||||
extra = 0
|
|
||||||
fields = ('label', 'field_type', 'required', 'order', 'is_predefined')
|
|
||||||
ordering = ('order',)
|
|
||||||
|
|
||||||
class FormStageInline(admin.TabularInline):
|
|
||||||
model = FormStage
|
|
||||||
extra = 0
|
|
||||||
fields = ('name', 'order', 'is_predefined')
|
|
||||||
ordering = ('order',)
|
|
||||||
inlines = [FormFieldInline]
|
|
||||||
|
|
||||||
@admin.register(FormTemplate)
|
|
||||||
class FormTemplateAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('name', 'created_by', 'created_at', 'is_active', 'get_stage_count')
|
|
||||||
list_filter = ('is_active', 'created_at', 'created_by')
|
|
||||||
search_fields = ('name', 'description', 'created_by__username')
|
|
||||||
inlines = [FormStageInline]
|
|
||||||
readonly_fields = ('created_at', 'updated_at')
|
|
||||||
|
|
||||||
def get_stage_count(self, obj):
|
|
||||||
return obj.get_stage_count()
|
|
||||||
get_stage_count.short_description = 'Stages'
|
|
||||||
|
|
||||||
@admin.register(FormStage)
|
|
||||||
class FormStageAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('name', 'template', 'order', 'is_predefined')
|
|
||||||
list_filter = ('is_predefined', 'template')
|
|
||||||
search_fields = ('name', 'template__name')
|
|
||||||
ordering = ('template', 'order')
|
|
||||||
|
|
||||||
@admin.register(FormField)
|
|
||||||
class FormFieldAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('label', 'field_type', 'stage', 'required', 'order', 'is_predefined')
|
|
||||||
list_filter = ('field_type', 'required', 'is_predefined', 'stage__template')
|
|
||||||
search_fields = ('label', 'stage__name', 'stage__template__name')
|
|
||||||
ordering = ('stage', 'order')
|
|
||||||
|
|
||||||
@admin.register(FormSubmission)
|
|
||||||
class FormSubmissionAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('template', 'applicant_name', 'applicant_email', 'submitted_at')
|
|
||||||
list_filter = ('submitted_at', 'template')
|
|
||||||
search_fields = ('applicant_name', 'applicant_email', 'template__name')
|
|
||||||
readonly_fields = ('submitted_at',)
|
|
||||||
|
|
||||||
@admin.register(FieldResponse)
|
|
||||||
class FieldResponseAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('field', 'submission', 'display_value')
|
|
||||||
list_filter = ('field__field_type', 'submission__template')
|
|
||||||
search_fields = ('field__label', 'submission__applicant_name')
|
|
||||||
readonly_fields = ('display_value',)
|
|
||||||
Loading…
x
Reference in New Issue
Block a user