Re: admin home page
error # 1 I can't understand at all, error # 2 is because of errors in urls.py files (project level and/or application level), but I cannot find them exactly. Please help On 26 фев, 21:58, vladimir wrote: > 1. Studying example in "The Definite Guide to Django. 2nd ed. > A.Holovaty, J.Kaplan-Moss" I have got impropper form of admin home > page (after > authorisation):https://docs.google.com/leaf?id=0B5W4njXO9ND_YmY0ZGQ4NTktZWZiZC00MzU3... > 2. Studying example (CMS) in "Python Web Development with Django. > J.Forcier, P.Bissex, W.Chun" I have got an > error:https://docs.google.com/leaf?id=0B5W4njXO9ND_Mzg1M2U0ZGItYzZiMS00Y2Qx... -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.
Form wizard
Please give me a reference to a full example of Form wizard. To learn it I try to solve such an application (details are omitted): urls.py: urlpatterns = patterns('', (r'^hotel_wizard/', 'my.app.views.hotel_info'), models.py: class Country(models.Model): name = models.CharField(max_length=50) objects = models.Manager() class Region(models.Model): name = models.CharField(max_length=50) country = models.ForeignKey(Country) objects = models.Manager() class Hotel(models.Model): name = models.CharField(max_length=255) region = models.ManyToManyField(Region) price = models.IntegerField() objects = models.Manager() forms.py: class HotelForm1(forms.Form): country = forms.ModelChoiceField(queryset=Country.objects.all()) class HotelForm2(forms.Form): region = forms.ModelChoiceField(queryset=Region.objects.all()) ??? price = forms.DecimalField(max_digits=7) class HotelWizard(FormWizard): def done(self, request, form_list): return HttpResponseRedirect('/page-to-redirect-to-when-done/') I stopped at this step. How can I pass country selected to HotelForm2 and use it in queryset, and so on. Maybe the best way for me is to look at an example. I didn't find it in djangoproject.com and 3 books on Django I have. Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.
upgrade Django 1.2.3 to 1.3
After upgraging I entered python manage.py runserver and got error messages: File "manage.py", line 11, in execute_manager(settings) File "c:\python26\lib\site-packages\django\core\management \__init__.py", line 438, in execute_manager utility.execute() File c:\python26\lib\site-packages\django\core\management \__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "c:\python26\lib\site-packages\django\core\management \__init__.py", line 261, in fetch_command klass=load_command_class module=import_module('%s.management.command.%s' % (app_name, name)) File "c:\python26\lib\site-packages\django\utils\importlib.py, line 35, in import_module __import__(name) File "c:\python26\lib\site-packages\django\core\management\command \runserver.py",line 8, in from django.core.handlers.wsgi import WSGIHandler File "c:\python26\lib\site-packages\django\core\handlers\wsgi.py", line 11, in from django.dispatch import Signal File "c:\python26\lib\site-packages\django\dispatch\__init__.py", line 9, in from django.dispatch.dispatcher import Signal, receiver ImportError: cannot import name receiver Could you point to my mistake? Many thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: upgrade Django 1.2.3 to 1.3
Thank You very much, Kev !!! You helped me. Vladimir Vanin -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: jquery
Thank You! Now I see I don't understand how can I use static files using the development server. I saw several answers to this question of other people but they are too breaf for me. Books on Django I have don't explain this problem. Be so kind to explain me. My local computer has Windows. The project folder is c:/djangomysites/ testjquery, it contains subfolders static and templates, static contains subfolders images and js. Today I changed Django 1.2.3 to Django 1.3. May I consider images for simplicity. For the same reason I don't use os function here. settings.py contains: STATICFILES_DIRS = ( 'c:/djangomysites/testjquery/static', ) STATIC_ROOT='' STATIC_URL='/static/' urls.py contains: urlpatterns = patterns('', (r'^', 'testjquery.views.first'), if settings.DEBUG: urlpatterns += patterns('', (r'^static/(?P.*)$', 'django.views.static.serve', { 'document_root': 'c:/djangomysites/testjquery/static' }) views.py contains: def first(request): return render_to_response('index.html', context_instance=RequestContext(request)) index.html contains: As a result, I get in the produced html-file. But the image file can't be loaded. Thank You very much! -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.
static files (development server)
I see I don't understand how can I use static files using the development server. I saw several answers to this question of other people but they are too breaf for me. I think I follow advices but without any result. Books on Django I have don't explain this problem. Be so kind to explain me. My local computer has Windows. The project folder is c:/djangomysites/ testjquery, it contains subfolders static and templates, static contains subfolders images and js. Today I changed Django 1.2.3 to Django 1.3. May I consider images for simplicity. For the same reason I don't use "os" function here. settings.py contains: STATICFILES_DIRS = ( 'c:/djangomysites/testjquery/static', ) STATIC_ROOT='' STATIC_URL='/static/' urls.py contains: urlpatterns = patterns('', (r'^', 'testjquery.views.first'), if settings.DEBUG: urlpatterns += patterns('', (r'^static/(?P.*)$', 'django.views.static.serve', { 'document_root': 'c:/djangomysites/testjquery/static' }) views.py contains: def first(request): return render_to_response('index.html', context_instance=RequestContext(request)) index.html contains: As a result, I get in the produced html-file. But the image file can't be loaded. Thank You very much! -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: static files (development server)
Tom, I added from django.contrib.staticfiles.urls import staticfiles_urlpatterns and if settings.DEBUG: urlpatterns += staticfiles_urlpatterns() to urlconf, but didn't get any result. Vladimir -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: Django can't see my static files
Hello, I can't use static files too. urls: urlpatterns = patterns('', (r'^', 'testjquery.views.first'), ) if settings.DEBUG: urlpatterns += patterns('django.views.static', (r'^%s/(?P.*)$' % settings.STATIC_URL[1:], 'serve', { 'document_root': settings.STATIC_ROOT }), ) settings: def rel(*x): return os.path.join(os.path.abspath(os.path.dirname(__file__)), *x) DEBUG = True TEMPLATE_DEBUG = DEBUG STATICFILES_DIRS = DEBUG and (rel('static'),) or None STATIC_ROOT = rel('static') STATIC_URL='/static/' TEMPLATE_CONTEXT_PROCESSORS = ('django.core.context_processors.static',) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', ) test {% load static %} Vladimir Moscow, Russia -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: static files (development server)
I have got working test project but it works very strange. http://www.w3.org/1999/xhtml"; xml:lang="en"> What is strange: if I rename an image file or any directory and change a reference accordingly, an image disappears from the page. -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: static files (development server)
On 6 авг, 18:48, Shawn Milochik wrote: > Are you running collectstatic after making those changes? After Your advice I did so without any success. The details are: I use django 1.3, Windows on a local computer. 1) I removed 'products' and 'thumbnails' subfolders from 'image' folder and placed an image file directly into 'image' folder. I changed 'index.html': 2) settings.py contains: STATIC_ROOT = os.path.join(CURRENT_PATH, 'static') STATIC_URL = '/static/' # all my static files are in static subfolder of project folder, so I don't neet to collect them from different places into unique folder: STATICFILES_DIRS = ( ) STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', #'django.contrib.staticfiles.finders.DefaultStorageFinder', ) INSTALLED_APPS = ( ... 'django.contrib.staticfiles', ) # I inserted this on Stuart MacKay advice: # this allows you to use {{ STATIC_URL }} in your templates TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.static', # the next is nesessary to prevent error: 'django.contrib.auth.context_processors.auth', ) 3) urls.py contains: if settings.DEBUG: urlpatterns += patterns('django.views.staticfiles.views', url(r'^static/(?P.*)$', 'serve'), ) urlpatterns += staticfiles_urlpatterns() 4) Then I ran command: manage.py collectstatic It created 'admin' subfolder into 'static' folder in my project and copied 78 files from django into it. Now I have such folder structure: teststatic (project folder) L templates L index.html L static L admin L images L java_piano.jpg Browser sees: and does NOT load the image. In addition, I got such error message: Unhandled exception in thread started by > Traceback (most recent call last): File "C:\Python26\lib\site-packages\django\core\management\commands \runserver.py", line 107, in inner_run This error message is prevented by removing TEMPLATE_CONTEXT_PROCESSORS statement from settings.py. Maybe I must place image files into an application/static folder? I moved static/images/java_piano.jpg into an application folder: teststatic (project folder) L catalog (application folder) L static L images L java_piano.jpg L templates L index.html L static L admin and ran: manage.py collectstatic again. It created a subfolder 'images' in 'teststatic/static/' and copyed the image file into it: teststatic (project folder) L catalog (application folder) L static L images L java_piano.jpg L templates L index.html L static L admin L images L java_piano.jpg It HELPED :) but I still don't understand how :(. Is a key to force staticfiles application to copy static files, and if static files are in place then static files application doesn't change its setup? Are all the statements I inserted into urls.py and settings.py nesessary or some of them are not? -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.
sitemap
Would You please help me to find a mistake? --- blog.model.py: from django.db import models class Entry(models.Model): title = models.CharField(max_length=150) body = models.TextField() is_draft = models.BooleanField() pub_date = models.DateField() def __unicode__(self): return self.title @models.permalink def get_absolute_url(self): return('entry', [str(self.title)]) --- blog.sitemap.py: from django.contrib.sitemaps import Sitemap class BlogSitemap(Sitemap): changefreq = "never" priority = 0.5 def items(self): return Entry.objects.filter(is_draft==1) def lastmod(self, obj): return obj.pub_date --- urls.py: from django.conf.urls.defaults import * from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap from testsitemap.blog.models import Entry from django.contrib import admin admin.autodiscover() info_dict = { 'queryset': Entry.objects.all(), 'date_field': 'pub_date', } sitemaps = { 'flatpages': FlatPageSitemap, 'blog': GenericSitemap(info_dict, priority=0.6), } urlpatterns = patterns('', url(r'^entry/(\w+)/$', 'archive', name='entry ), url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}), ) --- blog.views.py: from django.shortcuts import render_to_response from testsitemap.blog.models import Entry def archive(request): posts = Entry.objects.all() return render_to_response('archive.html', {'posts': posts }) --- error message: Request Method: GET Request URL:http://localhost:8000/sitemap.xml Django Version: 1.3 Exception Type: NoReverseMatch Exception Value: Reverse for 'entry' with arguments '('my 1st post',)' and keyword arguments '{}' not found. Exception Location: C:\Python26\lib\site-packages\django\core \urlresolvers.py in reverse, line 337 Thank You very much! -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: sitemap
Thank You very much! -- 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/-/MUltEa4dGogJ. 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.
effective adding records in Django site admin
Good morning! Could you tell me, is there any solution to add several records? 1) Now we can click Add, this gives us an empty version of the edit page. I believe it is comfortable to have a Copy button, clicking Copy would give us a page with a copy of a previuosly selected record, we could edit several fields in it and save a new record. 2) One more comfortable tool, I believe, would be 2-dimensional form for group addings records: rows corresponds to one field, columns to another, cells to third. Saving such a form would create several records, one for every filled cell. May be such solutions are exist ? If not, could you give me any advice? Thank you very much! -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: effective adding records in Django site admin
Thank You very much! Adding option "save_as = True" to ModelAdmin subclass is exactly what I need. On 4 окт, 13:01, Thomas Orozco wrote: > Regarding your first question, the admin save_as field does exactly this. > Le 4 oct. 2011 07:01, "veva...@yandex.ru" a écrit : -- You received this message because you are subscribed to the Google Groups "Django users" group. 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: effective adding records in Django site admin
Thank You very much! Tell me please what directory is to be used to place such extensions On 4 окт, 12:02, Ilian Iliev wrote: > Hi, > > you can always create custom admin page for your models by extending > the default admin. > > -- > eng. Ilian Iliev > Web Software Developer > > Mobile: +359 88 66 08 400 > Website:http://ilian.i-n-i.org > > > > > > > > On Tue, Oct 4, 2011 at 8:01 AM, veva...@yandex.ru wrote: > > Good morning! > > Could you tell me, is there any solution to add several records? > > 1) Now we can click Add, this gives us an empty version of the edit > > page. I believe it is comfortable to have a Copy button, clicking Copy > > would give us a page with a copy of a previuosly selected record, we > > could edit several fields in it and save a new record. > > 2) One more comfortable tool, I believe, would be 2-dimensional form > > for group addings records: rows corresponds to one field, columns to > > another, cells to third. Saving such a form would create several > > records, one for every filled cell. > > May be such solutions are exist ? If not, could you give me any > > advice? > > Thank you very much! > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > 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. -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.
startproject
Hi ! Command django-admin.py startproject stopped work on my computer (it worked well in the past), I get: Usage: django-admin.py subcommand [options] [args] etc. I found it was because I have set another Python version last week. At first I got such a message: Traceback (most recent call last): File "C:\python26\lib\site-packages\django\bin\django-admin.py", line 2, in from django.core import management ImportError: No module named django.core Then I removed the 2nd Python version. Now I get the message I wrote on the top. I can not fix this problem. I use Windows 7, Python 2.6.6, Django 1.3. PATH=C:\python26\lib\site-packages\django\bin\; PYTHONPATH=C:\python26 There was similar question https://groups.google.com/group/django-users/browse_thread/thread/6fbeaa486de657a8/9295d515ce9f79ae?hl=ru&lnk=gst&q=startproject#9295d515ce9f79ae I think there was no satisfactory answer. This is a copy of my screen: c:\DjangoMySites>django-admin.py startproject newsite Usage: django-admin.py subcommand [options] [args] Options: -v VERBOSITY, --verbosity=VERBOSITY Verbosity level; 0=minimal output, 1=normal output, 2=all output --settings=SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath=PYTHONPATH A directory to add to the Python path, e.g. "/home/djangoprojects/myproject". --traceback Print traceback on exception --version show program's version number and exit -h, --helpshow this help message and exit Type 'django-admin.py help ' for help on a specific subcommand. Available subcommands: cleanup compilemessages ... startproject syncdb test testserver validate DJANGO_SETTINGS_MODULE , I think, is not wrong: c:\DjangoMySites>DJANGO_SETTINGS_MODULE "DJANGO_SETTINGS_MODULE" is not internal or external command, executable program or a batch file". -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.