Changes between Initial Version and Version 1 of Ticket #34329


Ignore:
Timestamp:
Feb 10, 2023, 1:14:07 AM (20 months ago)
Author:
Sasikumar K
Comment:

form.py

class OfficedetForm(forms.ModelForm):

office_logo = fields.FileField(

label="Office Logo", widget=UploadedFileInput, required=True,

)

office_gender_type = forms.ModelChoiceField(

queryset=OFFICE_GENDER_TYPE_CHOICE.objects.all(), widget=Selectize(

placeholder="Choose Gender",

),

)

office_mgnt_type = forms.ModelChoiceField(

queryset=OFFICE_MGNT_TYPE_CHOICE.objects.all(), widget=Selectize(

placeholder="Choose Management",

),

)

office_class_level = forms.ModelChoiceField(

queryset=OfficeClassLevel.objects.all(), widget=Selectize(

placeholder="Choose Class Level",

),

)

office_place = forms.ModelChoiceField(

queryset=Places.objects.all(), widget=Selectize(

search_lookup='placenameicontains', placeholder="Choose Place",

),

)

office_type = forms.ChoiceField(

choices=[ ('SCHOOL','SCHOOL'), ('ADMIN','ADMIN'),], widget=Selectize,

)

default_renderer = FormRenderer(

form_css_classes='row', field_css_classes={

'*': 'mb-2 col-12', "office_code": 'mb-2 col-2', "office_name": 'mb-2 col-4', "office_mail": 'mb-2 col-3', "office_place": 'mb-2 col-3',

'*': 'mb-2 col-12',

"office_gender_type": 'mb-2 col-3', "office_mgnt_type": 'mb-2 col-3', "office_class_level": 'mb-2 col-3', "office_type": 'mb-2 col-3',

'*': 'mb-2 col-12',

"office_tanno": 'mb-2 col-4', "office_udisecode": 'mb-2 col-4', "office_logo": 'mb-2 col-4',

} )

class Meta:

model = Officedet fields = ["office_code",

"office_name", "office_mail", "office_place", "office_gender_type", "office_mgnt_type", "office_class_level", "office_type", 'office_tanno', 'office_udisecode', "office_logo", ]

views.py

class OfficeDetailCreateView(AdminUserTypeAuthMixin,FileUploadMixin, FormViewMixin, LoginRequiredMixin, CreateView):

model = Officedet template_name = 'home/crud/crud_template.html' form_class = OfficedetForm success_url = reverse_lazy('office_list_view') # or whatever makes sense extra_context = {

'pagetitle':'Office Creation' }

page.html

{% extends "layouts/masterpage-formset.html" %} {% block pagecontent %} {% load render_form from formsetify %} <django-formset endpoint="{{ request.path }}" csrf-token="{{ csrf_token }}">

{% render_form form %}

<div class="{{ button_css_classes }}">

<button type="button" click="disable -> confirm('Do want to Submit ?') -> spinner -> submit -> okay(500) -> proceed" auto-disable="{{ auto_disable|yesno:'true,false' }}" class="btn btn-primary">Submit<span class="ms-2 dj-button-decorator"><i class="bi bi-send"></i></span></button> <button type="button" click="reset" class="ms-2 btn btn-warning">Reset</button> <button click="proceed('/office_list_view/')" class="btn btn-info">Back to list</button>

</div> </django-formset> {% endblock pagecontent %}

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34329

    • Property Needs documentation set
  • Ticket #34329 – Description

    initial v1  
    11I am new to django . while i am trying to use django-formset third party app in my form modelchoice control change event  show the error -  Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data - i have spent 6 hours i could not fix the error.
     2
Back to Top