Sunday, November 21, 2021

Re: Multiple Templates in single list view

What about the templates i have three different templates for as u can see in template_name in the above views ,how do i deal with it if i actualyl had one template the above could have worked.
On Monday, 22 November 2021 at 12:42:59 UTC+5:30 sutharl...@gmail.com wrote:
we can go like 

```

class Manager(...):
def get_context_data(self, **kwargs):
context = super() ....
context["open_tickets"] = Ticket.objects.filter(status="OPEN")
context["accepted_tickets"] = Ticket.objects.filter(status="ACCEPTED")
context["completed_tickets"] = Ticket.objects.filter(status="COMPLETED")
return context
```

On Mon, 22 Nov 2021 at 12:19, Trippy Samurai <someshkan...@gmail.com> wrote:
Hi Elena Thanks for the reply i have three different html pages to display open tickets closed tickets accepted tickets etc each of them have different ticket statuses i have them written in different views as above to display each type of ticket at different pages how can i combine all three in  a single view so that i dont repeat my logic in views.Is there a way to acheive all the three views writing in a single view?

On Monday, 22 November 2021 at 10:04:14 UTC+5:30 elena wrote:
Hi,

The problem is it's unclear what your question is. Can you be clearer about what outcome you're trying to achieve? 


---
Elena Williams
Github: elena


On Mon, 22 Nov 2021 at 15:20, Trippy Samurai <someshkan...@gmail.com> wrote:
Any one plz


On Sunday, 21 November 2021 at 15:09:39 UTC+5:30 Trippy Samurai wrote:
Hello,
I have different views for displaying different templates how do i write them into one single Listview so that i can take care of DRY


Screenshot 2021-11-21 at 3.08.58 PM.png

--
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/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%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...@googlegroups.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a000369b-b20f-4737-9bdc-f913f5af0a08n%40googlegroups.com.

No comments:

Post a Comment