def __init__(self, *args, **kwargs): if 'action' in kwargs: action = kwargs.pop("action") else: action = '' super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = True self.helper.form_action = action self.helper.attrs = {"data-form": "nominal"} self.helper.layout = Layout( Div(Div(LabelAndFieldAndErrors('parent', css_class="w-100 form-control"), css_class="mt-2"), Div(LabelAndFieldAndErrors('name', css_class="w-100 form-control"), css_class="mt-2"), css_class="modal-body"), Div(HTML( '<a href="{% url \"nominals:nominals_list\" %}" role="button" class="btn btn-secondary cancel" data-dismiss="modal">Cancel</a>' ), HTML( '<button type="submit" class="btn btn-success">Save</button>' ), css_class="modal-footer"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) """ You cannot post into a period in a FY which has been finalised. """ t = NominalTransaction.objects.filter(module="NL").filter( type="nbf").values("period__fy_and_period").order_by( "-period__fy_and_period") w = When(Exists(t), then=t[:1]) q = (Period.objects.filter(fy_and_period__gte=(Period.objects.annotate( earliest_period=(Case(w, default=Value("000000")) )).values('earliest_period')[:1]))) for field in self.fields: q = q.all() self.fields[field].queryset = q self.helper = FormHelper() self.helper.layout = Layout( HTML("<h1 class='font-weight-bold h5'>Module Settings</h1>", ), Div(Div(LabelAndFieldAndErrors('cash_book_period', css_class="w-100"), css_class="my-1 col-12"), Div(LabelAndFieldAndErrors('nominals_period', css_class="w-100"), css_class="my-1 col-12"), Div(LabelAndFieldAndErrors('purchases_period', css_class="w-100"), css_class="my-1 col-12"), Div(LabelAndFieldAndErrors('sales_period', css_class="w-100"), css_class="my-1 col-12"), css_class="row"), Submit("save", "Save", css_class="mt-3"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_class = "form-signup w-100 m-0 p-0" self.helper.layout = Layout( Div(LabelAndFieldAndErrors('username', css_class="form-control"), css_class="w-100 mb-3"), Div(LabelAndFieldAndErrors('password', css_class="form-control"), css_class="mb-3"), Div( HTML( '<button class="btn btn-lg btn-success btn-block" type="submit">Sign In</button>' )))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = "GET" self.helper.layout = Layout( Div(Div(LabelAndFieldAndErrors( "from_period", css_class="form-control form-control-sm"), css_class="col-2"), Div(LabelAndFieldAndErrors( "to_period", css_class="form-control form-control-sm"), css_class="col-2"), css_class="row"), Div(HTML("<button class='btn btn-primary'>Report</button>"), css_class="text-right mt-3"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_class = "form-signup" self.helper.layout = Layout( HTML("<h1 class='mb-4 h3 font-weight-bold'>Accounts</h1>"), Div(LabelAndFieldAndErrors('username', css_class="form-control"), css_class="mb-3"), Div(LabelAndFieldAndErrors('password1', css_class="form-control"), css_class="mb-3"), Div(LabelAndFieldAndErrors('password2', css_class="form-control"), css_class="mb-3"), Div( HTML( '<button class="btn btn-lg btn-primary btn-block" type="submit">Sign Up</button>' )))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( 'financial_year', Div(Submit("rollback", "Rollback", css_class='btn-success'), css_class="mt-3 text-right"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["permissions"].queryset = UI_PERMISSIONS()() self.helper = FormHelper() self.helper.form_tag = False self.helper.layout = Layout( Div(LabelAndFieldAndErrors('name', css_class="form-control w-100")))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = "GET" self.helper.include_media = False self.helper.layout = Layout( Div(*create_transaction_enquiry_time_fields(), Field('use_adv_search', type="hidden"), css_class="form-row"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Div(HTML( "<button type='button' disabled class='btn btn-block btn-primary auto-fill-btn'>Auto Fill</button>" "<button class='btn btn-primary add-period-btn btn-block'>Add Period</button>" ), css_class="mb-2"), Div(FYInputGroup( PlainField('financial_year', css_class="form-control fy")), TableFormset([{ "label": "", "css_class": "d-none" }, "Period", ""], "periods"), css_class="border-bottom"), Div(Submit('Save', 'Create FY', css_class="btn btn-success btn-block"), css_class="mt-2 d-flex justify-content-between"), )
def __init__(self, *args, **kwargs): if 'action' in kwargs: action = kwargs.pop("action") else: action = '' super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = True self.helper.form_action = action self.helper.attrs = {"data-form": "vat"} self.helper.layout = Layout( Div(Div(LabelAndFieldAndErrors('code', css_class="form-control w-100"), css_class="mt-2"), Div(LabelAndFieldAndErrors('name', css_class="form-control w-100"), css_class="mt-2"), Div(LabelAndFieldAndErrors('rate', css_class="form-control w-100"), css_class="mt-2"), Div(LabelAndFieldAndErrors('registered'), css_class="mt-3"), css_class="modal-body"), Div(HTML( '<a href="{% url \'vat:vat_list\' %}" role="button" class="btn btn-secondary cancel">Cancel</a>' '<button type="submit" class="btn btn-success">Save</button>'), css_class="modal-footer"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) q = self.fields["financial_year"].queryset _q = q.all() if _q: fy = _q[0] self.initial["financial_year"] = fy else: django_engine = engines["django"] help_text_template = django_engine.from_string( "<p class='font-weight-bold text-danger'>You do not have any financial years yet ... <a href='{% url 'controls:fy_create' %}'>Create FY</a></p>" ) self.fields[ "financial_year"].help_text = help_text_template.render() self.fields["financial_year"].disabled = True self.helper = FormHelper() self.helper.layout = Layout( 'financial_year', Div(Submit("finalise", "Finalise", css_class='btn-success'), css_class="mt-3 text-right"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["user_permissions"].queryset = UI_PERMISSIONS()() self.helper = FormHelper() self.helper.form_tag = False self.helper.layout = Layout( Div(HTML( "<small><span class='font-weight-bold'>Last logged in:</span> {{ user.last_login }}</small>" ), css_class="my-3"), Div(Div(LabelAndFieldAndErrors('username', css_class="form-control"), css_class="col-6"), css_class="form-row form-group"), Div(Div(LabelAndFieldAndErrors('first_name', css_class="form-control"), css_class="col-6"), Div(LabelAndFieldAndErrors('last_name', css_class="form-control"), css_class="col-6"), css_class="form-row form-group"), Div(Div(LabelAndFieldAndErrors('email', css_class="form-control"), css_class="col-12"), css_class="form-row form-group"), Div(Div(LabelAndFieldAndErrors('password', css_class="form-control"), css_class="col-6"), Div(LabelAndFieldAndErrors('password2', css_class="form-control"), css_class="col-6"), css_class="form-row form-group"), Div(LabelAndFieldAndErrors('groups')), Div(HTML( "<a class='btn btn-secondary mr-2' href='{% url 'controls:users' %}'>Cancel</a>" ), Submit('Save', 'Save', css_class="btn btn-success"), css_class="d-flex justify-content-end"), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Div(Div(Div( HTML( '<img src="http://ssl.gstatic.com/accounts/ui/avatar_2x.png" class="avatar img-circle img-thumbnail" alt="avatar">' ), HTML('<h6 class="my-2">Upload a different photo...</h6>'), HTML( '<input type="file" class="small text-center center-block file-upload">' ), ), css_class="col-3"), css_class="row no-gutters"), Div(Div( Div(Div(LabelAndFieldAndErrors('username', css_class="form-control w-100"), css_class="form-group col-md-6"), css_class="form-row"), Div(Div(LabelAndFieldAndErrors('first_name', css_class="form-control w-100"), css_class="form-group col-md-6"), Div(LabelAndFieldAndErrors('last_name', css_class="form-control w-100"), css_class="form-group col-md-6"), css_class="form-row"), Div(Div( LabelAndFieldAndErrors('email', css_class="form-control w-100"), ), css_class="mb-2"), Div(Div(LabelAndFieldAndErrors('password', css_class="form-control w-100"), css_class="form-group col-md-6"), Div(LabelAndFieldAndErrors('password2', css_class="form-control w-100"), css_class="form-group col-md-6"), css_class="form-row"), Div(HTML( "<a class='btn btn-secondary mr-2' href='{% url 'dashboard:dashboard' %}'>Cancel</a>" ), Submit('Save', 'Save', css_class="btn btn-success"), css_class="d-flex justify-content-end"), css_class="col"), css_class="mt-4 row no-gutters"), )