generic views template problem
Guys, Someone can tell me what is happening with my generic views? I have the templates in my application folder 'templates' in the root my project. This folder is referenced in settings such as: TEMPLATE_DIRS = ( os.path.join (PROJECT_ROOT_PATH, 'templates') ) and I am calling a generic view thus: (r'index / $ ',' django.views.generic.list_detail.object_list ' info_dict, dict (name = "obras_index" template_object_name = 'obra', template_name = 'templates/obra_list.html ")) It turns out that the server is not finding my folder templates and an error: Exception Type: TemplateDoesNotExist Exception Value: obra/obra_list.html how can I resolve the situation? Thanks Aboim -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
missing object in object_list generic view
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.numero {{}} ## example [...] and what appears in place of the list of objects paged out of 5 in 5, is "Page of" I'm missing the queryset variable somehow What can I do to solve the problem thank you Aboim -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
dict objects are unhashable
Hi guys (and gals), Why I am getting this error? Caught TypeError while rendering: dict objects are unhashable I am using a generic view (object_list) to render my template. But I guess I am not passing all the data correctly. Could you show me the correct direction? my urls: info_dict = { 'queryset': Obra.objects.all(), 'template_object_name': 'obras', 'paginate_by': 5, } (r'page(?P[0-9]+)/$', 'django.views.generic.list_detail.object_list', info_dict, dict(template_name='obras/obra_list.html')), ) template: {% for obra in obras_list %} Obra: {{ obra.numero }} thanks folks Aboim -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: dict objects are unhashable
Yeah I understand you! but is something missing me, because if I put it this way my urls: info_dict = { 'queryset': Obra.objects.all(), 'template_object_name': 'obras', 'paginate_by': 5, 'tamplate_name': 'obras/obra_list.html', } (r'page(?P[0-9]+)/$', 'django.views.generic.list_detail.object_list', info_dict), the problem is the same! but the first form was more usefull to me because I want the other generic views tha I will be using catch diferent templates (...name) I was think on use a wrap function on views.py, but I think this is a simple problem I just don't get it, can you help me? thanks Aboim On Dec 2, 2:23 pm, Tom Evans wrote: > On Thu, Dec 2, 2010 at 2:18 PM, Carlos Aboim wrote: > > Hi guys (and gals), > > Why I am getting this error? > > > Caught TypeError while rendering: dict objects are unhashable > > > I am using a generic view (object_list) to render my template. But I > > guess I am not passing all the data correctly. > > Could you show me the correct direction? > > > my urls: > > info_dict = { > > 'queryset': Obra.objects.all(), > > 'template_object_name': 'obras', > > 'paginate_by': 5, > > } > > (r'page(?P[0-9]+)/$', > > 'django.views.generic.list_detail.object_list', info_dict, > > dict(template_name='obras/obra_list.html')), > > ) > > http://docs.djangoproject.com/en/1.2/topics/http/urls/#patterns > > """ > The first argument to patterns() is a string prefix. See The view prefix > below. > > The remaining arguments should be tuples in this format: > > (regular expression, Python callback function [, optional dictionary > [, optional name]]) > """ > > I doubt dict(template_name='obras/obra_list.html') is appropriate as a name. > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: dict objects are unhashable
Thank you Tom for your answer and pacience. But I am totally lost! I recoded urls because we don't need specify the default template_name So I am going post all my releated files and code if you could analyze it for me I'll apreciate. urls inside app folder: http://dpaste.com/hold/282239/ template http://dpaste.com/hold/282242/ Full traceback http://dpaste.com/hold/282244/ and that's the code, Hope I have not forgotten anything I you could help me thank you Aboim On Dec 2, 2:50 pm, Tom Evans wrote: > On Thu, Dec 2, 2010 at 2:42 PM, Carlos Aboim wrote: > > Yeah I understand you! > > > but is something missing me, because if I put it this way > > > my urls: > > info_dict = { > > 'queryset': Obra.objects.all(), > > 'template_object_name': 'obras', > > 'paginate_by': 5, > > 'tamplate_name': 'obras/obra_list.html', > > } > > (r'page(?P[0-9]+)/$', > > 'django.views.generic.list_detail.object_list', info_dict), > > > the problem is the same! > > > but the first form was more usefull to me because I want the other > > generic views tha I will be using catch diferent templates (...name) > > > I was think on use a wrap function on views.py, but I think this is a > > simple problem > > > I just don't get it, can you help me? > > > thanks > > Aboim > > Full traceback + code or it never happened :) > > I'm also assuming when you say that is 'your urls', that it is not > your whole urls.py file, and you are building urlpatterns correctly > (ie, using patterns(), you're declaring the info_dict outside of the > patterns() call, etc). > > Are you sure you hadn't misunderstood the urlconf syntax in another > place as well? > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
models don't show in tamplate
Hi guys, Is there a reason for my models don't show up in my template? my urls on app folder: http://dpaste.com/hold/282583/ my template: http://dpaste.com/hold/282586/ I can access through shell to models instaces, Any help whould be apreciated thank you Aboim -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
generic view 'create_object' inssue
I fellows I am getting a strange behavior from a simple generic view The problem is that I can not pass the data in the form to introducing a new object in the database. Then the urls.py file > http://dpaste.com/hold/732643/ The html form is this > http://dpaste.com/hold/732646/ when I submit the form the page redirects to somewhere but the data doesn't get into the database. What am I doing wrong? I thank you for your help! hugs -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/KoMaftJqfTAJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: generic view 'create_object' inssue
No answers yet? Can anyone help me?! Thank you Quarta-feira, 25 de Abril de 2012 8:08:24 UTC-3, Carlos Aboim escreveu: > > I fellows > I am getting a strange behavior from a simple generic view > > The problem is that I can not pass the data in the form to introducing a > new object in the database. > Then the urls.py file > http://dpaste.com/hold/732643/ > The html form is this > http://dpaste.com/hold/732646/ > > when I submit the form the page redirects to somewhere but the data > doesn't get into the database. > > What am I doing wrong? > I thank you for your help! > hugs > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ve2xd9U6AGQJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django 1.5 not getting css
Hi everyone. Anybody can tell me why I can get css on my flatpage /home/ ? http://dpaste.com/hold/1066757/ -> this is the html of the page http://dpaste.com/hold/1067747/ ---> this is the css styles http://dpaste.com/hold/1066760/ -->settings.py http://s22.postimg.org/78tbfibzl/Picture_2.png --> folder estruture thank you -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
css for flatpages
Hi tell me, where should live css files for flatpages, these need a special folder for server to find them as for apps for example? thank you! -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: django 1.5 not getting css
ok I understand that, but I am using the development server. any other clues? thanks Domingo, 21 de Abril de 2013 17:44:46 UTC+1, Rainy escreveu: > > > > On Sunday, April 21, 2013 11:18:22 AM UTC-4, Carlos Aboim wrote: >> >> Hi everyone. >> >> Anybody can tell me why I can get css on my flatpage /home/ ? >> >> http://dpaste.com/hold/1066757/ -> this is the html of the page >> >> http://dpaste.com/hold/1067747/ ---> this is the css styles >> >> http://dpaste.com/hold/1066760/ -->settings.py >> >> http://s22.postimg.org/78tbfibzl/Picture_2.png --> folder >> estruture >> >> thank you >> > > > Comments above STATIC_ROOT explain what it should be set to. -ak > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
add and remove instance keeping the log
Hi Imagine something like: def Model_A(models.Model): number = models.IntegerField() date = models.DateField() Add an instance of the Model_A Delete an instance of the Model_A Add other instance of the Model_A Delete other instance of the Model_A Then when I do a query on database I whould like to retrive the log of all operations on Model_A and the sum of Model_A.objects.count() What should I put in the view? Thanks -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
NoReverseMatch at /app/
I am getting a strange error on my humble opinion.. *Why am I getting this error?* Reverse for 'registo.detail' with arguments '(1,)' and keyword arguments '{}' not found. *my views:* from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.shortcuts import render_to_response from django.db.models import Count from paletes.models import Registo # lista de paletes def registo_paletes(request): registos = Registo.objects.all() return render_to_response("paletes/registo_paletes.html", {'registos': registos}) # detalhe class registo_Detail(UpdateView): model = Registo *my urls*: from django.conf.urls import patterns, include, url from paletes.views import registo_paletes, registo_Detail urlpatterns = patterns('', url(r'^$', registo_paletes, name='index'), url(r'registo/(?P\d+)', registo_Detail.as_view(), name='detail'), ) *my template:* {% extends "flatpages/default.html" %} {% block content %} Guia Cliente Data Total paletes LS {% for registo in registos %} {{ registo.guia_de_remessa }}{{ registo.cliente }}{{ registo.data }}{{ registo.total_paletes_LS }} {% endfor %} {% endblock %} I can't pass over it, can you help with this inssue? Thanks -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Pagination import error
Hi there, I am getting this error on my code execution: Request Method: GET Request URL: http://127.0.0.1:8000/admin Django Version: 1.3 Exception Type: ImportError Exception Value: cannot import name Paginator Exception Location: /Library/Frameworks/Python. framework/Versions/2.7/ lib/python2.7/site-packages/django/utils/importlib.py in import_module, line 35 Python Executable: /Library/Frameworks/Python.framework/Versions/2.7/ Resources/Python.app/Contents/MacOS/Python Python Version: 2.7.1 ...and the only thing I can think of is the page_per_50 that I have setted in admin.py of my project I suppose it's got to be with the Django version (1.3) how do I overcome this inssue? thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/L7YGTkSx1pwJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.