Name: isfilled
Owner: Futurice
Description: null
Created: 2016-03-03 11:32:48.0
Updated: 2016-03-03 11:34:08.0
Pushed: 2016-03-05 18:42:53.0
Homepage: null
Size: 20
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Create rules for Models and ModelForms filledness.
Models validate while ModelForms present use-cases. Fills give insight on Model/ModelForm fields.
People are interested in different details. Create rules to accomodate each. Best used together with On Condition to send notifications on fill completions.
Create a Model, which inherits FillsMixin
. If you have a ModelForm, then adding a Fills checks the fields of the Form instead of the Model.
s Employee(models.Model, FillsMixin):
name = models.CharField(max_length=255)
expert_in = models.CharField(max_length=255, blank=True, null=True)
starting_date = models.DateField(blank=True, null=True)
editor_of_choice = models.CharField(max_length=255, blank=True, null=True)
github_account = models.CharField(max_length=255, blank=True, null=True)
s EmployeeForm(forms.ModelForm):
class Meta:
model = Employee
exclude = []
s EmployeeSkillsForm(forms.ModelForm):
class Meta:
model = Employee
fields = ['expert_in', 'editor_of_choice',]
s EmployeeFills(Filled):
form = EmployeeForm
s EmployeeSkillsFills(Filled):
form = EmployeeSkillsForm
Create Fills against Model:
.objects.create(name="employee-hr",
model="test.Employee",)
.objects.create(name="employee-manager-bob",
model="test.Employee",
fields="starting_date, expert_in",)
Create Fills against ModelForm:
.objects.create(name="employee-hr",
fill="test.test_fills.EmployeeFills",)
.objects.create(name="employee-team",
fill="test.test_fills.EmployeeSkillsFills",)
Filledness status:
ance = Employee.objects.get(pk=1))
fills_filled, contexts = instance.check_fills()