object_list=[] ?

2007-07-07 Thread Carl Karsten
# models.py # get Events from the DB that are in the specified month. object_list = Event.objects.filter(eventdate__range=(dates[0][0],dates[-1][-1])) template: month_index.html object_list: {{ object_list }} object_list.0: {{ object_list.0 }} brows it: renders: object_list: [

Re: object_list=[] ?

2007-07-07 Thread Malcolm Tredinnick
"%(ed)s %(t)s" % {'t':self.title, 'ed':self.eventdate } > > # models.py > # get Events from the DB that are in the specified month. > object_list = > Event.objects.filter(eventdate__range=(dates[0][0],dates[-1][-1])) > > > tem

Re: object_list=[] ?

2007-07-07 Thread Carl Karsten
nk=True) >> def __str__(self): >> return "%(ed)s %(t)s" % {'t':self.title, 'ed':self.eventdate } >> >> # models.py >> # get Events from the DB that are in the specified month. >> object_list = >>

object_list and select_template

2007-09-26 Thread akonsu
hello, is there a way to make django.views.generic.list_detail.object_list invoke django.template.loader.select_template when searching for template? i have a set of items with tags. i want to use object_list generic view to show items with a specific tag, and i want to use different templates

generic view object_list

2007-03-23 Thread paulh
The code of views.generic.list_detail. object_list has the following line: queryset = queryset._clone(), Looking at the rest of the code I can't quite see why this 'cloning' operation takes place, but I have probably missed something. If the code were to read: try: queryset =

object_list in html

2018-02-22 Thread Alan
Hi there, I am using Django 2 with Python 3.5 I have this query, simple, in mysql: select * from submit_submission where jstatus = 'Running' and juser = 'jonhdoe'; Basically, I have a table that tracks the jobs I am running. In my html, I'd like to replace this part (in red): {% if *object_li

multiple models in object_list

2008-11-04 Thread John M
I'm trying to figure out how I can use more than one model with a call to object_list generic view. currently I have this.. objectlist_dict = {'queryset' : Report.reports.all(), 'extra_context' : {'category

Django : generic view object_list

2007-08-06 Thread Marco A.
Hi to all , I have created a view: (r'^$', 'django.views.generic.list_detail.object_list', info_dict), In the template I have : this is just a test, ! {% if error_message %}{{ error_message }}{% endif %} {% for User in info_dict %} aaa {{ User.user }} {% endfor %} I cant see , nothing

Re: object_list in html

2018-02-22 Thread Costja Covtushenko
Hi Alan, How did you receive that `object_list`? You should filter it based on you user and ‘Running’ inside the view. And then just check if it has count > 0. I hope that does have sense to you. Regards, Constantine C. > On Feb 22, 2018, at 7:34 PM, Alan wrote: > > Hi ther

Re: object_list in html

2018-02-23 Thread Alan
ould have 'runFlag' in the template html? Sorry for those questions, I used to use Django 10 years ago and had solutions for that, now I am trying to learn Django 2.0. Alan On 23 February 2018 at 03:18, Costja Covtushenko wrote: > Hi Alan, > > How did you receive that `object_l

Re: object_list in html

2018-02-23 Thread Dylan Reinhold
r those questions, I used to use Django 10 years ago and had > solutions for that, now I am trying to learn Django 2.0. > > Alan > > > On 23 February 2018 at 03:18, Costja Covtushenko > wrote: > >> Hi Alan, >> >> How did you receive that `object_list`? &

Re: object_list in html

2018-02-26 Thread Alan
t; >> Would django equivalente be: >> Submission.objects.filter(juser=self.request.user, jstatus=‘Running) >> >> If so, then how to tweak this class so I could have 'runFlag' in the >> template html? >> >> Sorry for those questions, I used to use D

Re: multiple models in object_list

2008-11-04 Thread Matías Costa
On Tue, Nov 4, 2008 at 8:37 PM, John M <[EMAIL PROTECTED]> wrote: > > I'm trying to figure out how I can use more than one model with a call > to object_list generic view. > http://www.djangosnippets.org/snippets/1103/ --~--~-~--~~~---~--~

Re: multiple models in object_list

2008-11-04 Thread John M
27;m trying to figure out how I can use more than one model with a call > > to object_list generic view. > > http://www.djangosnippets.org/snippets/1103/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "D

"For object in object_list: related_list="...

2009-07-28 Thread bweiss
I've got this to work in python shell mode, but am having trouble translating it into a django view, and am hoping someone can point out where I'm stuffing up. For background, I'm working with a database with two models: "Employees" and "Projects", joined by a ForeignKey field on the Project mode

Re: Django : generic view object_list

2007-08-06 Thread Nebojša Đorđević
> endif %} > > > > {% for User in info_dict %} {% for User in object_list %} http://www.djangoproject.com/documentation/generic_views/#django- views-generic-list-detail-object-list `object_detail` puts all of the found objects in *object_list*. -- Nebojša Đorđević - nesh,

Sorting object_list in generic views

2005-08-20 Thread [EMAIL PROTECTED]
Hi folks, I'm trying to sort a generic list from the django.views.generic.list_detail.object_list generic view It seems that all of the items below are returning the same results: {% for log in object_list|dictsortreversed:"timestamp" %} {% for log in object_list|dict

filter object_list in generic views

2006-02-21 Thread char
I'd like to have a search form drive a generic list/detail view. Is there a way to filter the db query that generates object_list based on a search form? It doesn't seem like I should have to write a custom view just to filter list results. Thank

Re: "For object in object_list: related_list="...

2009-07-29 Thread Daniel Roseman
On Jul 29, 5:18 am, bweiss wrote: > I've got this to work in python shell mode, but am having trouble > translating it into a django view, and am hoping someone can point out > where I'm stuffing up. > > For background, I'm working with a database with two models: > "Employees" and "Projects", jo

Re: "For object in object_list: related_list="...

2009-07-29 Thread bweiss
Thankyou, Daniel - that's done the trick. I can't believe I didn't think of that before. Thanks for the point about aggregation, too - I suspected the way I was doing things was probably not the most efficient, and I'll certainly look into the alternative. Bianca On Jul 29, 5:17 pm, Daniel Ros

missing object in object_list generic view

2010-11-30 Thread Carlos Aboim
It's very strange, got this: urls info_dict = { 'Queryset': Obra.objects.all (), } (r'index / $ ',' django.views.generic.list_detail.object_list ', info_dict, dict (name = "obras_index", template_object_name = 'obras', paginate_by = 5)), template [...] {% For book in the works%} obra.num

utf-16le encode generic view object_list

2015-05-21 Thread JHeasly
Hello all, I've got a function-based generic view that I want to return a utf-16le encoded response (for use as an InDesign tagged text file; the utf-16le is what InDesign wants). I've got it working here , but am wondering if there's an mo

combine generic views - object_list and object_detail

2007-10-05 Thread Ana
Hi, I'd like to get to know if there is possibility to combine generic views - object_list and object_detail. In my application I have object_detail template showing Resource details. The details are resource_name, object_id and resource_reservation_reasons. Resource_reservation_reasons shou

object_list || didn't return an HttpResponse object

2007-04-03 Thread TaMeR
eneric.list_detail import object_list #events = Event.objects.all().values('id', 'name', 'postcode', 'start', 'vehicle').order_by('-start') events = Event.objects.all().order_by('-start') if len(events) == 0:

Re: Sorting object_list in generic views

2005-08-20 Thread Adrian Holovaty
On 8/20/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm trying to sort a generic list from the > django.views.generic.list_detail.object_list generic view > > It seems that all of the items below are returning the same results: > > {% for log in object_lis

Re: Sorting object_list in generic views

2005-08-20 Thread [EMAIL PROTECTED]
Great, thanks! I realized just after I posted that it wasn't a dictionary list, so that's why it wasn't working, but I still didn't know the tips above. By the way, do you have an estimated release date for 1.0? Tom

Re: Sorting object_list in generic views

2005-08-20 Thread Adrian Holovaty
On 8/20/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > By the way, do you have an estimated release date for 1.0? We don't have an official date set, but we have a roadmap here: http://code.djangoproject.com/milestone/Version%201.0 We'll consider it ready for 1.0 release when we've closed t

Re: Sorting object_list in generic views

2005-08-22 Thread Maniac
okup. In your case, you'd want this: """ extra_lookup_kwargs": {"order_by": ['-timestamp']} """ This works for object_list but what if I want to sort details of this object in object_detail generic view? Basically I want to have

Re: filter object_list in generic views

2006-02-21 Thread char
Sorry for the bump. I'm still trying to figure this out. The extra_lookup_kwargs field of the info_dict seems like it comes close to doing what I want to do but I can't drive it from a search form so I'm still stumped. Do I really need to make a custom view if I want to filter the list results via

generic views object_list & custom template tags

2006-08-04 Thread bernie2004
when using a generic views object_list, i would like to know if there is a faster way to get all the extra variables inside a custom template tag: {% navigation pages page has_previous has_next %} and @register.simple_tag def navigation( pages, page, has_previous, has_next ): ... create

Executing logic for each object in object_list

2008-12-24 Thread Roy
Is it possible? Or I need to page my queryset in the wrapper function and do it there? (it seems not DRY to simply copy-paste the pagination logic from object_list) Basically I have several object_list wrappers for a particlar model, and I want to add logging logic every time a specific instance

Re: missing object in object_list generic view

2010-11-30 Thread Andre Terra
Start by reading http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/ and finish by writing one (or many!) wrapper function(s) as suggested. It will make your code 1) readable, 2) easier to debug, 3) extensible, 4) powerful, and 5) DRY. Cheers, Andre Terra On Tue, No

Re: utf-16le encode generic view object_list

2015-05-21 Thread Tim Chase
On 2015-05-21 13:04, JHeasly wrote: > I've got a function-based generic view that I want to return a > utf-16le encoded response (for use as an InDesign tagged text file; > the utf-16le is what InDesign wants). I've got it working here > , but

Re: utf-16le encode generic view object_list

2015-05-21 Thread Stephen J. Butler
I think that looks fine. I would change the mimetype to "text/plain; charset=UTF-16LE" just to play nice, but it probably will never matter with your Content-Disposition. Also, HttpResponse's mimetype parameter has been deprecated since 1.5; use content_type instead. On Thu, May 21, 2015 at 3:04 P

Re: utf-16le encode generic view object_list

2015-05-22 Thread JHeasly
@Tim: render_to_string! Forgot about that, somehow. That could clean it up a bit. Thanks! @Stephen: Thanks for the feedback. This app's running internally and is on insecure and ancient 1.4, but the mimetype parameter reminder is a good one! Thank you. -- You received this message because you

Re: object_list || didn't return an HttpResponse object

2007-04-03 Thread Forest Bond
On Tue, Apr 03, 2007 at 03:46:04PM -0700, TaMeR wrote: > This used to work and I must have done something to break the code. > The simple page view still works fine but the list view gives me this > error and I been through my code a million times and can't find > anything wrong with it. The way y

Re: object_list || didn't return an HttpResponse object

2007-04-03 Thread TaMeR
On Apr 3, 7:10 pm, Forest Bond <[EMAIL PROTECTED]> wrote: > On Tue, Apr 03, 2007 at 03:46:04PM -0700, TaMeR wrote: > > This used to work and I must have done something to break the code. > > The simple page view still works fine but the list view gives me this > > error and I been through my cod

Re: object_list || didn't return an HttpResponse object

2007-04-03 Thread Forest Bond
On Tue, Apr 03, 2007 at 04:42:58PM -0700, TaMeR wrote: > On Apr 3, 7:10 pm, Forest Bond <[EMAIL PROTECTED]> wrote: > > The way your view is written, if the user is not authenticated, no > > HttpResponse is returned (since no return statement is executed). You > > probably want to just raise Http40

Re: generic views object_list & custom template tags

2006-08-04 Thread Malcolm Tredinnick
On Fri, 2006-08-04 at 21:50 -0700, bernie2004 wrote: > when using a generic views object_list, > i would like to know if there is a faster way to get all > the extra variables inside a custom template tag: > > {% navigation pages page has_previous has_next %} > > and >

iteration of object_list in generic detail view

2006-08-28 Thread kev~!
o, I can't seem to create the "next" and "previous" buttons that I would think would be standard to any object in object_list. Documentation searches gives me a way to paginate the list, but that seems overwrought when all I want to do is have the detail view include links

generic object detail views with object_list included

2006-08-28 Thread kev~!
that I want to have 'previous' and 'next' links available to the detail view page, but I can't seem to figure out how to call that object_list variable again without having to use a custom view (which I don't know if I'm ready for that or not). I tried using the add f

Re: Executing logic for each object in object_list

2008-12-25 Thread Antoni Aloy
2008/12/25 Roy : > > Is it possible? Or I need to page my queryset in the wrapper function > and do it there? (it seems not DRY to simply copy-paste the pagination > logic from object_list) > > Basically I have several object_list wrappers for a particlar model, > and I want

Re: Executing logic for each object in object_list

2008-12-25 Thread Roy
? Or I need to page my queryset in the wrapper function > > and do it there? (it seems not DRY to simply copy-paste the pagination > > logic from object_list) > > > Basically I have several object_list wrappers for a particlar model, > > and I want to add logging logic every

Problem whit slung filter on Object_list genric view

2007-08-07 Thread Marco A.
Hi ! I doesnt undestand why , the slug by filters doesnt run . error :NameError at /marco/ name 'user' is not defined Request Method: GET Request URL: http://127.0.0.1:8000/marco/ Exception Type: NameError Exception Value: name 'user' is not defined Exception Location: /home/tulap/cit2/../cit

Re: iteration of object_list in generic detail view

2006-08-28 Thread Chris Long
You can do something like this: def extra_object_detail(...): context = {"next":nextObj, "previous":previousObj} return object_detail(..., extra_context=context) The generic view adds the extra_context parameter to the context so you can access it in your template. Chris --~--~---

Tutorial Part4: object_list() got an unexpected keyword argument 'object_id'

2014-04-22 Thread Okabe Kenji
At the end of tutorial part 4, I got following error message and could not get displayed the result page. Request Method: GET Request URL: http://127.0.0.1:8000/polls/1/result/ Django Version: 1.3.1 Exception Type: TypeError Exception Value: object_list() got an unexpected keyword argument

Re: Problem whit slung filter on Object_list genric view

2007-08-07 Thread KpoH
'slug_field':'user' Marco A. пишет: > > Hi ! > > I doesnt undestand why , the slug by filters doesnt run . > > error : > > > NameError at /marco/ > > > name 'user' is not defined > > Request Method: GET > Request URL: http://127.0.0.1:8000/marco/ > Exception Type: NameError > E

Testing view's get_context_data(): why does MultipleObjectMixin.get_context_data() require "object_list" in kwargs?

2013-02-13 Thread benoit . bryon
BaseListView passes object_list as keyword argument to get_context_data(): https://github.com/django/django/blob/ec469ade2b04b94bfeb59fb0fc7d9300470be615/django/views/generic/list.py#L152 * But the first thing MultipleObjectMixin.get_context_data() does is kwargs.pop('object_list'

Re: Tutorial Part4: object_list() got an unexpected keyword argument 'object_id'

2014-04-22 Thread Tom Evans
ngo 1.3 is ancient, unsupported and full of security holes. Unsupported means that you shouldn't expect a lot of help with it, particularly as this is a tutorial you are running through, not a pre-existing project with lots of 1.3-era code. > Exception Type: TypeError > Exception Value: > &

how to user generic views (object_list) to show dynamic list ?

2007-03-02 Thread lee
Hi I have a problem how to use generic views (object_list) to show dynamic list ? for exaple, my model is a movie with a category , I want to accomplish this : when I access http://.../action , in which action is a category name, then it display all the movie objects in the

Why can't I pass id/key to an object_list? please help

2009-08-21 Thread justin jools
I'm trying to pass id/key from one list then filter the next. If I try: def show_make(request, key): return object_list(request, Product_Model.all(), key) I get: invalid literal for float(): agphZXAtc2FtcGxlchgLEhJteWFwcF9wcm9kdWN0X21ha2UYAQw N.B. the key is from google app but work

Re: how to user generic views (object_list) to show dynamic list ?

2007-03-02 Thread Henrik Lied
Yeah, just pass an extra argument in the urls.py, like /files/(? P[-\w]+), and filter your queryset. Take a look at http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: how to user generic views (object_list) to show dynamic list ?

2007-03-03 Thread lee
thank you for your help! works well now :) 2007/3/3, Henrik Lied <[EMAIL PROTECTED]>: > > > Yeah, just pass an extra argument in the urls.py, like /files/(? > P[-\w]+), and filter your queryset. Take a look at > > http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views > >

object_list extended generic view and adding more data to a queryset

2006-09-01 Thread [EMAIL PROTECTED]
nded generic view to paginate topics I can't acess this variable in the template: ## # list of topics in a forum def topic_list(request, forum_id, pagination_id=1): from django.views.generic.list_detail import object_list topics = Topic.objects.order_by('-topic_modi

How to combine generic object_detail and object_list view in a template?

2006-09-15 Thread Holger Schurig
I have a model similar to this: -- class Device(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(blank=False, maxlength=40) #... class Item(models.Model): id = models.AutoField(primary_key=True)

Re: Why can't I pass id/key to an object_list? please help

2009-08-21 Thread Daniel Roseman
On Aug 21, 3:15 pm, justin jools wrote: > I'm trying to pass id/key from one list then filter the next. > If I try: > > def show_make(request, key): >     return object_list(request, Product_Model.all(), key) > > I get: >

Re: How to combine generic object_detail and object_list view in a template?

2006-09-15 Thread Jay Parlar
On 9/16/06, Holger Schurig <[EMAIL PROTECTED]> wrote: > > I have a model similar to this: > > -- > class Device(models.Model): > id = models.AutoField(primary_key=True) > name = models.CharField(blank=False, maxlength=40) > #... > > class I

Is there a way to access a field's verbose_name from a object_list generic view template?

2010-02-04 Thread Eric Chamberlain
I'm using the object_list generic view and it seems there should be a way to pull the field verbose_name from the model, without having to hard code the name in the template. Any suggestions? -- Eric Chamberlain -- You received this message because you are subscribed to the Google G

how to display a foreign key image of an object in an object_list view/template?

2017-07-10 Thread Bledi
I am trying to build a website where you can sell stuff. I want the user to be able to upload multiple images per product/post. I think I have figured that part out. But I am struggling to display one image per product. Here are the details: models.py (I have left out some basic methods) clas

Re: Is there a way to access a field's verbose_name from a object_list generic view template?

2010-02-06 Thread Dennis Kaarsemaker
On do, 2010-02-04 at 11:01 -0800, Eric Chamberlain wrote: > I'm using the object_list generic view and it seems there should be a > way to pull the field verbose_name from the model, without having to > hard code the name in the template. model_class_or_instance._meta.verbos

Re: Is there a way to access a field's verbose_name from a object_list generic view template?

2010-02-06 Thread Atamert Ölçgen
On Saturday 06 February 2010 12:23:16 Dennis Kaarsemaker wrote: > On do, 2010-02-04 at 11:01 -0800, Eric Chamberlain wrote: > > I'm using the object_list generic view and it seems there should be a > > way to pull the field verbose_name from the model, without having to >

Re: Is there a way to access a field's verbose_name from a object_list generic view template?

2010-02-06 Thread Eric Chamberlain
On Feb 6, 2010, at 2:53 AM, Atamert Ölçgen wrote: > On Saturday 06 February 2010 12:23:16 Dennis Kaarsemaker wrote: >> On do, 2010-02-04 at 11:01 -0800, Eric Chamberlain wrote: >>> I'm using the object_list generic view and it seems there should be a >>> way to

Re: how to display a foreign key image of an object in an object_list view/template?

2017-07-11 Thread ecas
You can query for the images, and keep the first one for the template rendering. products = Product.objects.all() for product in products: products.image = product.productimages_set.first() -- You received this message because you are subscribed to the Google Groups "Django users" grou

Re: how to display a foreign key image of an object in an object_list view/template?

2017-07-11 Thread Bledi
Thanks, but I am getting this error: 'Product' object has no attribute 'productimages_set' On Tuesday, July 11, 2017 at 5:29:15 AM UTC-4, ecas wrote: > > > You can query for the images, and keep the first one for the template > rendering. > > products = Product.objects.all() > for product in p

Re: how to display a foreign key image of an object in an object_list view/template?

2017-07-11 Thread ecas
There was a typo: products = Product.objects.all() for product in products: product.image = product.productimages_set.first() Other than that, it should work. You could try this in the django shell, just to verify the reverse name of the relationship. from your_app.models import * product=