Form not valid error

2019-05-08 Thread Dimple Mathew
I am trying to pass data from a form to view, but form is not valid.

I have 3 drop-downs on this form on clicking on submit, if any relavant 
data is available in the database it should be loaded on the template. 
Basically this form is a set of filters that load data based on selection.

views.py

def mentioe(request):
emp_dd= request.user.username
flag=0if request.method == 'POST':
form = Management_Collector(request.POST or None)
if form.is_valid():
m_s = form.cleaned_data.get('month_start')
m_e = form.cleaned_data.get('month_end')
y = form.cleaned_data.get('process_select')

mentione= mrg_bpo.objects.filter(Q(emp_id=emp_dd) & Q(month=m_s))

if not mentione:
messages.error(request, 'Data is not available for your selection 
please consider re-selecting.')
else:
messages.success(request, 'Search Result Displayed Below')
return render(request, 'mentione.html', {'form': form, 'mentione': 
mentione})
else:
print(form.errors)
print('some issue')

else:
print('i go to else')
form = Management_Collector()return render(request, 'mentione.html', 
{'form': form})

forms.py class Management_Collector(forms.ModelForm):

class Meta:
model = mrg_bpo
fields = ['month','year','process_select']
labels = {
"month": _(""),
}
widget = {
'month':forms.HiddenInput(),
'year':forms.HiddenInput(),
}

index.html



{%csrf_token%}

  {% for i in form.month %}{{ i }}
{% endfor %}

 

 {% for i in form.month %}{{ i }}
{% endfor %}
 

{{form.year}}
{{form.process_select}}
 Submit

I want to get the value of all the drop downs in my view

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/cb4599dd-d98f-4331-b7ae-56be77acb335%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ERROR: The included URLConf 'website.urls' does not appear to have patterns in it. If u see valid patterns in the file then there is issue of Circular import.

2019-05-27 Thread Dimple Mathew
Hey update the code to this:

urlpatterns = [
url('^$', views.index, name=index),
]

this will tell the start and end of url.

On Monday, May 27, 2019 at 8:17:47 PM UTC+5:30, Madhur Kabra wrote:
>
> I am getting the url conf error, I  have attached the relevant files.
> Thanks for the assistance
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/829b1875-ce9a-4e0d-b886-e32b647544d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ERROR: The included URLConf 'website.urls' does not appear to have patterns in it. If u see valid patterns in the file then there is issue of Circular import.

2019-05-27 Thread Dimple Mathew
and also in import for include change it to

from django.conf.urls import url,include


On Monday, May 27, 2019 at 8:17:47 PM UTC+5:30, Madhur Kabra wrote:
>
> I am getting the url conf error, I  have attached the relevant files.
> Thanks for the assistance
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e185e13d-4c29-4bef-b18c-510a42f527ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.