Skip to content

Commit

Permalink
add lookup and binary upload
Browse files Browse the repository at this point in the history
  • Loading branch information
glind committed Feb 22, 2023
1 parent 941fecf commit bf6eb46
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 27 deletions.
1 change: 1 addition & 0 deletions hunters/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

admin.site.register(Hunter, HunterAdmin)
admin.site.register(HunterEntry, HunterEntryAdmin)
admin.site.register(Position, PositionAdmin)
10 changes: 9 additions & 1 deletion hunters/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
# Monitor Forms
class HunterForm(forms.ModelForm):

brief = forms.FileField(
label="Upload a file",
help_text="Select a PDF or DOC file to upload.",
error_messages={
"required": "Choose a PDF or DOC file"
},
)

class Meta:
model = Hunter
exclude = ['create_date','edit_date']
Expand Down Expand Up @@ -38,7 +46,7 @@ def __init__(self, *args, **kwargs):
TabHolder(
Tab('Position Description',
Fieldset('',
'name','position_title','level','skills','description','pay','status',
'name','position_title','level','skills','description','brief','pay','status',
),
),

Expand Down
38 changes: 38 additions & 0 deletions hunters/migrations/0004_auto_20230222_1643.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 3.2.17 on 2023-02-22 16:43

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('hunters', '0003_auto_20230214_2010'),
]

operations = [
migrations.CreateModel(
name='Position',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=255)),
('create_date', models.DateTimeField(blank=True, null=True)),
('edit_date', models.DateTimeField(blank=True, null=True)),
],
),
migrations.AddField(
model_name='hunter',
name='brief',
field=models.FileField(blank=True, help_text='Document Upload', upload_to=''),
),
migrations.AddField(
model_name='hunter',
name='certification',
field=models.TextField(blank=True, help_text='Certifications required if any'),
),
migrations.AlterField(
model_name='hunter',
name='position_title',
field=models.ForeignKey(blank=True, help_text='Title, (CTO, Front End, Back End etc.)', on_delete=django.db.models.deletion.CASCADE, to='hunters.position'),
),
]
25 changes: 24 additions & 1 deletion hunters/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,37 @@ class Status(Enum):
(Status.CANCELED.value, 'CANCELED'),
)

class Position(models.Model):
name = models.CharField(max_length=255, blank=True)
create_date = models.DateTimeField(null=True, blank=True)
edit_date = models.DateTimeField(null=True, blank=True)

def __str__(self):
return self.name

def save(self, *args, **kwargs):
# onsave add create date or update edit date
if self.create_date == None:
self.create_date = timezone.now()
self.edit_date = timezone.now()
super(Position, self).save(*args, **kwargs)


class PositionAdmin(admin.ModelAdmin):
list_display = ('name','create_date','edit_date')
search_fields = ('name',)
list_filter = ('name',)
display = 'Positions'

class Hunter(models.Model):
name = models.CharField(max_length=255, blank=True, help_text="Name your hunt, i.e. The Search for Ops Commander")
position_title = models.CharField(max_length=255, blank=True, help_text="Title, (CTO, Front End, Back End etc.)")
position_title = models.ForeignKey(Position, blank=True, on_delete=models.CASCADE, help_text="Title, (CTO, Front End, Back End etc.)")
position_pay = models.CharField(max_length=255, blank=True, help_text="Pay Range")
skills = models.CharField(max_length=255, blank=True, help_text="Top Skills")
level = models.CharField(max_length=255, blank=True, choices=LEVEL_CHOICES, help_text="Skill level - Select One")
description = models.TextField(blank=True, help_text="Describe in detail the type of person you are looking for")
certification = models.TextField(blank=True, help_text="Certifications required if any")
brief = models.FileField(blank=True, help_text="Document Upload")
owner = models.ForeignKey('auth.User',blank=True, null=True, on_delete=models.CASCADE)
url = models.CharField(max_length=255, null=True, blank=True, help_text="Your GitHub Profile URL")
linkedin_url = models.CharField(max_length=255, null=True, blank=True, help_text="Your LinkedIn Profile URL")
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings.production")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings.dev")

from django.core.management import execute_from_command_line

Expand Down
6 changes: 4 additions & 2 deletions mysite/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
'django_celery_beat',
'hunters',

'storages',

# forms
'colorful',
'crispy_forms',
Expand Down Expand Up @@ -180,7 +182,7 @@
MEDIA_URL = '/media/'

# e.g. in notification emails. Don't include '/admin' or a trailing slash
BASE_URL = 'https://health.open.build'
BASE_URL = 'https://devhunter.io'

LOGIN_REDIRECT_URL = '/'

Expand All @@ -192,7 +194,7 @@

CRISPY_TEMPLATE_PACK = "bootstrap5"

PAYPAL_RECEIVER_EMAIL = "[email protected]"
PAYPAL_RECEIVER_EMAIL = "[email protected]"
PAYPAL_TEST = True

SITE_ID = 1
Expand Down
42 changes: 21 additions & 21 deletions mysite/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

DEBUG = True

ALLOWED_HOSTS = ['lionfish-app-ufv5e.ondigitalocean.app', 'open.build', '127.0.0.1', '[::1]','devhunter.io','www.devhunter.io']
ALLOWED_HOSTS = ['lionfish-app-ufv5e.ondigitalocean.app', '127.0.0.1', '[::1]','devhunter.io','www.devhunter.io']

try:
from .local import *
Expand Down Expand Up @@ -45,30 +45,30 @@
# something more human-readable.
# release="[email protected]",
)
CELERY_BEAT_SCHEDULE = {
# 'create_iclp_sensor_report': {
# 'task': 'sensor.services.tasks.create_iclp_sensor_report',
# # execute every 15 minute with offset of 2
# 'schedule': crontab(minute='02,17,32,47'),
# },
'check_sites': {
'task': 'monitorsites.tasks.my_scheduled_job',
# execute every 10 minute with offset of 2
'schedule': crontab(minute='03,13,23,33,43,53'),
}
}

CELERY_BROKER_URL = os.getenv('CELERY_BROKER_URL', "locahost:6379")
#: Only add pickle to this list if your broker is secured
#: from unwanted access (see userguide/security.html)
CELERY_ACCEPT_CONTENT = ['json']
CELERY_RESULT_BACKEND = 'db+sqlite:///results.sqlite'
CELERY_TASK_SERIALIZER = 'json'

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" # new
DEFAULT_FROM_EMAIL = "help@open.build"
DEFAULT_FROM_EMAIL = "help@devhunter.io"
EMAIL_HOST = "smtp.sendgrid.net" # new
EMAIL_HOST_USER = "apikey" # new
EMAIL_HOST_PASSWORD = os.environ.get("SENDGRID_PASSWORD") # new
EMAIL_PORT = 587 # new
EMAIL_USE_TLS = True # new

AWS_STORAGE_BUCKET_NAME = 'devhunter'
AWS_ACCESS_KEY_ID = 'DO00MW9V6QPPJKVCGHYA'
AWS_SECRET_ACCESS_KEY = os.environ.get("SPACES_SECRET")
AWS_S3_CUSTOM_DOMAIN = 'cms-static.nyc3.digitaloceanspaces.com' + "/" + AWS_STORAGE_BUCKET_NAME
AWS_S3_ENDPOINT_URL = 'https://cms-static.nyc3.digitaloceanspaces.com'


MEDIA_URL = AWS_S3_CUSTOM_DOMAIN + "/" + AWS_STORAGE_BUCKET_NAME + "/"
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

AWS_LOCATION = 'static'
STATIC_URL = f'https://{AWS_S3_ENDPOINT_URL}/{AWS_STORAGE_BUCKET_NAME}/{AWS_LOCATION}/'
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage'

AWS_DEFAULT_ACL = 'public-read'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ celery
redis
django-celery-beat
django-bootstrap-modal-forms
crispy-bootstrap5
crispy-bootstrap5
django-storages
boto3

0 comments on commit bf6eb46

Please sign in to comment.