'WSGIRequest' object has no attribute 'get'

2021-11-22 Thread Trippy Samurai
Getting error while working with template view

views.py 


class DeveloperTicketView(TemplateView):

def get_template_names(self):
if self.request.get('status') == 'Opened':
template_name = 'app/open_tickets.html'
elif self.request.get('status') == 'Accepted':
template_name = 'app/dev_accepted_tickets'
elif self.request.get('status') == "Completed":
template_name = 'app/dev_completed_tickets.html'
else:
template_name = 'app/dev_closed_tickets.html'

return template_name


def get_context_data(self, **kwargs):
context = super(DeveloperTicketView,self).get_context_data(**kwargs)
context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
context['accepted_tickets'] = Ticket.objects.filter(status = 
'Accepted',accepted_by = self.request.user)
context['completed_tickets'] = Ticket.objects.filter(status = 
'Completed',accepted_by = self.request.user)
context['closed_tickets'] = Ticket.objects.filter(status = 
'Closed',accepted_by = self.request.user)
return context

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/65cd3d84-5946-43d6-8abc-c78e4246fb07n%40googlegroups.com.


Re: learn django

2021-11-22 Thread Kasper Laudrup

On 21/11/2021 06.57, Shahin Salim wrote:
iam shahin salim .iam a student.now iam lerning python.but iam confused 
with it.they give me this task.idont know were to sart.what i want to do 
for learn and also do this task.




I think you start with step one: "Have a clear idea about View Engine 
and its working". Have you done that?


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/641e5b4b-20a0-3c3a-a6da-25cd057b3d87%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Multiple Templates in single list view

2021-11-22 Thread Trippy Samurai
Its done bro model is configured already i didn't just posted the models.py 
file

On Monday, 22 November 2021 at 21:18:12 UTC+5:30 ram.asf...@gmail.com wrote:

> will update asap
>
> On Mon, Nov 22, 2021 at 1:22 PM David Nugent  wrote:
>
>> Well, there are several ways you can deal with that.
>>
>> Probably easiest is to override get_template() and switch the template 
>> based on whatever type of ticket you're managing or you can change the 
>> value of self.template_name based on the request.
>>
>> Or maybe you prefer a single template to deal with all cases with 
>> conditional blocks where appropriate.
>>
>>
>> Regards,
>> David
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAE5VhgUCCnmkm%2BBe0EWLK4Nb%3DXUOHZAEYGax%2B2%2B-kCysYxdzHA%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8a2eadcf-5733-439b-b763-4eb70db91429n%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-22 Thread ram s
i think u forgot to configure model, please once configure and complete
check first

On Mon, Nov 22, 2021 at 4:36 PM Trippy Samurai 
wrote:

> Thanks David for the idea i appreciate it i have gone with last way of
> doing things but it doesnt render anything on data
>
> Pls correct my code below
>
>
>
> *views.py:*
>
> class DeveloperTicketView(TemplateView):
> template_name = 'app/ticket_view.html'
> ticket = Ticket.objects.all()
> extra_content = {'ticket_type':ticket}
>
> def get_context_data(self, **kwargs):
> context = super().get_context_data(**kwargs)
> context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
> context['accepted_tickets'] = Ticket.objects.filter(status =
> 'Accepted',accepted_by = self.request.user)
> context['completed_tickets'] = Ticket.objects.filter(status =
> 'Completed',accepted_by = self.request.user)
> context['closed_tickets'] = Ticket.objects.filter(status =
> 'Closed',accepted_by = self.request.user)
> return context
>
>
>
> ticket_view.html
>
> {% extends 'app/base.html' %}
>
> {% block body %}
> {% for tickets in ticket_type%}
> {% if tickets.status == "Opened" %}
> 
> 
> 
> ID
> Status
> Created
> Title
> Description
> 
> 
> 
> {% for ticket in open_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
>  Accept
> 
> {% endfor %}
> 
> {% elif tickets.status == 'Accepted' %}
> 
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
> 
>
> 
> {% for ticket in accepted_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> Complete
> 
> {% endfor %}
> 
>
> {% elif tickets.status == 'Completed' %}
>
> 
>
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
> 
>
> 
> {% for ticket in completed_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> 
> {% endfor %}
> {% else %}
> 
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
> 
>
> 
> {% for ticket in closed_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> 
> {% endfor %}
> {% endif %}
> {% endfor %}
> {% endblock %}
>
>
>
>
> On Monday, 22 November 2021 at 13:22:47 UTC+5:30 David Nugent wrote:
>
>> Well, there are several ways you can deal with that.
>>
>> Probably easiest is to override get_template() and switch the template
>> based on whatever type of ticket you're managing or you can change the
>> value of self.template_name based on the request.
>>
>> Or maybe you prefer a single template to deal with all cases with
>> conditional blocks where appropriate.
>>
>>
>> Regards,
>> David
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/786fa7af-0a81-4cf7-9a2e-c2fd2e9f0323n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOGms2_ZR_rrHuANSVAAA0Ca5ow9HVzLHQDVBf%3Dz2XjBEGTmYg%40mail.gmail.com.


learn django

2021-11-22 Thread Shahin Salim
iam shahin salim .iam a student.now iam lerning python.but iam confused 
with it.they give me this task.idont know were to sart.what i want to do 
for learn and also do this task.


   1. 
   
   Have a clear idea about View Engine and its working. Complete at least 3 
   sample works using view engine concepts and bootstrap. For example, list 
   dummy items/ cards using loop or display table items etc.
   2. 
   
   Design a login and a home page. Use bootstrap & View engine.
   3. 
   
   Have a clear idea about Session and Cookies. Complete one or two sample 
   works for session management.
   4. 
   
   Complete server side development for the login page.
   1. 
  
  Login page should accept username and password from the user.
  2. 
  
  Username and password should be validated at the server side with a 
  predefined value.
  3. 
  
  If correct, give access to the home page.
  4. 
  
  If incorrect, display incorrect username or password message on the 
  login page.
  5. 
  
  Home page should contain a signout button. On click signout button - 
  redirect to login page. 
  
Note: Session handling should work properly. Signout shouldnt happen unless 
the user presses the signout button. Also, once the user has signed out, 
the home page shouldnt be loaded on pressing the back button.

  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8e308181-87de-4760-9536-492d4d9841d7n%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-22 Thread ram s
will update asap

On Mon, Nov 22, 2021 at 1:22 PM David Nugent  wrote:

> Well, there are several ways you can deal with that.
>
> Probably easiest is to override get_template() and switch the template
> based on whatever type of ticket you're managing or you can change the
> value of self.template_name based on the request.
>
> Or maybe you prefer a single template to deal with all cases with
> conditional blocks where appropriate.
>
>
> Regards,
> David
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE5VhgUCCnmkm%2BBe0EWLK4Nb%3DXUOHZAEYGax%2B2%2B-kCysYxdzHA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOGms2_2O%3DqKRqKTPcy7GNUeWEJu-tuJPfHwr93KVr91sAYHOA%40mail.gmail.com.


Re: ModelMultipleChoiceField - override validation

2021-11-22 Thread Earl Lapus
I was able to resolve this by overriding `clean()` instead of 
`to_python()`. In there, I've the set correct queryset to use for 
validation.

I still could not explain why `to_python()` is not called.

On Saturday, November 20, 2021 at 8:38:47 AM UTC+8 Earl Lapus wrote:

> Hi,
>
> I have a ModelForm that has a ModelMultipleChoiceField. In the said field, 
> I've set the queryset to none and assigned the FilteredSelectMultiple as 
> the widget for the field.
>
> It looks like this:
>
> class MyForm(forms.ModelForm):
> myfield = ModelMultipleChoiceField(
> queryset=SomeModel.objects.none(),
> widget=admin.widgets.FilteredSelectMultiple('SomeModel', False),
> required=False
> )
>
> I added some javascript on the template to dynamically add items to the 
> widget based on a value from another field. That part already works. But, I 
> am running into an error during submit - validation error. An example error 
> I get is: *"Select a valid choice. 4 is not one of the available 
> choices."  *This is expected since I've set the queryset to be empty, so 
> values will match during validation.
>
> Where should I override the validation? I tried creating a 
> ModelMultipleChoiceField child class and implemented the `to_python()` 
> method but it seems like that method is not called. Is there any 
> documentation that can help me arrive at an answer for this?
>
> Cheers,
> Earl
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fbe2b159-7d3c-4c62-946c-4f662e4cff7en%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-22 Thread Trippy Samurai
Anyone plz review my code i am struggling to figure out what the issue here 
is

On Monday, 22 November 2021 at 16:35:32 UTC+5:30 Trippy Samurai wrote:

> Thanks David for the idea i appreciate it i have gone with last way of 
> doing things but it doesnt render anything on data
>
> Pls correct my code below 
>
>
>
> *views.py:*
>
> class DeveloperTicketView(TemplateView):
> template_name = 'app/ticket_view.html'
> ticket = Ticket.objects.all()
> extra_content = {'ticket_type':ticket}
>
> def get_context_data(self, **kwargs):
> context = super().get_context_data(**kwargs)
> context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
> context['accepted_tickets'] = Ticket.objects.filter(status = 
> 'Accepted',accepted_by = self.request.user)
> context['completed_tickets'] = Ticket.objects.filter(status = 
> 'Completed',accepted_by = self.request.user)
> context['closed_tickets'] = Ticket.objects.filter(status = 
> 'Closed',accepted_by = self.request.user)
> return context
>
>
>
> ticket_view.html
>
> {% extends 'app/base.html' %}
>
> {% block body %} 
> {% for tickets in ticket_type%}
> {% if tickets.status == "Opened" %}
> 
> 
> 
> ID
> Status
> Created
> Title
> Description
> 
> 
> 
> {% for ticket in open_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
>  Accept
> 
> {% endfor %}
> 
> {% elif tickets.status == 'Accepted' %}
> 
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
>  
>
> 
> {% for ticket in accepted_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> Complete
> 
> {% endfor %}
> 
>
> {% elif tickets.status == 'Completed' %}
>
> 
>
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
>  
>
> 
> {% for ticket in completed_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> 
> {% endfor %}
> {% else %}
> 
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
> 
>
> 
> {% for ticket in closed_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> 
> {% endfor %}
> {% endif %}
> {% endfor %}
> {% endblock %}
>
>
>
>
> On Monday, 22 November 2021 at 13:22:47 UTC+5:30 David Nugent wrote:
>
>> Well, there are several ways you can deal with that.
>>
>> Probably easiest is to override get_template() and switch the template 
>> based on whatever type of ticket you're managing or you can change the 
>> value of self.template_name based on the request.
>>
>> Or maybe you prefer a single template to deal with all cases with 
>> conditional blocks where appropriate.
>>
>>
>> Regards,
>> David
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c31184b3-6ab9-4b71-a233-6b81cb5e4331n%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-22 Thread Trippy Samurai
Thanks David for the idea i appreciate it i have gone with last way of 
doing things but it doesnt render anything on data

Pls correct my code below 



*views.py:*

class DeveloperTicketView(TemplateView):
template_name = 'app/ticket_view.html'
ticket = Ticket.objects.all()
extra_content = {'ticket_type':ticket}

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
context['accepted_tickets'] = Ticket.objects.filter(status = 
'Accepted',accepted_by = self.request.user)
context['completed_tickets'] = Ticket.objects.filter(status = 
'Completed',accepted_by = self.request.user)
context['closed_tickets'] = Ticket.objects.filter(status = 
'Closed',accepted_by = self.request.user)
return context



ticket_view.html

{% extends 'app/base.html' %}

{% block body %} 
{% for tickets in ticket_type%}
{% if tickets.status == "Opened" %}



ID
Status
Created
Title
Description



{% for ticket in open_tickets %}

{{ ticket.id }}
{{ ticket.status }}
{{ ticket.created_by }}
{{ ticket.ticket_title }}
{{ ticket.ticket_description }}
 Accept

{% endfor %}

{% elif tickets.status == 'Accepted' %}



ID
Status
Created by
Title
Description

 


{% for ticket in accepted_tickets %}

{{ ticket.id }}
{{ ticket.status }}
{{ ticket.created_by }}
{{ ticket.ticket_title }}
{{ ticket.ticket_description }}
Complete

{% endfor %}


{% elif tickets.status == 'Completed' %}





ID
Status
Created by
Title
Description

 


{% for ticket in completed_tickets %}

{{ ticket.id }}
{{ ticket.status }}
{{ ticket.created_by }}
{{ ticket.ticket_title }}
{{ ticket.ticket_description }}

{% endfor %}
{% else %}



ID
Status
Created by
Title
Description




{% for ticket in closed_tickets %}

{{ ticket.id }}
{{ ticket.status }}
{{ ticket.created_by }}
{{ ticket.ticket_title }}
{{ ticket.ticket_description }}

{% endfor %}
{% endif %}
{% endfor %}
{% endblock %}




On Monday, 22 November 2021 at 13:22:47 UTC+5:30 David Nugent wrote:

> Well, there are several ways you can deal with that.
>
> Probably easiest is to override get_template() and switch the template 
> based on whatever type of ticket you're managing or you can change the 
> value of self.template_name based on the request.
>
> Or maybe you prefer a single template to deal with all cases with 
> conditional blocks where appropriate.
>
>
> Regards,
> David
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/786fa7af-0a81-4cf7-9a2e-c2fd2e9f0323n%40googlegroups.com.


django-oscar customisation

2021-11-22 Thread Hervé Edorh
Hi, 
I am new to django-oscar and i try to understand the structure of oscar. i 
have read many times the documentation but i think there is something i 
don't understand.
I fork the template and customise the layout.html, base.html. but how can i 
build my own first page, i don't see an index.html...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4000707d-c14e-4193-92b8-730a4d2aa5den%40googlegroups.com.