Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marlboro Blend No. 27 committed Apr 3, 2020
2 parents a4a4b65 + 065256c commit f528729
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 2 deletions.
24 changes: 23 additions & 1 deletion src/data_hub/contact/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
DataHubContact,
DataHubOrder,
DataHubOutsideEntityContact,
EducationContact,
EmailTemplate,
ForumJobBoardSubmission,
GeneralContact,
Expand Down Expand Up @@ -115,6 +116,28 @@ def get_readonly_fields(self, request, obj=None):
return self.readonly_fields


@admin.register(EducationContact)
class EducationContactAdmin(admin.ModelAdmin, ExportSelectedToCsvMixin):
model = EducationContact
actions = ["export_selected_to_csv"]
list_display = (
'name',
'email',
'phone',
'address',
'organization',
'industry',
'question_or_comments',
'created'
)
ordering = ('-created',)

def get_readonly_fields(self, request, obj=None):
if obj:
self.readonly_fields = [field.name for field in obj.__class__._meta.fields]
return self.readonly_fields


@admin.register(EmailTemplate)
class EmailTemplateAdmin(admin.ModelAdmin):
model = EmailTemplate
Expand Down Expand Up @@ -165,7 +188,6 @@ class GeneralContactAdmin(admin.ModelAdmin, ExportSelectedToCsvMixin):
'organization',
'industry',
'question_or_comments',
'created',
'created'
)
ordering = ('-created',)
Expand Down
35 changes: 35 additions & 0 deletions src/data_hub/contact/migrations/0035_educationcontact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 2.0.13 on 2020-04-03 18:51

from django.db import migrations, models
import uuid


class Migration(migrations.Migration):

dependencies = [
('contact', '0034_remove_texasimageryservicerequest_comment'),
]

operations = [
migrations.CreateModel(
name='EducationContact',
fields=[
('education_contact_id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='Education Contact ID')),
('question_or_comments', models.TextField(verbose_name='Question or Comment')),
('name', models.CharField(max_length=150, verbose_name='Name')),
('email', models.CharField(max_length=150, verbose_name='Email')),
('phone', models.CharField(blank=True, max_length=20, null=True, verbose_name='Phone')),
('address', models.CharField(blank=True, max_length=150, null=True, verbose_name='Address')),
('organization', models.CharField(blank=True, max_length=100, null=True, verbose_name='Organization')),
('industry', models.CharField(blank=True, max_length=50, null=True, verbose_name='Industry')),
('industry_other', models.CharField(blank=True, max_length=50, null=True, verbose_name='Industry (Other)')),
('created', models.DateTimeField(auto_now_add=True, verbose_name='Created')),
('last_modified', models.DateTimeField(auto_now=True, verbose_name='Last Modified')),
],
options={
'verbose_name': 'Education Question or Comment',
'verbose_name_plural': 'Education Questions or Comments',
'db_table': 'contact_education',
},
),
]
77 changes: 77 additions & 0 deletions src/data_hub/contact/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,83 @@ def __str__(self):
return self.name + " " + self.created.strftime('%Y-%m-%d %H:%M')


class EducationContact(models.Model):
"""
Education page Contact form on tnris.org
https://tnris.org/education/
"""

class Meta:
db_table = 'contact_education'
verbose_name = 'Education Question or Comment'
verbose_name_plural = 'Education Questions or Comments'

education_contact_id = models.UUIDField(
'Education Contact ID',
primary_key=True,
default=uuid.uuid4,
editable=False
)
question_or_comments = models.TextField(
'Question or Comment',
null=False,
blank=False
)
name = models.CharField(
'Name',
max_length=150,
null=False,
blank=False
)
email = models.CharField(
'Email',
max_length=150,
null=False,
blank=False
)
phone = models.CharField(
'Phone',
max_length=20,
null=True,
blank=True
)
address = models.CharField(
'Address',
max_length=150,
null=True,
blank=True
)
organization = models.CharField(
'Organization',
max_length=100,
null=True,
blank=True
)
industry = models.CharField(
'Industry',
max_length=50,
null=True,
blank=True
)
industry_other = models.CharField(
'Industry (Other)',
max_length=50,
null=True,
blank=True
)
created = models.DateTimeField(
'Created',
auto_now_add=True
)
last_modified = models.DateTimeField(
'Last Modified',
auto_now=True
)

def __str__(self):
return self.name + " " + self.created.strftime('%Y-%m-%d %H:%M')


class ForumJobBoardSubmission(models.Model):
"""
Forum job board submission form on tnris.org forum pages
Expand Down
7 changes: 7 additions & 0 deletions src/data_hub/contact/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
DataHubContact,
DataHubOrder,
DataHubOutsideEntityContact,
EducationContact,
ForumJobBoardSubmission,
GeneralContact,
GeorodeoCallForPresentationsSubmission,
Expand Down Expand Up @@ -33,6 +34,12 @@ class Meta:
model = DataHubOutsideEntityContact
fields = ('__all__')


class EducationContactSerializer(serializers.ModelSerializer):
class Meta:
model = EducationContact
fields = ('__all__')


class ForumJobBoardSubmissionSerializer(serializers.ModelSerializer):
class Meta:
Expand Down
1 change: 1 addition & 0 deletions src/data_hub/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def init_with_context(self, context):
models=('contact.models.DataHubContact',
'contact.models.DataHubOrder',
'contact.models.DataHubOutsideEntityContact',
'contact.models.EducationContact',
'contact.models.EmailTemplate',
'contact.models.ForumJobBoardSubmission',
'contact.models.GeneralContact',
Expand Down
2 changes: 1 addition & 1 deletion src/data_hub/lore/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_queryset(self):

class MapserverViewSet(viewsets.ViewSet):
"""
Retrieve TNRIS historical collection server information
Retrieve TNRIS mapserver instance mapfiles list from S3 content objects
"""
permission_classes = (AllowAny,)

Expand Down

0 comments on commit f528729

Please sign in to comment.