diff --git a/hunters/admin.py b/hunters/admin.py index ad950fe..b788ac5 100644 --- a/hunters/admin.py +++ b/hunters/admin.py @@ -3,3 +3,4 @@ admin.site.register(Hunter, HunterAdmin) admin.site.register(HunterEntry, HunterEntryAdmin) +admin.site.register(Position, PositionAdmin) diff --git a/hunters/forms.py b/hunters/forms.py index 48c0ad6..410ea28 100644 --- a/hunters/forms.py +++ b/hunters/forms.py @@ -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'] @@ -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', ), ), diff --git a/hunters/migrations/0004_auto_20230222_1643.py b/hunters/migrations/0004_auto_20230222_1643.py new file mode 100644 index 0000000..7635e02 --- /dev/null +++ b/hunters/migrations/0004_auto_20230222_1643.py @@ -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'), + ), + ] diff --git a/hunters/models.py b/hunters/models.py index 6467968..63df167 100644 --- a/hunters/models.py +++ b/hunters/models.py @@ -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") diff --git a/manage.py b/manage.py index 879fee5..dcc190b 100755 --- a/manage.py +++ b/manage.py @@ -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 diff --git a/mysite/settings/base.py b/mysite/settings/base.py index 38a4990..e1fa5c7 100644 --- a/mysite/settings/base.py +++ b/mysite/settings/base.py @@ -38,6 +38,8 @@ 'django_celery_beat', 'hunters', + 'storages', + # forms 'colorful', 'crispy_forms', @@ -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 = '/' @@ -192,7 +194,7 @@ CRISPY_TEMPLATE_PACK = "bootstrap5" -PAYPAL_RECEIVER_EMAIL = "team@open.build" +PAYPAL_RECEIVER_EMAIL = "info@devhunter.io" PAYPAL_TEST = True SITE_ID = 1 diff --git a/mysite/settings/production.py b/mysite/settings/production.py index a6d0b17..5db8aa4 100644 --- a/mysite/settings/production.py +++ b/mysite/settings/production.py @@ -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 * @@ -45,30 +45,30 @@ # something more human-readable. # release="myapp@1.0.0", ) -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 diff --git a/requirements.txt b/requirements.txt index 8ec9fc2..4bc6699 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,6 @@ celery redis django-celery-beat django-bootstrap-modal-forms -crispy-bootstrap5 \ No newline at end of file +crispy-bootstrap5 +django-storages +boto3 \ No newline at end of file