Skip to content

Commit

Permalink
Removed fields as requested by POD
Browse files Browse the repository at this point in the history
  • Loading branch information
ziafazal committed Jan 15, 2019
1 parent 8888b07 commit 00a70f3
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 17 deletions.
12 changes: 11 additions & 1 deletion freshgrad_test/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@ def user_full_name_view(self, obj):
def export_as_csv(self, request, queryset):

meta = self.model._meta
excluded_fields = ['id', 'user']
excluded_fields = [
'id',
'user',
'interested_in_python',
'interested_in_scrappy',
'interested_in_andriod',
'interested_in_ios',
'interested_in_php',
'interested_in_javascript',
'interested_in_machine_learning',
]
model_field_names = [field.name for field in meta.fields if field.name not in excluded_fields]

addl_field_names = ['email', 'name']
Expand Down
36 changes: 22 additions & 14 deletions freshgrad_test/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from django import forms
from django.core.validators import RegexValidator
from django.utils.translation import gettext_lazy as _

from .models import CandidateInfo
Expand All @@ -12,24 +13,28 @@ class CandidateInfoForm(forms.ModelForm):
"""
Form to gather additional info of candidate
"""
# Have to define these fields in the form to avoid these fields being displayed
# in optional fields at the bottom of registration form
YES_NO = (
('', ''),
(0, 'No'),
(1, 'Yes'),
cnic_number = forms.CharField(
label=_("CNIC Number"),
validators=[
RegexValidator(
regex=r'[0-9]{5}-[0-9]{7}-[0-9]{1}',
message="CNIC Number is not valid. CNIC number format should be 00000-0000000-0."
)
]
)
interested_in_python = forms.ChoiceField(label=_("Interested in Python/Django"), choices=YES_NO)
interested_in_scrappy = forms.ChoiceField(label=_("Interested in Scrappy"), choices=YES_NO)
interested_in_andriod = forms.ChoiceField(label=_("Interested in Android"), choices=YES_NO)
interested_in_ios = forms.ChoiceField(label=_("Interested in iOS"), choices=YES_NO)
interested_in_php = forms.ChoiceField(label=_("Interested in PHP"), choices=YES_NO)
interested_in_javascript = forms.ChoiceField(label=_("Interested in Javascript/ReactJS"), choices=YES_NO)
interested_in_machine_learning = forms.ChoiceField(label=_("Interested in Machine Learning"), choices=YES_NO)

class Meta(object):
model = CandidateInfo
exclude = ('user', )
exclude = (
'user',
'interested_in_python',
'interested_in_scrappy',
'interested_in_andriod',
'interested_in_ios',
'interested_in_php',
'interested_in_javascript',
'interested_in_machine_learning',
)
serialization_options = {
'university_projects': {
'field_type': 'textarea',
Expand Down Expand Up @@ -58,5 +63,8 @@ class Meta(object):
'references': {
'field_type': 'textarea',
},
'other_technologies': {
'field_type': 'textarea',
}

}
20 changes: 20 additions & 0 deletions freshgrad_test/migrations/0002_auto_20190115_0802.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-15 13:02
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('freshgrad_test', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='candidateinfo',
name='other_technologies',
field=models.TextField(verbose_name='Which technologies are you interested to work in? (Python/Django, Scrapy, Android, iOS, PHP, Javascript/ReactJS, Machine Learning)'),
),
]
5 changes: 3 additions & 2 deletions freshgrad_test/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ class CandidateInfo(models.Model):
# technologies_interested = models.ManyToManyField(
# Technology, verbose_name=_("Choose the technologies you are interested to work on/learn")
# )
other_technologies = models.CharField(
max_length=255, verbose_name=_("Any other technologies your are interested in?")
other_technologies = models.TextField(
verbose_name=_("Which technologies are you interested to work in? (Python/Django, Scrapy, Android, iOS, "
"PHP, Javascript/ReactJS, Machine Learning)")
)
university_projects = models.TextField(verbose_name=_("Tell us something about your university project(s)"))
extra_activities = models.TextField(
Expand Down

0 comments on commit 00a70f3

Please sign in to comment.