Problems with first block
I'm working on a base template. Django is giving a TemplateSyntaxError at my first attempted block declaration: TemplateSyntaxError at / Could not parse the remainder: ' dtd' from 'block dtd' Request Method:GETRequest URL:http://linux:/Exception Type: TemplateSyntaxErrorException Value: Could not parse the remainder: ' dtd' from 'block dtd' Have I overgeneralized where blocks are appropriate, or is "dtd" something like a reserved word here? The template is: {{ block dtd }}http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>{{ endblock dtd }} http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> {{ block head }} {{ block title }}{{ page.title }}{{ endblock title }} {{ block head_favicon }} {{ endblock head_favicon }} {{ block head_meta }} {{ block head_meta_author}}{{ endblock head_meta_author }} {{ block head_meta_charset }}{{ endblock head_meta_charset }} {{ block head_meta_contentlanguage }}{{ endblock head_meta_contentlanguage }} {{ block head_meta_description }}{{ endblock head_meta_description }} {{ block head_meta_keywords }}{{ endblock head_meta_keywords }} {{ block head_meta_othertags }}{{ endblock head_meta_othertags }} {{ block head_meta_refresh }}{{ endblock head_meta_refresh }} {{ block head_meta_robots }}{{ endblock head_meta_robots }} {{ endblock head_meta }} {{ block head_rss }}{{ endblock head_rss }} {{ block head_css }} {{ block head_css_site }}{{endblock head_css_site }} {{ block head_css_section }}{{ endblock head_css_section }} {{ block head_css_page }}{{ endblock head_css_page }} {{ endblock head_css }} {{ block head_section }}{{ endblock head_section }} {{ block head_page }}{{ endblock head_page }} {{ endblock head }} {{ block body }} {{ block body_sidebar }}{{ endblock body_sidebar }} {{ block body_content }} {{ block body_header }} {{ block body_header_banner }}{{ endblock body_header_banner }} {{ block body_header_title }}{{ title }}{{ endblock body_header_title }} {{ block body_header_breadcrumb }}{{ endblock body_header_breadcrumb }} {{ endblock body_header }} {{ block body_announcements }}{{ endblock body_announcements }} {{ block body_main }}{{ endblock body_main }} {{ endblock body_content }} {{ block body_footer }} {{ block body_footer_breadcrumb }}{{ page.breadcrumb }}{{ endblock body_header_breadcrumb }} {{ block body_footer_legal }}{{ endblock body_footer_legal }} {{ endblock body_footer }} {{ endblock body }}{{ block footer }}{{ block footer_javascript }}{{ block footer_javascript_site }}{{ endblock footer_javascript_site }}{{ block footer_javascript_section }}{{ endblock footer_javascript_section }}{{ block footer_javascript_page }}{{ endblock footer_javascript_page }} {{ endblock footer_javascript }} {{ endblock footer }} -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Problems with first block
Thank you, x13 and creecode! On Tue, Apr 27, 2010 at 2:04 PM, x13 wrote: > > Did you read the tutorial? > http://docs.djangoproject.com/en/1.1/topics/templates/#topics-templates > > Seems to be a syntax problem > > It's not > > {{ block dtd }} ... {{ endblock dtd }} > > the properly syntax (for last Django version) would be: > > {% block dtd %} ... {% endblock %} > > Notice you should not include 'dtd' in the endblock tag. > > -f > > > > > > > On Apr 27, 3:51 pm, Jonathan Hayward > wrote: > > I'm working on a base template. Django is giving a TemplateSyntaxError at > my > > first attempted block declaration: > > > > TemplateSyntaxError at / > > > > Could not parse the remainder: ' dtd' from 'block dtd' > > > > Request Method:GETRequest URL:http://linux:/ExceptionType: > > TemplateSyntaxErrorException Value: > > > > Could not parse the remainder: ' dtd' from 'block dtd' > > > > Have I overgeneralized where blocks are appropriate, or is "dtd" > something > > like a reserved word here? > > > > The template is: > > > > {{ block dtd }} http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>{{ endblock dtd }} > > http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> > > {{ block head }} > > {{ block title }}{{ page.title }}{{ endblock title > }} > > {{ block head_favicon }} href="/static/favicon.ico" > > type="x-icon" /> > > type="x-icon" > > />{{ endblock head_favicon }} > > {{ block head_meta }} > > {{ block head_meta_author}}{{ endblock head_meta_author }} > > {{ block head_meta_charset }} > content="text/html; charset=UTF-8" />{{ endblock head_meta_charset }} > > {{ block head_meta_contentlanguage }} > http-equiv="Content-Language" value="en-US" />{{ endblock > > head_meta_contentlanguage }} > > {{ block head_meta_description }}{{ endblock > > head_meta_description }} > > {{ block head_meta_keywords }}{{ endblock head_meta_keywords > }} > > {{ block head_meta_othertags }}{{ endblock > head_meta_othertags}} > > > > {{ block head_meta_refresh }}{{ endblock head_meta_refresh }} > > {{ block head_meta_robots }}{{ endblock head_meta_robots }} > > {{ endblock head_meta }} > > {{ block head_rss }}{{ endblock head_rss }} > > {{ block head_css }} > > {{ block head_css_site }} type="text/css" > > href="/static/css/style.css" />{{endblock head_css_site }} > > {{ block head_css_section }}{{ endblock head_css_section }} > > {{ block head_css_page }}{{ endblock head_css_page }} > > {{ endblock head_css }} > > {{ block head_section }}{{ endblock head_section }} > > {{ block head_page }}{{ endblock head_page }} > > {{ endblock head }} > > {{ block body }} > > > > {{ block body_sidebar }}{{ endblock body_sidebar }} > > > > > > {{ block body_content }} > > > > {{ block body_header }} > > {{ block body_header_banner }}{{ endblock > body_header_banner}} > > > > {{ block body_header_title }}{{ title }}{{ > endblock > > body_header_title }} > > {{ block body_header_breadcrumb }}{{ > > endblock body_header_breadcrumb }} > > {{ endblock body_header }} > > > > {{ block body_announcements }}{{ endblock body_announcements > }} > > {{ block body_main }}{{ endblock body_main }} > > {{ endblock body_content }} > > {{ block body_footer }} > > {{ block body_footer_breadcrumb }}{{ page.breadcrumb }}{{ endblock > > body_header_breadcrumb }} > > {{ block body_footer_legal }}{{ endblock body_footer_legal }} > > {{ endblock body_footer }} > > {{ endblock body }}{{ block footer }} > {{ > > block footer_javascript }}{{ block > footer_javascript_site}} type="text/javascript" > > > > src="/static/js/jquery.js">{{ endblock > > footer_javascript_site }}{{ block > footer_javascript_section}}{{ endblock > > > > footer_javascript_section }}{{ block
Static media in development server
I'm trying to serve up media from a document_root of /media via, in urls.py: urlpatterns = patterns('', ... (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'media')}), ... It gives a "file not found" error, either this way or if I add a trailing slash. How can I serve up static content from /media/* to a URL of /media/* from the development server? -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Static media in development server
Thank you! Right now, I have, in settings.py: MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') MEDIA_URL = '/media/' And at the end of urls.py: if settings.DEBUG: urlpatterns += patterns('django.views.static', (r'^%s(?P.*)$' % (settings.MEDIA_URL[1:],), 'serve', { 'document_root': settings.MEDIA_ROOT, 'show_indexes': True }),) But I'm still getting a "not found" error when I try to load a picture from the media directory. I am also getting "Permission denied: /media/" when I load the root media URL. I'm on an Ubuntu32 9.10 system, so even if I should be specifying a virgule instead of os.path.join(), the path should be forward slash separated. Is there anything that looks askew about the code above? On Tue, Apr 27, 2010 at 5:28 PM, Xavier Ordoquy wrote: > Hi, > > Here's something better for your dev server: > > from django.conf import settings > > if settings.DEBUG: > urlpatterns += patterns('django.views.static', > (r'^%s(?P.*)$' % (settings.MEDIA_URL[1:],), 'serve', { > 'document_root': > settings.MEDIA_ROOT, > 'show_indexes': True }),) > > > To answer your question, you should > use os.path.abspath(os.path.dirname(__file__)) instead of > os.path.dirname(__file__). > > Regards, > Xavier. > > > Le 28 avr. 2010 à 00:00, Jonathan Hayward a écrit : > > I'm trying to serve up media from a document_root of /media > via, in urls.py: > > urlpatterns = patterns('', > ... > (r'^media/(?P.*)$', 'django.views.static.serve', > {'document_root': os.path.join(os.path.dirname(__file__), 'media')}), > ... > > It gives a "file not found" error, either this way or if I add a trailing > slash. > > How can I serve up static content from /media/* to a URL of > /media/* from the development server? > > -- > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > → An Orthodox Christian author: theology, literature, et cetera. > → My award-winning collection is available for free reading online: > ☩ I invite you to visit my main site at http://JonathansCorner.com/ > > -- > 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. > > > -- > 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. > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Static media in development server
The file permissions are right AFAIK; the directory is mode 755 and the file 644, owned by the user running the server, so accessing and reading shouldn't be a problem. Are you using Django installed through the package manager or the latest release from djangoproject.com? On Tue, Apr 27, 2010 at 6:37 PM, Xavier Ordoquy wrote: > It is pretty much what I also have and works both on ubuntu 9.10 32 bits > and osx. > > Did you checked that your media directory exists and lives in the same > directory as the settings.py ? > Also check that you have the right permissions for accessing it with the > user that runs the dev server. > > Regards, > Xavier. > > Le 28 avr. 2010 à 01:00, Jonathan Hayward a écrit : > > Thank you! > > Right now, I have, in settings.py: > > MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), > 'media') > > MEDIA_URL = '/media/' > > And at the end of urls.py: > > if settings.DEBUG: > urlpatterns += patterns('django.views.static', > (r'^%s(?P.*)$' % (settings.MEDIA_URL[1:],), 'serve', { > 'document_root': settings.MEDIA_ROOT, > 'show_indexes': True }),) > > But I'm still getting a "not found" error when I try to load a picture from > the media directory. I am also getting "Permission denied: /media/" when I > load the root media URL. > > I'm on an Ubuntu32 9.10 system, so even if I should be specifying a virgule > instead of os.path.join(), the path should be forward slash separated. Is > there anything that looks askew about the code above? > > On Tue, Apr 27, 2010 at 5:28 PM, Xavier Ordoquy wrote: > >> Hi, >> >> Here's something better for your dev server: >> >> from django.conf import settings >> >> if settings.DEBUG: >> urlpatterns += patterns('django.views.static', >> (r'^%s(?P.*)$' % (settings.MEDIA_URL[1:],), 'serve', { >> 'document_root': >> settings.MEDIA_ROOT, >> 'show_indexes': True }),) >> >> >> To answer your question, you should >> use os.path.abspath(os.path.dirname(__file__)) instead of >> os.path.dirname(__file__). >> >> Regards, >> Xavier. >> >> >> Le 28 avr. 2010 à 00:00, Jonathan Hayward a écrit : >> >> I'm trying to serve up media from a document_root of /media >> via, in urls.py: >> >> urlpatterns = patterns('', >> ... >> (r'^media/(?P.*)$', 'django.views.static.serve', >> {'document_root': os.path.join(os.path.dirname(__file__), >> 'media')}), >> ... >> >> It gives a "file not found" error, either this way or if I add a trailing >> slash. >> >> How can I serve up static content from /media/* to a URL of >> /media/* from the development server? >> >> -- >> → Jonathan Hayward, christos.jonathan.hayw...@gmail.com >> → An Orthodox Christian author: theology, literature, et cetera. >> → My award-winning collection is available for free reading online: >> ☩ I invite you to visit my main site at http://JonathansCorner.com/ >> >> -- >> 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. >> >> >> >> -- >> 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. >> > > > > -- > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > → An Orthodox Christian author: theology, literature, et cetera. > → My award-winning collection is available for free reading online: > ☩ I invite you to visit my main site at http://JonathansCorner.com/ > > -- > 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. >
Re: Static media in development server
Thank you; right now I am using the development server (i.e. not deployed to Apache for real use). I added the FILE_UPLOAD_PERMISSIONS assignment to settings.py and can't observe a difference in behavior. On Tue, Apr 27, 2010 at 7:37 PM, Nadae Ivar Badio wrote: > Hi, > > Use this FILE_UPLOAD_PERMISSIONS = 0600 > and you have to give permissions to apache to read the file upload > directory. > > > > > Jonathan Hayward wrote: > >> The file permissions are right AFAIK; the directory is mode 755 and the >> file 644, owned by the user running the server, so accessing and reading >> shouldn't be a problem. >> >> Are you using Django installed through the package manager or the latest >> release from djangoproject.com <http://djangoproject.com>? >> >> >> On Tue, Apr 27, 2010 at 6:37 PM, Xavier Ordoquy > xordo...@linovia.com>> wrote: >> >>It is pretty much what I also have and works both on ubuntu 9.10 >>32 bits and osx. >> >>Did you checked that your media directory exists and lives in the >>same directory as the settings.py ? >>Also check that you have the right permissions for accessing it >>with the user that runs the dev server. >> >>Regards, >>Xavier. >> >>Le 28 avr. 2010 à 01:00, Jonathan Hayward a écrit : >> >> Thank you! >>> >>>Right now, I have, in settings.py: >>> >>>MEDIA_ROOT = >>>os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') >>> >>>MEDIA_URL = '/media/' >>> >>>And at the end of urls.py: >>> >>>if settings.DEBUG: >>>urlpatterns += patterns('django.views.static', >>> (r'^%s(?P.*)$' % (settings.MEDIA_URL[1:],), 'serve', { >>>'document_root': settings.MEDIA_ROOT, >>>'show_indexes': True }),) >>> >>>But I'm still getting a "not found" error when I try to load a >>>picture from the media directory. I am also getting "Permission >>>denied: /media/" when I load the root media URL. >>> >>>I'm on an Ubuntu32 9.10 system, so even if I should be specifying >>>a virgule instead of os.path.join(), the path should be forward >>>slash separated. Is there anything that looks askew about the >>>code above? >>> >>>On Tue, Apr 27, 2010 at 5:28 PM, Xavier Ordoquy >>>mailto:xordo...@linovia.com>> wrote: >>> >>>Hi, >>> >>>Here's something better for your dev server: >>> >>>from django.conf import settings >>> >>>if settings.DEBUG: >>>urlpatterns += patterns('django.views.static', >>>(r'^%s(?P.*)$' % (settings.MEDIA_URL[1:],), 'serve', { >>> >>> 'document_root': settings.MEDIA_ROOT, >>> >>> 'show_indexes': True }),) >>> >>> >>>To answer your question, you should >>>use os.path.abspath(os.path.dirname(__file__)) instead of >>> os.path.dirname(__file__). >>> >>>Regards, >>>Xavier. >>> >>> >>>Le 28 avr. 2010 à 00:00, Jonathan Hayward a écrit : >>> >>> I'm trying to serve up media from a document_root of >>>>/media via, in urls.py: >>>> >>>>urlpatterns = patterns('', >>>>... >>>>(r'^media/(?P.*)$', 'django.views.static.serve', >>>> {'document_root': >>>>os.path.join(os.path.dirname(__file__), 'media')}), >>>>... >>>> >>>>It gives a "file not found" error, either this way or if I >>>>add a trailing slash. >>>> >>>>How can I serve up static content from >>>name>/media/* to a URL of /media/* from the development server? >>>> >>>>-- → Jonathan Hayward, >>>> christos.jonathan.hayw...@gmail.com >>>><mailto:christos.jonathan.hayw...@gmail.com> >>>> >>>>→ An Orthodox Christian author: theology, literature, et cetera. >>>>→ My award-winning collection is available for free r
Re: Static media in development server
I found the problem; I was trying to serve static (non-admin) media from a 'media/', and that was apparently being overridden by admin media use of the same URL. On Tue, Apr 27, 2010 at 7:53 PM, Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > Thank you; right now I am using the development server (i.e. not deployed > to Apache for real use). > > I added the FILE_UPLOAD_PERMISSIONS assignment to settings.py and can't > observe a difference in behavior. > > > On Tue, Apr 27, 2010 at 7:37 PM, Nadae Ivar Badio wrote: > >> Hi, >> >> Use this FILE_UPLOAD_PERMISSIONS = 0600 >> and you have to give permissions to apache to read the file upload >> directory. >> >> >> >> >> Jonathan Hayward wrote: >> >>> The file permissions are right AFAIK; the directory is mode 755 and the >>> file 644, owned by the user running the server, so accessing and reading >>> shouldn't be a problem. >>> >>> Are you using Django installed through the package manager or the latest >>> release from djangoproject.com <http://djangoproject.com>? >>> >>> >>> On Tue, Apr 27, 2010 at 6:37 PM, Xavier Ordoquy >>> >> xordo...@linovia.com>> wrote: >>> >>>It is pretty much what I also have and works both on ubuntu 9.10 >>>32 bits and osx. >>> >>>Did you checked that your media directory exists and lives in the >>>same directory as the settings.py ? >>>Also check that you have the right permissions for accessing it >>>with the user that runs the dev server. >>> >>>Regards, >>>Xavier. >>> >>>Le 28 avr. 2010 à 01:00, Jonathan Hayward a écrit : >>> >>> Thank you! >>>> >>>>Right now, I have, in settings.py: >>>> >>>>MEDIA_ROOT = >>>>os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') >>>> >>>>MEDIA_URL = '/media/' >>>> >>>>And at the end of urls.py: >>>> >>>>if settings.DEBUG: >>>>urlpatterns += patterns('django.views.static', >>>> (r'^%s(?P.*)$' % (settings.MEDIA_URL[1:],), 'serve', { >>>>'document_root': settings.MEDIA_ROOT, >>>>'show_indexes': True }),) >>>> >>>>But I'm still getting a "not found" error when I try to load a >>>>picture from the media directory. I am also getting "Permission >>>>denied: /media/" when I load the root media URL. >>>> >>>>I'm on an Ubuntu32 9.10 system, so even if I should be specifying >>>>a virgule instead of os.path.join(), the path should be forward >>>>slash separated. Is there anything that looks askew about the >>>>code above? >>>> >>>>On Tue, Apr 27, 2010 at 5:28 PM, Xavier Ordoquy >>>>mailto:xordo...@linovia.com>> wrote: >>>> >>>>Hi, >>>> >>>>Here's something better for your dev server: >>>> >>>>from django.conf import settings >>>> >>>>if settings.DEBUG: >>>>urlpatterns += patterns('django.views.static', >>>>(r'^%s(?P.*)$' % (settings.MEDIA_URL[1:],), 'serve', { >>>> >>>> 'document_root': settings.MEDIA_ROOT, >>>> >>>> 'show_indexes': True }),) >>>> >>>> >>>>To answer your question, you should >>>>use os.path.abspath(os.path.dirname(__file__)) instead of >>>>os.path.dirname(__file__). >>>> >>>>Regards, >>>>Xavier. >>>> >>>> >>>>Le 28 avr. 2010 à 00:00, Jonathan Hayward a écrit : >>>> >>>> I'm trying to serve up media from a document_root of >>>>>/media via, in urls.py: >>>>> >>>>>urlpatterns = patterns('', >>>>>... >>>>>(r'^media/(?P.*)$', 'django.views.static.serve', >>>>> {'document_root': >>>>>os.path.join(os.path.dirname(__file__), 'media')}), >>>>
EmailField etc. and VARCHAR / TEXT
For CharField, EmailField, URLField, etc., is VARCHAR implementation (meaning a fixed limit on length) absolutely non-negotiable, or there a way to make e.g. a CharField that won't truncate if you cross some arbitrary length? (If you don't specify a length, does it assign a default length, or use TEXT instead of VARCHAR so that a field of indefinite length is accommodated, resources permitting?) -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: EmailField etc. and VARCHAR / TEXT
Thanks! On Wed, May 26, 2010 at 5:32 AM, Daniel Roseman wrote: > On May 25, 10:49 pm, Jonathan Hayward > wrote: > > For CharField, EmailField, URLField, etc., is VARCHAR implementation > > (meaning a fixed limit on length) absolutely non-negotiable, or there a > way > > to make e.g. a CharField that won't truncate if you cross some arbitrary > > length? > > > > (If you don't specify a length, does it assign a default length, or use > TEXT > > instead of VARCHAR so that a field of indefinite length is accommodated, > > resources permitting?) > > EmailField is a subclass of CharField, so it always uses a varchar. As > the documentation notes, the default length if you don't specify one > is 75. > > If you really want an email field based on TEXT, you could subclass > EmailField with a get_internal_type method that returns 'TextField'. > -- > DR. > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: EmailField etc. and VARCHAR / TEXT
Thank you! On Wed, May 26, 2010 at 8:30 AM, Alex Robbins wrote: > If you are using 1.2, then you could make a TextField with an email > validator. That gets bonus points for using a new feature :) > http://docs.djangoproject.com/en/dev/ref/forms/validation/#using-validators > > Alex > > On May 26, 8:24 am, Jonathan Hayward > wrote: > > Thanks! > > > > On Wed, May 26, 2010 at 5:32 AM, Daniel Roseman >wrote: > > > > > > > > > On May 25, 10:49 pm, Jonathan Hayward > > > wrote: > > > > For CharField, EmailField, URLField, etc., is VARCHAR implementation > > > > (meaning a fixed limit on length) absolutely non-negotiable, or there > a > > > way > > > > to make e.g. a CharField that won't truncate if you cross some > arbitrary > > > > length? > > > > > > (If you don't specify a length, does it assign a default length, or > use > > > TEXT > > > > instead of VARCHAR so that a field of indefinite length is > accommodated, > > > > resources permitting?) > > > > > EmailField is a subclass of CharField, so it always uses a varchar. As > > > the documentation notes, the default length if you don't specify one > > > is 75. > > > > > If you really want an email field based on TEXT, you could subclass > > > EmailField with a get_internal_type method that returns 'TextField'. > > > -- > > > DR. > > > > > -- > > > 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. > > > > -- > > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > > → An Orthodox Christian author: theology, literature, et cetera. > > → My award-winning collection is available for free reading online: > > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Fields validating as optional
What is the preferred way to make e.g. a TextField that will pass validation if it is left empty? I've seen two approaches apparently referenced in the documentation: additional_comments = models.TextField(required = False) additional_comments = models.TextField(blank = True) and run into errors with the first. Does this mean that I should go with the second, or is there another way that is preferred? I'm using 1.2. -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Fields validating as optional
Thanks, Dan and Daniel. On Tue, Jun 22, 2010 at 3:45 PM, Daniel Roseman wrote: > On Jun 22, 9:11 pm, Jonathan Hayward > wrote: > > What is the preferred way to make e.g. a TextField that will pass > validation > > if it is left empty? I've seen two approaches apparently referenced in > the > > documentation: > > > > additional_comments = models.TextField(required = False) > > > > additional_comments = models.TextField(blank = True) > > > > and run into errors with the first. Does this mean that I should go with > the > > second, or is there another way that is preferred? > > > > I'm using 1.2. > > The first is just wrong, and certainly isn't documented in that form. > You seem to have wrongly conflated some of the syntax from the forms > documentation with the models docs. > > Model fields take blank=True/False. Form fields take > 'required=False' (or True) as a parameter. However, the field in that > case would be forms.CharField, not models.TextField. > -- > DR. > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
django-tagging registering
I have, in my code: import tagging class Entity(models.Model): ... tagging.register(Entity) I'm getting an error. So far as I can tell, this is the only time tagging.register() is called, although I do call admin.site.register(Entity). Any ideas how I might be making a redundant request? If this is happening because the file is being imported more than once, what is an appropriate way to guarantee that Entity is only registered once? AlreadyRegistered at / The model 'Entity' has already been registered. Request Method:GETRequest URL:http://linux:8000/Exception Type: AlreadyRegisteredException Value: The model 'Entity' has already been registered. Exception Location:/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg/tagging/__init__.py in register, line 39Python Executable:/usr/bin/pythonPython Version:2.6.5Python Path:['/home/jonathan/directory', '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', '/home/jonathan/store/src/satchmo/satchmo/apps', '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']Server time:Wed, 23 Jun 2010 10:46:07 -0500 -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Looking for unavailable table?
I received the error below from the admin interface; I thought it was because I needed to run a syncdb, but stopping the server, running a syncdb, and restarting has generated the same error: OperationalError at /admin/directory/entity/ no such table: directory_entity Request Method:GETRequest URL:http://linux:8000/admin/directory/entity/Exception Type:OperationalErrorException Value: no such table: directory_entity Exception Location:/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py in execute, line 193Python Executable:/usr/bin/pythonPython Version:2.6.5Python Path:['/home/jonathan/directory', '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', '/home/jonathan/store/src/satchmo/satchmo/apps', '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']Server time:Fri, 25 Jun 2010 14:56:26 -0500 I have an Entity class/model defined in my models.py and want to manually create some dummy data in the table. Any suggestions? -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Looking for unavailable table?
P.S. Renaming the (SQLite) database file and running syncdb again produces (basically) the same behavior. I had to do some initialization things again, but outside of that I got equivalent behavior to what I pasted below. What I am trying to do is create a few instances of the Entity model defined in my [directory/]models.py. So far I have managed to get them to show up as an option to manage in the admin interface, but not yet to save one. Should it be looking for directory_models_entity instead of directory_entity? "entity" seems not to be populated; from the command line sqlite3: sqlite> .tables auth_group auth_user_user_permissions auth_group_permissions django_admin_log auth_messagedjango_content_type auth_permission django_session auth_user django_site auth_user_groups On Fri, Jun 25, 2010 at 3:00 PM, Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I received the error below from the admin interface; I thought it was > because I needed to run a syncdb, but stopping the server, running a syncdb, > and restarting has generated the same error: > > OperationalError at /admin/directory/entity/ > > no such table: directory_entity > > Request Method:GET Request URL:http://linux:8000/admin/directory/entity/ > Exception > Type:OperationalError Exception Value: > > no such table: directory_entity > > Exception > Location:/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py > in execute, line 193 Python Executable:/usr/bin/python Python Version: > 2.6.5 Python Path:['/home/jonathan/directory', > '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', > '/home/jonathan/store/src/satchmo/satchmo/apps', > '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', > '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', > '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', > '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', > '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', > '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', > '/usr/lib/python2.6/dist-packages/PIL', > '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', > '/usr/lib/python2.6/dist-packages/gtk-2.0', > '/usr/lib/pymodules/python2.6/gtk-2.0', > '/usr/local/lib/python2.6/dist-packages'] Server time:Fri, 25 Jun 2010 > 14:56:26 -0500 > > I have an Entity class/model defined in my models.py and want to manually > create some dummy data in the table. Any suggestions? > > -- > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > → An Orthodox Christian author: theology, literature, et cetera. > → My award-winning collection is available for free reading online: > ☩ I invite you to visit my main site at http://JonathansCorner.com/ > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Looking for unavailable table?
No; that sounds like the issue then? If my project directory is named "directory", and I want to access the "Entity" model in "models.py", what do I add to INSTALLED_APPS? I'm guessing something like "directory", but I briefly searched online and couldn't tell. On Fri, Jun 25, 2010 at 5:35 PM, Oleg Lomaka wrote: > > Did you add your application to INSTALLED_APPS before running syncdb? > > On Jun 26, 2010, at 12:09 AM, Jonathan Hayward wrote: > > > P.S. Renaming the (SQLite) database file and running syncdb again > produces (basically) the same behavior. I had to do some initialization > things again, but outside of that I got equivalent behavior to what I pasted > below. > > > > What I am trying to do is create a few instances of the Entity model > defined in my [directory/]models.py. So far I have managed to get them to > show up as an option to manage in the admin interface, but not yet to save > one. > > > > Should it be looking for directory_models_entity instead of > directory_entity? "entity" seems not to be populated; from the command line > sqlite3: > > > > sqlite> .tables > > auth_group auth_user_user_permissions > > auth_group_permissions django_admin_log > > auth_messagedjango_content_type > > auth_permission django_session > > auth_user django_site > > auth_user_groups > > > > On Fri, Jun 25, 2010 at 3:00 PM, Jonathan Hayward < > christos.jonathan.hayw...@gmail.com> wrote: > > I received the error below from the admin interface; I thought it was > because I needed to run a syncdb, but stopping the server, running a syncdb, > and restarting has generated the same error: > > > > OperationalError at /admin/directory/entity/ > > no such table: directory_entity > > Request Method: GET > > Request URL: http://linux:8000/admin/directory/entity/ > > Exception Type: OperationalError > > Exception Value: > > no such table: directory_entity > > Exception Location: > /usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py in execute, > line 193 > > Python Executable:/usr/bin/python > > Python Version: 2.6.5 > > Python Path: ['/home/jonathan/directory', > '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', > '/home/jonathan/store/src/satchmo/satchmo/apps', > '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', > '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', > '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', > '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', > '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', > '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', > '/usr/lib/python2.6/dist-packages/PIL', > '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', > '/usr/lib/python2.6/dist-packages/gtk-2.0', > '/usr/lib/pymodules/python2.6/gtk-2.0', > '/usr/local/lib/python2.6/dist-packages'] > > Server time: Fri, 25 Jun 2010 14:56:26 -0500 > > > > I have an Entity class/model defined in my models.py and want to manually > create some dummy data in the table. Any suggestions? > > > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Looking for unavailable table?
Thanks for pointing me to South. I've glanced over it, but I did have one question: My understanding is that Django will introduce tables for models that have been added on a syncdb, but not alter tables for models that have been changed. And from a glance at the documentation, it looks like South would provide more granularity. However, it is my understanding that this should have the consequence that if you start with a fresh database and run syncdb, then that should result in appropriate tables. This might not be a first choice way to update the database as normally wiping the database when you implement a schema update is not desirable if you have any real data, but my understanding from the documentation is that this forceful solution should work. If I'm mistaken, I'd like to know both how I presently misunderstand, and what an appropriate way is to generate a fresh database with tables matching your models. On Fri, Jun 25, 2010 at 5:25 PM, Mark Linsey wrote: > I don't quite understand what changes you made before producing this error, > and I'm totally unfamiliar with sqllite. > > But I do know that for many (really, most) different model changes, just > running syncdb will not make the appropriate changes to your tables. You > probably need to look into south migrations. > > On Fri, Jun 25, 2010 at 2:09 PM, Jonathan Hayward < > christos.jonathan.hayw...@gmail.com> wrote: > >> P.S. Renaming the (SQLite) database file and running syncdb again produces >> (basically) the same behavior. I had to do some initialization things again, >> but outside of that I got equivalent behavior to what I pasted below. >> >> What I am trying to do is create a few instances of the Entity model >> defined in my [directory/]models.py. So far I have managed to get them to >> show up as an option to manage in the admin interface, but not yet to save >> one. >> >> Should it be looking for directory_models_entity instead of >> directory_entity? "entity" seems not to be populated; from the command line >> sqlite3: >> >> sqlite> .tables >> auth_group auth_user_user_permissions >> auth_group_permissions django_admin_log >> auth_messagedjango_content_type >> auth_permission django_session >> auth_user django_site >> auth_user_groups >> >> On Fri, Jun 25, 2010 at 3:00 PM, Jonathan Hayward < >> christos.jonathan.hayw...@gmail.com> wrote: >> >>> I received the error below from the admin interface; I thought it was >>> because I needed to run a syncdb, but stopping the server, running a syncdb, >>> and restarting has generated the same error: >>> >>> OperationalError at /admin/directory/entity/ >>> >>> no such table: directory_entity >>> >>> Request Method:GET Request URL: >>> http://linux:8000/admin/directory/entity/ Exception Type: >>> OperationalError Exception Value: >>> >>> no such table: directory_entity >>> >>> Exception >>> Location:/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py >>> in execute, line 193 Python Executable:/usr/bin/python Python Version: >>> 2.6.5 Python Path:['/home/jonathan/directory', >>> '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', >>> '/home/jonathan/store/src/satchmo/satchmo/apps', >>> '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', >>> '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', >>> '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', >>> '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', >>> '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', >>> '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', >>> '/usr/lib/python2.6/dist-packages/PIL', >>> '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', >>> '/usr/lib/python2.6/dist-packages/gtk-2.0', >>> '/usr/lib/pymodules/python2.6/gtk-2.0', >>> '/usr/local/lib/python2.6/dist-packages'] Server time:Fri, 25 Jun 2010 >>> 14:56:26 -0500 >>> >>> I have an Entity class/model defined in my models.py and want to manually >>> create some dummy data in the table. Any suggestions? >>> >>> -- >>> → Jonathan Hayward, christos.jonathan.hayw...@gmail.com >>> → An Orthodox Chr
Re: Looking for unavailable table?
Thank you. I've updated my PYTHONPATH and INSTALLED_APPS, and now a syncdb is reporting errors instead of silently passing on, which seems to mean it's hitting my code a little more deeply than before. On Fri, Jun 25, 2010 at 5:57 PM, Oleg Lomaka wrote: > Actually it depends on your PYTHONPATH. syncdb scans all modules from > INSTALLED_APPS looking for models.py in them to populate database. So if you > access you Entity model (for example at views.py) as > from directory.models import Entity > then add 'directory' to INSTALLED_APPS. > > > On Jun 26, 2010, at 1:49 AM, Jonathan Hayward wrote: > > > No; that sounds like the issue then? > > > > If my project directory is named "directory", and I want to access the > "Entity" model in "models.py", what do I add to INSTALLED_APPS? I'm guessing > something like "directory", but I briefly searched online and couldn't tell. > > > > On Fri, Jun 25, 2010 at 5:35 PM, Oleg Lomaka > wrote: > > > > Did you add your application to INSTALLED_APPS before running syncdb? > > > > On Jun 26, 2010, at 12:09 AM, Jonathan Hayward wrote: > > > > > P.S. Renaming the (SQLite) database file and running syncdb again > produces (basically) the same behavior. I had to do some initialization > things again, but outside of that I got equivalent behavior to what I pasted > below. > > > > > > What I am trying to do is create a few instances of the Entity model > defined in my [directory/]models.py. So far I have managed to get them to > show up as an option to manage in the admin interface, but not yet to save > one. > > > > > > Should it be looking for directory_models_entity instead of > directory_entity? "entity" seems not to be populated; from the command line > sqlite3: > > > > > > sqlite> .tables > > > auth_group auth_user_user_permissions > > > auth_group_permissions django_admin_log > > > auth_messagedjango_content_type > > > auth_permission django_session > > > auth_user django_site > > > auth_user_groups > > > > > > On Fri, Jun 25, 2010 at 3:00 PM, Jonathan Hayward < > christos.jonathan.hayw...@gmail.com> wrote: > > > I received the error below from the admin interface; I thought it was > because I needed to run a syncdb, but stopping the server, running a syncdb, > and restarting has generated the same error: > > > > > > OperationalError at /admin/directory/entity/ > > > no such table: directory_entity > > > Request Method: GET > > > Request URL: http://linux:8000/admin/directory/entity/ > > > Exception Type: OperationalError > > > Exception Value: > > > no such table: directory_entity > > > Exception Location: > /usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py in execute, > line 193 > > > Python Executable:/usr/bin/python > > > Python Version: 2.6.5 > > > Python Path: ['/home/jonathan/directory', > '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', > '/home/jonathan/store/src/satchmo/satchmo/apps', > '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', > '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', > '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', > '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', > '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', > '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', > '/usr/lib/python2.6/dist-packages/PIL', > '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', > '/usr/lib/python2.6/dist-packages/gtk-2.0', > '/usr/lib/pymodules/python2.6/gtk-2.0', > '/usr/local/lib/python2.6/dist-packages'] > > > Server time: Fri, 25 Jun 2010 14:56:26 -0500 > > > > > > I have an Entity class/model defined in my models.py and want to > manually create some dummy data in the table. Any suggestions? > > > > > > > -- > > 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 th
Admin interface for model with optional 'self' relationship
I have a model with two foreign keys to itself: department = models.ForeignKey(u'self', blank = True, related_name = u'member') reports_to = models.ForeignKey(u'self', blank = True, related_name = u'subordinate') When I tried to save test data from the admin interface, leaving those items blank, I got a ValueError, pasted below. What do I need to be able to save test data? I'm willing to assign non-blank values to those fields for now, but there's a chicken-and-egg problem if the admin interface won't let me save any instances until I already have an instance saved. ValueError at /admin/directory/entity/add/ Cannot assign None: "Entity.department" does not allow null values. Request Method:POSTRequest URL:http://linux:8000/admin/directory/entity/add/Exception Type:ValueErrorException Value: Cannot assign None: "Entity.department" does not allow null values. Exception Location:/usr/lib/pymodules/python2.6/django/db/models/fields/related.py in __set__, line 269Python Executable:/usr/bin/pythonPython Version:2.6.5Python Path:['/home/jonathan/directory', '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', '/home/jonathan/store/src/satchmo/satchmo/apps', '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']Server time:Mon, 28 Jun 2010 15:13:53 -050 -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Looking for unavailable table?
P.S. This problem did not resurface after I made other changes discussed elsewhere in the thread; it seems to be secondary damage. On Mon, Jun 28, 2010 at 2:46 PM, Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > Thanks for pointing me to South. I've glanced over it, but I did have one > question: > > My understanding is that Django will introduce tables for models that have > been added on a syncdb, but not alter tables for models that have been > changed. And from a glance at the documentation, it looks like South would > provide more granularity. > > However, it is my understanding that this should have the consequence that > if you start with a fresh database and run syncdb, then that should result > in appropriate tables. This might not be a first choice way to update the > database as normally wiping the database when you implement a schema update > is not desirable if you have any real data, but my understanding from the > documentation is that this forceful solution should work. If I'm mistaken, > I'd like to know both how I presently misunderstand, and what an appropriate > way is to generate a fresh database with tables matching your models. > > > On Fri, Jun 25, 2010 at 5:25 PM, Mark Linsey wrote: > >> I don't quite understand what changes you made before producing this >> error, and I'm totally unfamiliar with sqllite. >> >> But I do know that for many (really, most) different model changes, just >> running syncdb will not make the appropriate changes to your tables. You >> probably need to look into south migrations. >> >> On Fri, Jun 25, 2010 at 2:09 PM, Jonathan Hayward < >> christos.jonathan.hayw...@gmail.com> wrote: >> >>> P.S. Renaming the (SQLite) database file and running syncdb again >>> produces (basically) the same behavior. I had to do some initialization >>> things again, but outside of that I got equivalent behavior to what I pasted >>> below. >>> >>> What I am trying to do is create a few instances of the Entity model >>> defined in my [directory/]models.py. So far I have managed to get them to >>> show up as an option to manage in the admin interface, but not yet to save >>> one. >>> >>> Should it be looking for directory_models_entity instead of >>> directory_entity? "entity" seems not to be populated; from the command line >>> sqlite3: >>> >>> sqlite> .tables >>> auth_group auth_user_user_permissions >>> auth_group_permissions django_admin_log >>> auth_messagedjango_content_type >>> auth_permission django_session >>> auth_user django_site >>> auth_user_groups >>> >>> On Fri, Jun 25, 2010 at 3:00 PM, Jonathan Hayward < >>> christos.jonathan.hayw...@gmail.com> wrote: >>> >>>> I received the error below from the admin interface; I thought it was >>>> because I needed to run a syncdb, but stopping the server, running a >>>> syncdb, >>>> and restarting has generated the same error: >>>> >>>> OperationalError at /admin/directory/entity/ >>>> >>>> no such table: directory_entity >>>> >>>> Request Method:GET Request URL: >>>> http://linux:8000/admin/directory/entity/ Exception Type: >>>> OperationalError Exception Value: >>>> >>>> no such table: directory_entity >>>> >>>> Exception >>>> Location:/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py >>>> in execute, line 193 Python Executable:/usr/bin/python Python Version: >>>> 2.6.5 Python Path:['/home/jonathan/directory', >>>> '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', >>>> '/home/jonathan/store/src/satchmo/satchmo/apps', >>>> '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', >>>> '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', >>>> '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', >>>> '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', >>>> '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', >>>> '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', >>>> '/usr/lib/python2.6/dist-packages/PIL', >>>> '/usr/lib/python2.6/dist-packa
Re: Admin interface for model with optional 'self' relationship
Thank you! Solved. On Mon, Jun 28, 2010 at 4:14 PM, Jeff Green wrote: > You need to also state that null=True. Also, you want to have ensure that > the field defined in your db > allows null values. > > On Mon, Jun 28, 2010 at 3:19 PM, Jonathan Hayward < > christos.jonathan.hayw...@gmail.com> wrote: > >> I have a model with two foreign keys to itself: >> >> department = models.ForeignKey(u'self', blank = True, related_name = >> u'member') >> reports_to = models.ForeignKey(u'self', blank = True, related_name = >> u'subordinate') >> >> When I tried to save test data from the admin interface, leaving those >> items blank, I got a ValueError, pasted below. What do I need to be able to >> save test data? I'm willing to assign non-blank values to those fields for >> now, but there's a chicken-and-egg problem if the admin interface won't let >> me save any instances until I already have an instance saved. >> >> ValueError at /admin/directory/entity/add/ >> >> Cannot assign None: "Entity.department" does not allow null values. >> >> Request Method: POST Request URL: >> http://linux:8000/admin/directory/entity/add/ Exception Type: ValueError >> Exception >> Value: >> >> Cannot assign None: "Entity.department" does not allow null values. >> >> Exception Location: >> /usr/lib/pymodules/python2.6/django/db/models/fields/related.py >> in __set__, line 269 Python Executable: /usr/bin/python Python Version: >> 2.6.5 Python Path: ['/home/jonathan/directory', >> '/usr/local/lib/python2.6/dist-packages/pip-0.6.3-py2.6.egg', >> '/home/jonathan/store/src/satchmo/satchmo/apps', >> '/usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_3-py2.6.egg', >> '/usr/local/lib/python2.6/dist-packages/django_signals_ahoy-0.1_1-py2.6.egg', >> '/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg', >> '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', >> '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', >> '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', >> '/usr/lib/python2.6/dist-packages/PIL', >> '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', >> '/usr/lib/python2.6/dist-packages/gtk-2.0', >> '/usr/lib/pymodules/python2.6/gtk-2.0', >> '/usr/local/lib/python2.6/dist-packages'] Server time: Mon, 28 Jun 2010 >> 15:13:53 -050 >> >> -- >> → Jonathan Hayward, christos.jonathan.hayw...@gmail.com >> → An Orthodox Christian author: theology, literature, et cetera. >> → My award-winning collection is available for free reading online: >> ☩ I invite you to visit my main site at >> http://JonathansCorner.com/<http://jonathanscorner.com/> >> >> -- >> 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. >> > > -- > 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. > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Log errors to file
I'm working on a view made to output JSON for Ajax use. My log has: [07/Jul/2010 17:47:13] "POST /ajax/login HTTP/1.1" 500 50678 That looks like Django gave a helpful and detailed stacktrace page, albeit to jQuery expecting JSON. How can I ask Django to log uncaught exceptions to a file or equivalent? The test server has no MTA so I can't really ask it to email me exceptions. TIA, -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Serializing non-queryset data
I just tried: json_serializer.serialize(result, ensure_ascii = False, stream = response) where result was boolean. I got an error complaining that it was not iterable, and http://docs.djangoproject.com/en/dev/topics/serialization/seems to discuss serialization of querysets. In this case I can easily enough create JSON manually, but is there a preferred way to take dicts, lists, strings, numbers, etc. and render a structure as JSON? -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Log errors to file
Thank you! On Wed, Jul 7, 2010 at 5:35 PM, elijah rutschman wrote: > You could implement a middleware class with a process_exception > method. See: > http://docs.djangoproject.com/en/dev/topics/http/middleware/#process_exception > > -Elijah > > On Wed, Jul 7, 2010 at 4:35 PM, Jonathan Hayward > wrote: > > I'm working on a view made to output JSON for Ajax use. My log has: > > [07/Jul/2010 17:47:13] "POST /ajax/login HTTP/1.1" 500 50678 > > That looks like Django gave a helpful and detailed stacktrace page, > albeit > > to jQuery expecting JSON. > > How can I ask Django to log uncaught exceptions to a file or equivalent? > The > > test server has no MTA so I can't really ask it to email me exceptions. > > > > TIA, > > -- > > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > > → An Orthodox Christian author: theology, literature, et cetera. > > → My award-winning collection is available for free reading online: > > ☩ I invite you to visit my main site at http://JonathansCorner.com/ > > > > -- > > 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. > > > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Serializing non-queryset data
Never mind; I found: import json def view(request): ... my_result = ... return HttpResponse(json.dumps(my_result), mimetype="application/json") On Wed, Jul 7, 2010 at 6:05 PM, Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I just tried: > > json_serializer.serialize(result, ensure_ascii = False, stream = response) > > where result was boolean. I got an error complaining that it was not > iterable, and http://docs.djangoproject.com/en/dev/topics/serialization/seems > to discuss serialization of querysets. > > In this case I can easily enough create JSON manually, but is there a > preferred way to take dicts, lists, strings, numbers, etc. and render a > structure as JSON? > > -- > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > → An Orthodox Christian author: theology, literature, et cetera. > → My award-winning collection is available for free reading online: > ☩ I invite you to visit my main site at http://JonathansCorner.com/ > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Look up model instance by id
How do I look up a model instance by id (its primary key)? I have: entity = directory.models.Entity.objects.filter(id__equals = id)[0] and am getting: FieldError at /profile/1 Join on field 'id' not permitted. Did you misspell 'equals' for the lookup type? Is there another way I should be going about this given the id field beforehand? -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Log errors to file
I'm interested and I doubt I'm the only one. On Thu, Jul 8, 2010 at 4:34 AM, euan.godd...@googlemail.com < euan.godd...@gmail.com> wrote: > I have created a decorator for Django views which handles AJAX > tracebacks and sends the traceback back to the AJAX application as > JSON, e.g. > > {'status':'error', 'message': } > > It uses the traceback module to output the full traceback. Obviously > you need to have a handler that receives this data and displays in on > the page (although you can inspect it in firebug). > > If you'd like the code for it, I can ask my company whether they'd be > happy with me publishing it. > > Cheers, Euan > > On Jul 7, 10:35 pm, Jonathan Hayward > wrote: > > I'm working on a view made to output JSON for Ajax use. My log has: > > > > [07/Jul/2010 17:47:13] "POST /ajax/login HTTP/1.1" 500 50678 > > > > That looks like Django gave a helpful and detailed stacktrace page, > albeit > > to jQuery expecting JSON. > > > > How can I ask Django to log uncaught exceptions to a file or equivalent? > The > > test server has no MTA so I can't really ask it to email me exceptions. > > > > TIA, > > -- > > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > > → An Orthodox Christian author: theology, literature, et cetera. > > → My award-winning collection is available for free reading online: > > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Look up model instance by id
Thank you; the first seemed to work nicely. On Wed, Jul 14, 2010 at 2:36 PM, ringemup wrote: > Try: > >directory.models.Entity.objects.get(pk=id) > > Which does pretty much the same thing as: > >directory.models.Entity.objects.filter(id__exact = id)[0] > > (note id__exact rather than id__equals) > > > > On Jul 14, 3:18 pm, Jonathan Hayward > wrote: > > How do I look up a model instance by id (its primary key)? I have: > > > > entity = directory.models.Entity.objects.filter(id__equals = id)[0] > > > > and am getting: > > > > FieldError at /profile/1 > > > > Join on field 'id' not permitted. Did you misspell 'equals' for the > lookup type? > > > > Is there another way I should be going about this given the id field > > beforehand? > > > > -- > > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > > → An Orthodox Christian author: theology, literature, et cetera. > > → My award-winning collection is available for free reading online: > > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Plain Python traceback (not error page)
I am working on debugging a basic template, and after correcting some other error, I got: Traceback (most recent call last): File "/usr/local/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 280, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 674, in __call__ return self.application(environ, start_response) File "/usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 245, in __call__ response = middleware_method(request, response) File "/usr/local/lib/python2.6/site-packages/django/contrib/sessions/middleware.py", line 26, in process_response patch_vary_headers(response, ('Cookie',)) File "/usr/local/lib/python2.6/site-packages/django/utils/cache.py", line 127, in patch_vary_headers if response.has_header('Vary'): AttributeError: 'SafeUnicode' object has no attribute 'has_header' This wasn't the usual format for a Django traceback, and the traceback is only in Django code, no reference to my project. Suggestions? Would it make sense to open a bug? -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Plain Python traceback (not error page)
Thank you; noted; that fixed it. On Thu, Jul 15, 2010 at 5:51 AM, Tom Evans wrote: > On Wed, Jul 14, 2010 at 8:48 PM, Jonathan Hayward > wrote: > > I am working on debugging a basic template, and after correcting some > other > > error, I got: > > > > Traceback (most recent call last): > > > > File > > "/usr/local/lib/python2.6/site-packages/django/core/servers/basehttp.py", > > line 280, in run > > self.result = application(self.environ, self.start_response) > > > > File > > "/usr/local/lib/python2.6/site-packages/django/core/servers/basehttp.py", > > line 674, in __call__ > > return self.application(environ, start_response) > > > > File > > "/usr/local/lib/python2.6/site-packages/django/core/handlers/wsgi.py", > line > > 245, in __call__ > > response = middleware_method(request, response) > > > > File > > > "/usr/local/lib/python2.6/site-packages/django/contrib/sessions/middleware.py", > > line 26, in process_response > > patch_vary_headers(response, ('Cookie',)) > > > > File "/usr/local/lib/python2.6/site-packages/django/utils/cache.py", > line > > 127, in patch_vary_headers > > if response.has_header('Vary'): > > > > AttributeError: 'SafeUnicode' object has no attribute 'has_header' > > > > This wasn't the usual format for a Django traceback, and the traceback is > > only in Django code, no reference to my project. > > Suggestions? Would it make sense to open a bug? > > > > The error isn't triggered in your code, but it is triggered by your code. > > You must return a HttpResponse object from a view, not a string. > Whatever view you are hitting here is returning a SafeUnicode, so it > is probably coming from a template renderer. > > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
How do I translate a naming convention to model/database access?
I'm looking at a problem and see how to solve it, probably badly, with eval(), but don't see what the right solution is. I want to use Jeditable more or less to make fields on models editable. Jeditable sends the HTML ID, as well as updated value, when someone makes an in_place edit. I am following a convention where the HTML ID is something like *model*_*field*_*id*, and I would like an Ajax view to do some error checking and if the provided ID is appropriate, take an ID of entity_description_1 to pull up the Entity with id 1 and set its description field to the updated value. I see a way to do this with eval, badly, but what I'd guess of Django is that there's a way to call .get(model_name) or something like that to avoid an eval. Is there a dynamic equivalent to directory.models.Entity.objects.get(pk = 1) or instance.description = value where "Entity" and "description" are effectively replaced by dynamically provided values? -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: How do I translate a naming convention to model/database access?
Thank you! Let me play with it. On Thu, Jul 15, 2010 at 10:41 AM, Daniel Roseman wrote: > On Jul 15, 4:19 pm, Jonathan Hayward > wrote: > > I'm looking at a problem and see how to solve it, probably badly, with > > eval(), but don't see what the right solution is. > > > > I want to use Jeditable more or less to make fields on models editable. > > Jeditable sends the HTML ID, as well as updated value, when someone makes > an > > in_place edit. I am following a convention where the HTML ID is something > > like *model*_*field*_*id*, and I would like an Ajax view to do some error > > checking and if the provided ID is appropriate, take an ID of > > entity_description_1 to pull up the Entity with id 1 and set its > description > > field to the updated value. > > > > I see a way to do this with eval, badly, but what I'd guess of Django is > > that there's a way to call .get(model_name) or something like that to > avoid > > an eval. Is there a dynamic equivalent to > > directory.models.Entity.objects.get(pk = 1) or instance.description = > value > > where "Entity" and "description" are effectively replaced by dynamically > > provided values? > > > > Yes - although you need the name of the app as well as the model. > >from django.db.models import get_model >my_model = get_model('myapp', 'Entity') >my_instance = my_model.objects.get(pk=my_pk_value) >setattr(my_instance, fieldname, fieldvalue) >my_instance.save() > > -- > DR. > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: How do I translate a naming convention to model/database access?
Thank you. I'm off and running. On Thu, Jul 15, 2010 at 11:54 AM, Ben Atkin wrote: > Oops - I should have copied and pasted from my repl. The first line should > be: > > from django.contrib.contenttypes.models import ContentType > > Ben > > > On Thu, Jul 15, 2010 at 10:52 AM, Ben Atkin wrote: > >> You could use Django's content types, too. >> >> from django.contrib.content_types.models import ContentType >> my_ct = ContentType.objects.get(app_label='my_app', model='MyModel') >> # ...or you could leave off app_label, if there are no conflicting model >> names >> my_ct.get_object_for_this_type(pk=my_pk) >> >> That way you could use get_object_or_404() in your view. >> >> Ben >> >> >> On Thu, Jul 15, 2010 at 10:21 AM, Jonathan Hayward < >> christos.jonathan.hayw...@gmail.com> wrote: >> >>> Thank you! Let me play with it. >>> >>> >>> On Thu, Jul 15, 2010 at 10:41 AM, Daniel Roseman >>> wrote: >>> >>>> On Jul 15, 4:19 pm, Jonathan Hayward >>>> wrote: >>>> > I'm looking at a problem and see how to solve it, probably badly, with >>>> > eval(), but don't see what the right solution is. >>>> > >>>> > I want to use Jeditable more or less to make fields on models >>>> editable. >>>> > Jeditable sends the HTML ID, as well as updated value, when someone >>>> makes an >>>> > in_place edit. I am following a convention where the HTML ID is >>>> something >>>> > like *model*_*field*_*id*, and I would like an Ajax view to do some >>>> error >>>> > checking and if the provided ID is appropriate, take an ID of >>>> > entity_description_1 to pull up the Entity with id 1 and set its >>>> description >>>> > field to the updated value. >>>> > >>>> > I see a way to do this with eval, badly, but what I'd guess of Django >>>> is >>>> > that there's a way to call .get(model_name) or something like that to >>>> avoid >>>> > an eval. Is there a dynamic equivalent to >>>> > directory.models.Entity.objects.get(pk = 1) or instance.description = >>>> value >>>> > where "Entity" and "description" are effectively replaced by >>>> dynamically >>>> > provided values? >>>> > >>>> >>>> Yes - although you need the name of the app as well as the model. >>>> >>>>from django.db.models import get_model >>>>my_model = get_model('myapp', 'Entity') >>>>my_instance = my_model.objects.get(pk=my_pk_value) >>>>setattr(my_instance, fieldname, fieldvalue) >>>>my_instance.save() >>>> >>>> -- >>>> DR. >>>> >>>> -- >>>> 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. >>>> >>>> >>> >>> >>> -- >>> → Jonathan Hayward, christos.jonathan.hayw...@gmail.com >>> → An Orthodox Christian author: theology, literature, et cetera. >>> → My award-winning collection is available for free reading online: >>> ☩ I invite you to visit my main site at http://JonathansCorner.com/ >>> >>> -- >>> 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. >>> >> >> > -- > 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. > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Many-to-one field in search
I am trying to make an EmailField variant which: 1: Is based on TEXT rather than VARCHAR, and 2: May be in a many-to-one relationship with entity. I presently have: class TextEmailField(models.EmailField): entity = models.ForeignKey(Entity) def __init__(self, *arguments, **keywords): models.EmailField.__init__(self, *arguments, **keywords) def get_internal_type(self): return u'TextField' A search for emails for a given Entity id is: emails = directory.models.TextEmailField.objects.filter(entity__exact = id).all() This is getting the error below. My best interpretation is that I'm attempting an operation on a field that is only defined for models. Is this correct? How should I be remedying it? AttributeError at /profile/1 type object 'TextEmailField' has no attribute 'objects' Request Method:GETRequest URL:http://netbook:8000/profile/1Django Version: 1.2.1Exception Type:AttributeErrorException Value: type object 'TextEmailField' has no attribute 'objects' Exception Location:/home/jonathan/directory/../directory/views.py in profile, line 37Python Executable:/usr/local/bin/pythonPython Version:2.6.5Python Path:['/home/jonathan/directory', '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', '/usr/local/lib/python2.6/plat-linux2', '/usr/local/lib/python2.6/lib-tk', '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/site-packages']Server time:Thu, 22 Jul 2010 16:26:04 -0500 -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Many-to-one field in search
Would it make sense to make A: A TextEmailField which does not have the ForeignKey, and B: A model which has the foreign key and a TextEmailField as a better and more standard approach? On Thu, Jul 22, 2010 at 3:13 PM, Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I am trying to make an EmailField variant which: > > 1: Is based on TEXT rather than VARCHAR, and > > 2: May be in a many-to-one relationship with entity. > > I presently have: > > class TextEmailField(models.EmailField): > entity = models.ForeignKey(Entity) > def __init__(self, *arguments, **keywords): > models.EmailField.__init__(self, *arguments, **keywords) > def get_internal_type(self): > return u'TextField' > > A search for emails for a given Entity id is: > > emails = directory.models.TextEmailField.objects.filter(entity__exact = > id).all() > > This is getting the error below. My best interpretation is that I'm > attempting an operation on a field that is only defined for models. Is this > correct? How should I be remedying it? > > AttributeError at /profile/1 > > type object 'TextEmailField' has no attribute 'objects' > > Request Method:GET Request URL:http://netbook:8000/profile/1 Django > Version:1.2.1 Exception Type:AttributeError Exception Value: > > type object 'TextEmailField' has no attribute 'objects' > > Exception Location:/home/jonathan/directory/../directory/views.py in > profile, line 37 Python Executable:/usr/local/bin/python Python Version: > 2.6.5 Python Path:['/home/jonathan/directory', > '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', > '/usr/local/lib/python2.6/plat-linux2', '/usr/local/lib/python2.6/lib-tk', > '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', > '/usr/local/lib/python2.6/site-packages'] Server time:Thu, 22 Jul 2010 > 16:26:04 -0500 > > > -- > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > → An Orthodox Christian author: theology, literature, et cetera. > → My award-winning collection is available for free reading online: > ☩ I invite you to visit my main site at http://JonathansCorner.com/ > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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: Many-to-one field in search
Thank you! On Fri, Jul 23, 2010 at 1:44 AM, Daniel Roseman wrote: > On Jul 22, 9:55 pm, Jonathan Hayward > wrote: > > Would it make sense to make > > > > A: A TextEmailField which does not have the ForeignKey, and > > > > B: A model which has the foreign key and a TextEmailField > > > > as a better and more standard approach? > > Yes, that would make more sense. You could use an inline formset to > allow editing of multiple email addresses for each main record. > -- > DR. > > -- > 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. > > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Django and light bulbs
Q: How many Django developers does it take to change a light bulb? A: *NONE.* (There's an application for that that comes standard with any Django installation.) -- → Jonathan Hayward, a Senior Web Developer who cares deeply about usability → www.linkedin.com/in/jonathanhayward • jonathan.hayw...@pobox.com → Ajax, CGI, CMS, CSS, HTML, IA, JSON, JavaScript, LAMP, Linux, Perl, PHP, Python, SQL, UI, Unix, Usability, UX, XHTML, XML → With a good interest in the human side of computing and making software and websites a joy to use -- 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.
Trouble installing satchmo
I'm trying to get satchmo up and running from the instructions at http://bitbucket.org/chris1610/satchmo/downloads/Satchmo.pdf , and when I get to 2.1.3 (installing PIL manually as a workaround), there is no /bin/clonesatchmo.py. After digging around, I move the scripts from the install directory to under /usr/local, and create a symlink to clonesatchmo.py. But it can't find things; my guess is that it's looking in my PYTHONPATH and the same install issues that left no /bin/clonesatchmo.py has left no Python files installed to the default PYTHONPATH. I get: $ python /bin/clonesatchmo.py Creating the Satchmo Application Traceback (most recent call last): File "/bin/clonesatchmo.py", line 108, in create_satchmo_site(opts.site_name) File "/bin/clonesatchmo.py", line 47, in create_satchmo_site import satchmo_skeleton ImportError: No module named satchmo_skeleton Do people have suggestions, including going to a Satchmo-specific list if this list is not intended to discuss Django add-ons like Satchmo or Pinax? -- → Jonathan Hayward, a Senior Web Developer who cares deeply about usability → www.linkedin.com/in/jonathanhayward • jonathan.hayw...@pobox.com → Ajax, CGI, CMS, CSS, HTML, IA, JSON, JavaScript, LAMP, Linux, Perl, PHP, Python, SQL, UI, Unix, Usability, UX, XHTML, XML → With a good interest in the human side of computing and making software and websites a joy to use -- 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: Trouble installing satchmo
Thank you, Andrew and Laszlo. On Mon, Mar 22, 2010 at 3:17 PM, Laszlo Antal wrote: > Hi, > > I use this installation and it works. > http://bitbucket.org/chris1610/satchmo/wiki/ImprovedInstallationProcess > > <http://bitbucket.org/chris1610/satchmo/wiki/ImprovedInstallationProcess>Hope > it helps > > lzantal > > > > On Mon, Mar 22, 2010 at 12:14 PM, Andrew wrote: > >> Go to: >> http://groups.google.com/group/satchmo-users >> >> On 15 мар, 20:10, Jonathan Hayward >> wrote: >> > I'm trying to get satchmo up and running from the instructions athttp:// >> bitbucket.org/chris1610/satchmo/downloads/Satchmo.pdf, and when I >> > get to 2.1.3 (installing PIL manually as a workaround), there is no >> > /bin/clonesatchmo.py. After digging around, I move the scripts from the >> > install directory to under /usr/local, and create a symlink to >> > clonesatchmo.py. But it can't find things; my guess is that it's looking >> in >> > my PYTHONPATH and the same install issues that left no >> /bin/clonesatchmo.py >> > has left no Python files installed to the default PYTHONPATH. I get: >> > >> > $ python /bin/clonesatchmo.py >> > Creating the Satchmo Application >> > Traceback (most recent call last): >> > File "/bin/clonesatchmo.py", line 108, in >> > create_satchmo_site(opts.site_name) >> > File "/bin/clonesatchmo.py", line 47, in create_satchmo_site >> > import satchmo_skeleton >> > ImportError: No module named satchmo_skeleton >> > >> > Do people have suggestions, including going to a Satchmo-specific list >> if >> > this list is not intended to discuss Django add-ons like Satchmo or >> Pinax? >> > >> > -- >> > → Jonathan Hayward, a Senior Web Developer who cares deeply about >> usability >> > →www.linkedin.com/in/jonathanhayward• jonathan.hayw...@pobox.com >> > → Ajax, CGI, CMS, CSS, HTML, IA, JSON, JavaScript, LAMP, Linux, Perl, >> PHP, >> > Python, SQL, UI, Unix, Usability, UX, XHTML, XML >> > → With a good interest in the human side of computing and making >> software >> > and websites a joy to use >> >> -- >> 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. >> >> > -- > 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. > -- → Jonathan Hayward, christos.jonathan.hayw...@gmail.com → An Orthodox Christian author: theology, literature, et cetera. → My award-winning collection is available for free reading online: ☩ I invite you to visit my main site at http://JonathansCorner.com/ -- 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.
Taking advantage of multiple cores
Will a slightly older version of Pinax, installed on top of a newer version of Django, take advantage (or be configurable to take advantage) of multiple cores? In other words, if one request is rendering and another request comes in while the first is rendering, will Django or Pinax offload the second request to another core? If this isn't the default, can it be enabled, and are there race conditions or other risks? Thanks, -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Jonathan Hayward, an Orthodox Christian author. *Amazon* <https://www.amazon.com/author/cjshayward> • Author Bio<http://jonathanscorner.com/author/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Google Plus <http://jonathanscorner.com/plus> • *Kindle<http://stornge.com/amazon> * • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. *See a random page! <http://random.jonathanscorner.com/>* -- 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.
Difficulties deploying Satchmo store
I am trying to deploy a "Hello, world!" Satchmo store and have had difficulties under Apache with mod_wsgi, Gunicorn (fails immediately on attempted start), and mod_fcgi (I can start the daemon on 127.0.0.1 port 1234, but my attempt to get live web interaction didn't pan out. Part of my problem is that I haven't found mod_fcgi examples. Could I have an example of a .fcgi file that says to connect to this port on this IP, with indicators of any additional information needed (like the project path or the deploy subdirectory.) Jonathan Hayward, Author, Django JavaScript Integration: AJAX and jQuery Toastmaster and Published Author (Excellent Written and Oral Communicator) Ajax, CGI, CMS, CSS, Django, HTML, IA, JSON, JavaScript, LAMP, Linux, Perl, PHP, Python, SQL, UI, Unix, Usability, UX, XHTML, XML With a good interest in the human side of computing and making software and websites a joy to use -- 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.
Added wiring for basic authentication?
I have a Django project with the root view @login_required, and I'm not sure how to populate /accounts so that that heirarchy will hangle login-related information. The Django Book at https://docs.djangoproject.com/en/dev/topics/auth/ seems to say that it will happen automagically with my default settings.py: "Authentication support is bundled as a Django application in django.contrib.auth. To install it, do the following: "Put 'django.contrib.auth' and 'django.contrib.contenttypes' in your INSTALLED_APPS setting [*they are there from when settings.py was generated*]. (The Permission model in django.contrib.auth depends on django.contrib.contenttypes.) Run the command manage.py syncdb. Note that the default settings.py file created by django-admin.py startproject includes 'django.contrib.auth' and 'django.contrib.contenttypes' in INSTALLED_APPS for convenience. If your INSTALLED_APPS already contains these apps, feel free to run manage.py syncdb again; you can run that command as many times as you’d like, and each time it’ll only install what’s needed. "The syncdb command creates the necessary database tables, creates permission objects for all installed apps that need ‘em, and prompts you to create a superuser account the first time you run it. "Once you’ve taken those steps, that’s it." When I decorate my root view with @login_required, I get redirected to http://localhost:8000/accounts/login/?next=/, which presents the Django debug mode 404 page. I am running Django 1.2.1. How can I glue things together so a @login_required decorator finds a logged-in user, and I can build on top of that? -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. *Amazon <http://amazon.com/author/cjshayward>* • Author Bio<http://jonathanscorner.com/author/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Google Plus <http://jonathanscorner.com/plus> • *Kindle<http://stornge.com/amazon> * • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • *Professional<http://JonathanHayward.com> * • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. *See one page of my website! <http://random.jonathanscorner.com/>* -- 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.
Deploy to stodgy Apache
I have a somewhat stodgy Apache server, running under SunOS, and I would like an appropriate way to deploy a Django application based at /shop/ or some other URL. The server seems set up to allow FastCGI in some form; there is an /fcgi-bin/ directory with one entry. Apache does not recognize the FastCGIExternalServer directive. Is there a way I can leverage the /fcgi-bin/ directory and httpd.conf so that requests for /shop/foo/ are serviced by Django? -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
English translation for error message?
[jhayw...@cmlnxbld01 invdb]$ python manage.py shell Python 2.7 (r27:82500, Dec 2 2010, 14:06:29) [GCC 4.2.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> import models Traceback (most recent call last): File "", line 1, in File "/home/jhayward/invdb/models.py", line 50, in class architecture(models.Model): File "/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/django/db/models/base.py", line 48, in __new__ kwargs = {"app_label": model_module.__name__.split('.')[-2]} IndexError: list index out of range >>> What is going on in this error message? It occurred after I went through and added docstrings, __str__(), and __unicode__() methods; I get the same error, referring to the same class, when I go through and comment out the docstring and __str__() and __unicode__() methods. What are the likely causes, and what can I do to fix this? -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Attempting to save instance with null ID?
I'm migrating from SQLite to Oracle, and I'm getting an error thrown on the line disn_requisition.save() claiming that it has a null ID. I have not attempted to manually set or fiddle with id fields on any model, although I do read them. Any insight on what I need to do to address this? IntegrityError at /upload/storage ORA-01400: cannot insert NULL into ("INVDB"."INVDB_DISK_REQUISITION"."ID") Request Method: POST Request URL: http://cmlnxbld01:8000/upload/storage Django Version: 1.2.3 Exception Type: IntegrityError Exception Value: ORA-01400: cannot insert NULL into ("INVDB"."INVDB_DISK_REQUISITION"."ID") Exception Location: /tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/django/db/backends/oracle/base.py in execute, line 507 Python Executable: /tools/python/2.7/Linux_x86_64/bin/python Python Version: 2.7.0 Python Path: ['/home/jhayward/invdb', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/django_filter-0.5.3-py2.7.egg', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/ez_setup-0.9-py2.7.egg', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/hgsvn-0.1.8-py2.7.egg', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/paramiko-1.7.6-py2.7.egg', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/pycrypto-2.3-py2.7-linux-x86_64.egg', '/tools/python/cx_Oracle/10g/2.6/Linux_x86_64/lib/python2.6/site-packages', '/home/jhayward', '/home/jhayward/invdb/HOME_DIRECTORY', '/home/jhayward/invdb/HOME_DIRECTORY/invdb', '/tools/python/2.7/Linux_x86_64/lib/python27.zip', '/tools/python/2.7/Linux_x86_64/lib/python2.7', '/tools/python/2.7/Linux_x86_64/lib/python2.7/plat-linux2', '/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-tk', '/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-old', '/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-dynload', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages', '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info'] Server time: Thu, 30 Dec 2010 10:04:24 -0600 -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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 step to syncdb from models.py?
I am missing a step in configuration, I believe, in getting a syncdb to create tables for the models in models.py. I've attached a tarball of a project foo, in which I created a model bar, and ran a python manage.py syncdb, with the output scripted to syncdb.out. Some tables have been created; however the table foo_bar does not exist. What is the step that I am missing? If I wipe the database, what do I need to do so that a python manage.py syncdb will create tables like foo_bar for the contents of models.py? (And on a related note, is there any additional configuration to get all the tables created for the Django admin interface to work? For another project, I couldn't save objects because an admin interface table didn't exist.) -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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. foo.tgz Description: GNU Zip compressed data
Re: Missing step to syncdb from models.py?
I found the problem. I needed to put 'foo' (and 'django.contrib.admin') in settings.INSTALLED_APPS. On Sat, Apr 9, 2011 at 2:29 PM, Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I am missing a step in configuration, I believe, in getting a syncdb to > create tables for the models in models.py. > > I've attached a tarball of a project foo, in which I created a model bar, > and ran a python manage.py syncdb, with the output scripted to syncdb.out. > Some tables have been created; however the table foo_bar does not exist. > > What is the step that I am missing? If I wipe the database, what do I need > to do so that a python manage.py syncdb will create tables like foo_bar for > the contents of models.py? > > (And on a related note, is there any additional configuration to get all > the tables created for the Django admin interface to work? For another > project, I couldn't save objects because an admin interface table didn't > exist.) > > -- > [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> > Christos Jonathan Hayward, an Orthodox Christian author. > > Author Bio <http://jonathanscorner.com/author/> • > Books<http://cjshayward.com/> > • *Email * • > Facebook<http://www.facebook.com/christos.jonathan.hayward> > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • > Twitter<http://twitter.com/JonathansCorner> > • *Web <http://jonathanscorner.com/>* • What's > New?<http://jonathanscorner.com/> > I invite you to visit my "theology, literature, and other creative works" > site. > > -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Migration: AlreadyRegistered
I am trying to migrate from one server to another: I tarred it up on the Linux server, untarred on a Mac, got one or two complaints about missing packages, and when I had resolved them, got the error below. Entity is the name of one of my models. What does this mean, and how is this issue addressed? (I had been actively developing on the old server and don't remember seeing this error.) AlreadyRegistered at / The model Entity is already registered Request Method:GETRequest URL:http://localhost:8000/Django Version:1.2.1Exception Type:AlreadyRegisteredException Value: The model Entity is already registered Exception Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py in register, line 78Python Executable:/usr/bin/pythonPython Version:2.6.1Python Path:['/Users/jonathan/directory', '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg', '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', '/Library/Python/2.6/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']Server time:Tue, 17 Aug 2010 19:53:40 -0500 -- [image: Christos Jonathan Hayward ← An Orthodox Christian author.]<http://JonathansCorner.com> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://JonathansCorner.com/author/> • Books<http://CJSHayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://JonathansCorner.com/>* • What's New?<http://JonathansCorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Migration: AlreadyRegistered
Thank you; I'm not seeing how. My admin.py reads: import django.contrib.admin import directory.models import tagging django.contrib.admin.autodiscover() django.contrib.admin.site.register(directory.models.Entity) django.contrib.admin.site.register(directory.models.Location) tagging.register(directory.models.Entity) Commenting the tagging.register() call doesn't seem to make a difference. On Tue, Aug 17, 2010 at 8:27 PM, Sam Lai wrote: > It means somehow you're calling this line in an admin.py file twice - > > admin.site.register(Entity) > > Check the admin.py file for the app that contains the Entity model. > > On 18 August 2010 10:57, Christos Jonathan Hayward < > christos.jonathan.hayw...@gmail.com> wrote: > >> I am trying to migrate from one server to another: I tarred it up on the >> Linux server, untarred on a Mac, got one or two complaints about missing >> packages, and when I had resolved them, got the error below. >> >> Entity is the name of one of my models. What does this mean, and how is >> this issue addressed? (I had been actively developing on the old server and >> don't remember seeing this error.) >> >> AlreadyRegistered at / >> >> The model Entity is already registered >> >> Request Method:GET Request URL:http://localhost:8000/ Django Version: >> 1.2.1 Exception Type:AlreadyRegistered Exception Value: >> >> The model Entity is already registered >> >> Exception >> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py >> in register, line 78 Python Executable:/usr/bin/python Python Version: >> 2.6.1 Python Path:['/Users/jonathan/directory', >> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg', >> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', >> '/Library/Python/2.6/site-packages', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode'] >> Server >> time:Tue, 17 Aug 2010 19:53:40 -0500 >> -- >> [image: Christos Jonathan Hayward ← An Orthodox Christian >> author.]<http://JonathansCorner.com> >> Christos Jonathan Hayward, an Orthodox Christian author. >> >> Author Bio <http://JonathansCorner.com/author/> • >> Books<http://CJSHayward.com/> >> • *Email * • >> Facebook<http://www.facebook.com/christos.jonathan.hayward> >> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • >> Twitter<http://twitter.com/JonathansCorner> >> • *Web <http://JonathansCorner.com/>* • What's >> New?<http://JonathansCorner.com/> >> I invite you to visit my "theology, literature, and other creative works" >> site. >> >> -- >> 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. >> > > -- > 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. > -- [image: Christos Jonathan Hayward ← An Orthodox Christian author.]<http://JonathansCorner.com> Chr
Re: Migration: AlreadyRegistered
I realized there may have been some pre-existing stuff in the directory, so I renamed it and extracted fresh from tarball. I got an error I had seen earlier but couldn't reproduce: AttributeError at / 'module' object has no attribute 'register' Request Method:GETRequest URL:http://localhost:8000/Django Version:1.2.1Exception Type:AttributeErrorException Value: 'module' object has no attribute 'register' Exception Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/utils/importlib.py in import_module, line 35Python Executable:/usr/bin/pythonPython Version: 2.6.1Python Path:['/Users/jonathan/directory', '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg', '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', '/Library/Python/2.6/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']Server time:Tue, 17 Aug 2010 21:20:53 -0500 On Tue, Aug 17, 2010 at 8:39 PM, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > Thank you; I'm not seeing how. My admin.py reads: > > import django.contrib.admin > import directory.models > import tagging > > django.contrib.admin.autodiscover() > django.contrib.admin.site.register(directory.models.Entity) > django.contrib.admin.site.register(directory.models.Location) > tagging.register(directory.models.Entity) > > > Commenting the tagging.register() call doesn't seem to make a difference. > > On Tue, Aug 17, 2010 at 8:27 PM, Sam Lai wrote: > >> It means somehow you're calling this line in an admin.py file twice - >> >> admin.site.register(Entity) >> >> Check the admin.py file for the app that contains the Entity model. >> >> On 18 August 2010 10:57, Christos Jonathan Hayward < >> christos.jonathan.hayw...@gmail.com> wrote: >> >>> I am trying to migrate from one server to another: I tarred it up on the >>> Linux server, untarred on a Mac, got one or two complaints about missing >>> packages, and when I had resolved them, got the error below. >>> >>> Entity is the name of one of my models. What does this mean, and how is >>> this issue addressed? (I had been actively developing on the old server and >>> don't remember seeing this error.) >>> >>> AlreadyRegistered at / >>> >>> The model Entity is already registered >>> >>> Request Method:GET Request URL:http://localhost:8000/ Django Version: >>> 1.2.1 Exception Type:AlreadyRegistered Exception Value: >>> >>> The model Entity is already registered >>> >>> Exception >>> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py >>> in register, line 78 Python Executable:/usr/bin/python Python Version: >>> 2.6.1 Python Path:['/Users/jonathan/directory', >>> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg', >>> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg', >>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', >>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', >>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', >>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', >>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', >>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', >>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
Re: Migration: AlreadyRegistered
I'm not using virtualenv. django.contrib.admin wants a DJANGO_SETTINGS_MODULE to be set: Inner Sanctum ~/directory $ python Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import django.contrib.admin Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/__init__.py", line 1, in from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME File "/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/helpers.py", line 1, in from django import forms File "/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/forms/__init__.py", line 17, in from models import * File "/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/forms/models.py", line 6, in from django.db import connections File "/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/db/__init__.py", line 14, in if not settings.DATABASES: File "/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/utils/functional.py", line 276, in __getattr__ self._setup() File "/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/conf/__init__.py", line 38, in _setup raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. >>> On Wed, Aug 18, 2010 at 1:00 AM, Sam Lai wrote: > This error looks like an import error in disguise. ( > http://code.djangoproject.com/browser/django/tags/releases/1.2.1/django/utils/importlib.py > ) > > Fire up the python interpreter shell, and trying importing the > django.contrib.admin module manually and see if you get any errors. > > Django seems to be installed ok according to your python path. Are you > using virtualenv at all? > > > On 18 August 2010 12:23, Christos Jonathan Hayward < > christos.jonathan.hayw...@gmail.com> wrote: > >> I realized there may have been some pre-existing stuff in the directory, >> so I renamed it and extracted fresh from tarball. I got an error I had seen >> earlier but couldn't reproduce: >> >> AttributeError at / >> >> 'module' object has no attribute 'register' >> >> Request Method:GET Request URL:http://localhost:8000/ Django Version: >> 1.2.1 Exception Type:AttributeError Exception Value: >> >> 'module' object has no attribute 'register' >> >> Exception >> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/utils/importlib.py >> in import_module, line 35 Python Executable:/usr/bin/python Python >> Version:2.6.1 Python Path:['/Users/jonathan/directory', >> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg', >> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', >> '/Library/Python/2.6/site-packages', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', >> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode'] >> Server >> time:Tue, 17 Aug 2010 21:20:53 -0500 >> >> On Tue, Aug 17, 2010 at 8:39 PM, Christos Jonathan Hayward < >> christos.jonathan.hayw...@gmail.com> wrote: >> >>> Thank you; I'm not seeing how. My admin.py reads: >>> >>> import django.contrib.admin >>> import directory.models >>> import tagging >>> >>> django.contrib.admin.autodiscover
Error working on many-to-many lookups
I am trying to get a many-to-many tagging setup working, and I am getting an error which may or may not be an issue with many-to-many specifically. An Entity has a many-to-many field to Tag models; a Tag model only has one (declared) field, text, a TextField. My code: tag = directory.models.Tag.objects.filter(text__equals = name)[0] is getting: Exception Value: Join on field 'text' not permitted. Did you misspell 'equals' for the lookup type? Is text a reserved word here, or do I need to prepend the model name? I'm trying to get the first Tag, if any exists, where the text field equals a name I am testing against. -- [image: Christos Jonathan Hayward] <http://JonathansCorner.com> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://JonathansCorner.com/author/> • Books<http://CJSHayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://JonathansCorner.com/>* • What's New?<http://JonathansCorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Error working on many-to-many lookups
I think I found the problem; for the record, I wanted text__exact, not text__equals. On Wed, Aug 25, 2010 at 1:27 PM, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I am trying to get a many-to-many tagging setup working, and I am getting > an error which may or may not be an issue with many-to-many specifically. An > Entity has a many-to-many field to Tag models; a Tag model only has one > (declared) field, text, a TextField. My code: > > tag = directory.models.Tag.objects.filter(text__equals = name)[0] > > > is getting: > > Exception Value: Join on field 'text' not permitted. Did you misspell > 'equals' for the lookup type? > > > Is text a reserved word here, or do I need to prepend the model name? I'm > trying to get the first Tag, if any exists, where the text field equals a > name I am testing against. > > -- > [image: Christos Jonathan Hayward] <http://JonathansCorner.com> > Christos Jonathan Hayward, an Orthodox Christian author. > > Author Bio <http://JonathansCorner.com/author/> • > Books<http://CJSHayward.com/> > • *Email * • > Facebook<http://www.facebook.com/christos.jonathan.hayward> > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • > Twitter<http://twitter.com/JonathansCorner> > • *Web <http://JonathansCorner.com/>* • What's > New?<http://JonathansCorner.com/> > I invite you to visit my "theology, literature, and other creative works" > site. > > -- [image: Christos Jonathan Hayward] <http://JonathansCorner.com> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://JonathansCorner.com/author/> • Books<http://CJSHayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://JonathansCorner.com/>* • What's New?<http://JonathansCorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Error working on many-to-many lookups
Thanks. On Thu, Aug 26, 2010 at 9:08 AM, Alex Robbins wrote: > Jonathan, > > Pretty much any time you use __exact='text', you could use > ='text' instead. I think the orm treats those two cases the > same. (It adds __exact if there isn't another lookup specified. > > Alex > > On Aug 25, 1:37 pm, Christos Jonathan Hayward > wrote: > > I think I found the problem; for the record, I wanted text__exact, not > > text__equals. > > > > On Wed, Aug 25, 2010 at 1:27 PM, Christos Jonathan Hayward < > > > > > > > > christos.jonathan.hayw...@gmail.com> wrote: > > > I am trying to get a many-to-many tagging setup working, and I am > getting > > > an error which may or may not be an issue with many-to-many > specifically. An > > > Entity has a many-to-many field to Tag models; a Tag model only has one > > > (declared) field, text, a TextField. My code: > > > > > tag = directory.models.Tag.objects.filter(text__equals = name)[0] > > > > > is getting: > > > > > Exception Value: Join on field 'text' not permitted. Did you misspell > > > 'equals' for the lookup type? > > > > > Is text a reserved word here, or do I need to prepend the model name? > I'm > > > trying to get the first Tag, if any exists, where the text field equals > a > > > name I am testing against. > > > > > -- > > > [image: Christos Jonathan Hayward] <http://JonathansCorner.com> > > > Christos Jonathan Hayward, an Orthodox Christian author. > > > > > Author Bio <http://JonathansCorner.com/author/> • Books< > http://CJSHayward.com/> > > > • *Email * • Facebook< > http://www.facebook.com/christos.jonathan.hayward> > > > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter< > http://twitter.com/JonathansCorner> > > > • *Web <http://JonathansCorner.com/>* • What's New?< > http://JonathansCorner.com/> > > > I invite you to visit my "theology, literature, and other creative > works" > > > site. > > > > -- > > [image: Christos Jonathan Hayward] <http://JonathansCorner.com> > > Christos Jonathan Hayward, an Orthodox Christian author. > > > > Author Bio <http://JonathansCorner.com/author/> • Books< > http://CJSHayward.com/> > > • *Email * • > > Facebook<http://www.facebook.com/christos.jonathan.hayward> > > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • > > Twitter<http://twitter.com/JonathansCorner> > > • *Web <http://JonathansCorner.com/>* • What's > > New?<http://JonathansCorner.com/> > > I invite you to visit my "theology, literature, and other creative works" > > site. > > -- > 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. > > -- [image: Christos Jonathan Hayward] <http://JonathansCorner.com> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://JonathansCorner.com/author/> • Books<http://CJSHayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://JonathansCorner.com/>* • What's New?<http://JonathansCorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Breaking many-to-many connections
I have an Entity which has a many-to-many field "tags" to Tags. I'm trying to pin down a bug, and wanted a sanity check: entity = directory.models.Entity.objects.get(id = int(search.group(1))) entity.tags.remove(directory.models.Tag.objects.get(id = int(search.group(2 entity.save() Is the code above, with the .tags.remove() code, enough, or do both the Entity and the Tag need to have a call to break the link? -- [image: Christos Jonathan Hayward] <http://JonathansCorner.com> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://JonathansCorner.com/author/> • Books<http://CJSHayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://JonathansCorner.com/>* • What's New?<http://JonathansCorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Breaking many-to-many connections
I finally pinned down the problem; it was in an unrelated area. Thanks, On Tue, Aug 31, 2010 at 5:59 PM, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I have an Entity which has a many-to-many field "tags" to Tags. I'm trying > to pin down a bug, and wanted a sanity check: > > entity = directory.models.Entity.objects.get(id = > int(search.group(1))) > entity.tags.remove(directory.models.Tag.objects.get(id = > int(search.group(2 > entity.save() > > Is the code above, with the .tags.remove() code, enough, or do both the > Entity and the Tag need to have a call to break the link? > > -- > [image: Christos Jonathan Hayward] <http://JonathansCorner.com> > Christos Jonathan Hayward, an Orthodox Christian author. > > Author Bio <http://JonathansCorner.com/author/> • > Books<http://CJSHayward.com/> > • *Email * • > Facebook<http://www.facebook.com/christos.jonathan.hayward> > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • > Twitter<http://twitter.com/JonathansCorner> > • *Web <http://JonathansCorner.com/>* • What's > New?<http://JonathansCorner.com/> > I invite you to visit my "theology, literature, and other creative works" > site. > > -- [image: Christos Jonathan Hayward] <http://JonathansCorner.com> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://JonathansCorner.com/author/> • Books<http://CJSHayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://JonathansCorner.com/>* • What's New?<http://JonathansCorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Filter for non-True NullBooleanField
How can I filter for instances having a NullBooleanField that is not True (i.e. is either False or a null)? -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Filter for non-True NullBooleanField
P.S. Setting: .filter(is_invisible__in = [False, None]) is not working as intended; I seem to be getting no matches when I should be getting matches. On Fri, Sep 10, 2010 at 4:19 PM, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > How can I filter for instances having a NullBooleanField that is not True > (i.e. is either False or a null)? > > -- > [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> > Christos Jonathan Hayward, an Orthodox Christian author. > > Author Bio <http://jonathanscorner.com/author/> • > Books<http://cjshayward.com/> > • *Email * • > Facebook<http://www.facebook.com/christos.jonathan.hayward> > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • > Twitter<http://twitter.com/JonathansCorner> > • *Web <http://jonathanscorner.com/>* • What's > New?<http://jonathanscorner.com/> > I invite you to visit my "theology, literature, and other creative works" > site. > > -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Filter for non-True NullBooleanField
Thanks, and noted for the future. I went with a regular BooleanField defaulting to False. On Sat, Sep 11, 2010 at 7:08 AM, Preston Holmes wrote: > > > On Sep 10, 2:43 pm, Christos Jonathan Hayward > wrote: > > P.S. Setting: > > > > .filter(is_invisible__in = [False, None]) > > how about: > > .exclude(is_invisible__exact = True) > > > > > is not working as intended; I seem to be getting no matches when I should > be > > getting matches. > > > > On Fri, Sep 10, 2010 at 4:19 PM, Christos Jonathan Hayward < > > > > > > > > > > > > christos.jonathan.hayw...@gmail.com> wrote: > > > How can I filter for instances having a NullBooleanField that is not > True > > > (i.e. is either False or a null)? > > > > > -- > > > [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> > > > Christos Jonathan Hayward, an Orthodox Christian author. > > > > > Author Bio <http://jonathanscorner.com/author/> • Books< > http://cjshayward.com/> > > > • *Email * • Facebook< > http://www.facebook.com/christos.jonathan.hayward> > > > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter< > http://twitter.com/JonathansCorner> > > > • *Web <http://jonathanscorner.com/>* • What's New?< > http://jonathanscorner.com/> > > > I invite you to visit my "theology, literature, and other creative > works" > > > site. > > > > -- > > [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> > > Christos Jonathan Hayward, an Orthodox Christian author. > > > > Author Bio <http://jonathanscorner.com/author/> • Books< > http://cjshayward.com/> > > • *Email * • > > Facebook<http://www.facebook.com/christos.jonathan.hayward> > > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • > > Twitter<http://twitter.com/JonathansCorner> > > • *Web <http://jonathanscorner.com/>* • What's > > New?<http://jonathanscorner.com/> > > I invite you to visit my "theology, literature, and other creative works" > > site. > > -- > 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. > > -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Gotcha with ?generic foreign keys?
I'm working on tracking changes and am running into trouble with the many-to-many fields. I can straightforwardly track and edit one-to-one fields, and many-to-one, and they behave straightforwardly. However, when I try to do a many-to-many field, the present issue I'm running into is that I save an Entity instance in the EditTrail, and when I read it, it is a Tag, and I'm really not sure how my code could be reassigning it to an unrelated class. I'm wondering if I've misunderstood the semantics for generic foreign keys and am trying to push two widgets into a one widget slot. The model is: class EditTrail(models.Model): change_set = models.IntegerField() change_type = models.CharField(max_length = 1, choices = EDIT_CHOICES) content_object = generic.GenericForeignKey(u'content_type', u'object_id') content_type = models.ForeignKey(ContentType) field_name = models.TextField(null = True, blank = True) foreign_key_added = generic.GenericForeignKey() foreign_key_deleted = generic.GenericForeignKey() in_effect = models.BooleanField() instance = generic.GenericForeignKey() object_id = models.PositiveIntegerField() session = models.TextField(null = True, blank = True) text_after = models.TextField(null = True, blank = True) text_before = models.TextField(null = True, blank = True) timestamp = models.DateTimeField(default = datetime.datetime.now, blank = True) username = models.TextField(null = True, blank = True) def format_timestamp(self): return directory.functions.format_timestamp(self.timestamp) Any comments on how either I am misunderstanding how to use GenericForeignKeys, or how I might otherwise be clobbering one model type with another? -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Not calling clean() properly
I have a TextURLField defined below, and I am trying to get the clean() to prepend http:// to all entries that do not contain a ':'. In other words, if someone enters "google.com", I'd like to store "http://google.com";. Right now it appears not to be making any difference; if I enter an FQDN then it just stores the FQDN and nothing more. What I have is: class TextURLField(models.URLField): def clean(self, value): if not u':' in value: value = u'http://' + value value = self.to_python(value) self.validate(value) self.run_validators(value) return value def get_internal_type(self): return u'TextField' def __init__(self, *arguments, **keywords): models.URLField.__init__(self, *arguments, **keywords) Any suggestions? -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Not calling clean() properly
Other attempts to write a clean that would run a print statement and then call to_python(), validate(), and run_validators() did not result in that print statement being called. Am I missing something about data being cleaned? The hooks I've tried to override don't seem to be being called. On Mon, Sep 13, 2010 at 3:44 PM, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I have a TextURLField defined below, and I am trying to get the clean() to > prepend http:// to all entries that do not contain a ':'. In other words, > if someone enters "google.com", I'd like to store "http://google.com";. > > Right now it appears not to be making any difference; if I enter an FQDN > then it just stores the FQDN and nothing more. > > What I have is: > > class TextURLField(models.URLField): > def clean(self, value): > if not u':' in value: > value = u'http://' + value > value = self.to_python(value) > self.validate(value) > self.run_validators(value) > return value > def get_internal_type(self): > return u'TextField' > def __init__(self, *arguments, **keywords): > models.URLField.__init__(self, *arguments, **keywords) > > > Any suggestions? > > -- > [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> > Christos Jonathan Hayward, an Orthodox Christian author. > > Author Bio <http://jonathanscorner.com/author/> • > Books<http://cjshayward.com/> > • *Email * • > Facebook<http://www.facebook.com/christos.jonathan.hayward> > • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • > Twitter<http://twitter.com/JonathansCorner> > • *Web <http://jonathanscorner.com/>* • What's > New?<http://jonathanscorner.com/> > I invite you to visit my "theology, literature, and other creative works" > site. > > -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Not calling clean() properly
Thank you. On Tue, Sep 14, 2010 at 3:01 AM, Daniel Roseman wrote: > On Sep 13, 10:50 pm, Christos Jonathan Hayward > wrote: > > Other attempts to write a clean that would run a print statement and then > > call to_python(), validate(), and run_validators() did not result in that > > print statement being called. > > > > Am I missing something about data being cleaned? The hooks I've tried to > > override don't seem to be being called. > > > > You don't say what is supposed to be calling clean. Are you using a > form? If not, read this: > http://docs.djangoproject.com/en/1.2/ref/validators/#how-validators-are-run > -- > DR. > > -- > 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. > > -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner> • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Registering a user profile
Thank you, little master and creecode. I tried 'pim.UserProfile' and 'pim.models.UserProfile' and they both errored out. With 'pim.UserProfile', which it looks like the documentation calls for, I get: SiteProfileNotAvailable at / Unable to load the profile model, check AUTH_PROFILE_MODULE in your project settings Request Method:GETRequest URL:http://localhost:8000/Django Version:1.3.1Exception Type:SiteProfileNotAvailableException Value: Unable to load the profile model, check AUTH_PROFILE_MODULE in your project settings Exception Location:/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py in get_profile, line 380Python Executable:/usr/local/bin/pythonPython Version:2.7.0Python Path: ['/Users/jonathan/pim', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg', '/usr/local/Cellar/python/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7/lib/python2.7/lib-dynload', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/PIL', '/usr/local/lib/python2.7/site-packages', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info'] Server time:Tue, 14 Feb 2012 12:17:42 -0600 With 'pim.models.UserProfile' I get a slightly different: SiteProfileNotAvailable at / app_label and model_name should be separated by a dot in the AUTH_PROFILE_MODULE setting Request Method:GETRequest URL:http://localhost:8000/Django Version:1.3.1Exception Type:SiteProfileNotAvailableException Value: app_label and model_name should be separated by a dot in the AUTH_PROFILE_MODULE setting Exception Location:/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py in get_profile, line 373Python Executable:/usr/local/bin/pythonPython Version:2.7.0Python Path: ['/Users/jonathan/pim', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg', '/usr/local/Cellar/python/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7/lib/python2.7/lib-dynload', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/PIL', '/usr/local/lib/python2.7/site-packages', '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info'] Server time:Tue, 14 Feb 2012 12:25:41 -0600 "pim" is the name of the project. Do I need to create a distinct application within that project? On Tue, Feb 14, 2012 at 12:20 PM, creecode wrote: > Hello Jonathan, > > See the "Storing additional information about > users<https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users>" > section in the docs. There it mentions the expected format of > AUTH_PROFILE_MODULE. > > I suspect what you need to do is wrap your UserProfile model up in it's > own app if it isn't in one already. Alternately you need to change the > "models" in AUTH_PROFILE_MODULE to the name of your app. > > Let us know if that works for you. > > Toodle-lo.. > creecode > > > -- > 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/-/HSX4NGpn66kJ. > > 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. > -- [image: Christos Jonathan Hayward] <http://jonathanscorner.c
Re: Registering a user profile
If I import models, it crashes. The top-level project is pim; under that I have models.py, which contains UserProfile. Specifying pim.UserProfile and pim.models.UserProfile gets two different error messages. Do I need to create a separate application under pim and load ".UserProfile"? On Tue, Feb 14, 2012 at 12:32 PM, Kevin Anthony wrote: > Did you include the module in your settings.py? > > Kevin > Please excuse brevity, sent from phone > On Feb 14, 2012 1:27 PM, "Christos Jonathan Hayward" < > christos.jonathan.hayw...@gmail.com> wrote: > >> Thank you, little master and creecode. I tried 'pim.UserProfile' and >> 'pim.models.UserProfile' and they both errored out. With 'pim.UserProfile', >> which it looks like the documentation calls for, I get: >> >> SiteProfileNotAvailable at / >> >> Unable to load the profile model, check AUTH_PROFILE_MODULE in your project >> settings >> >> Request Method: GET Request URL: http://localhost:8000/ Django Version: >> 1.3.1 Exception Type: SiteProfileNotAvailable Exception Value: >> >> Unable to load the profile model, check AUTH_PROFILE_MODULE in your project >> settings >> >> Exception Location: >> /usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py >> in get_profile, line 380 Python Executable:/usr/local/bin/python Python >> Version:2.7.0 Python Path: >> >> ['/Users/jonathan/pim', >> >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg', >> >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg', >> '/usr/local/Cellar/python/2.7/lib/python27.zip', >> '/usr/local/Cellar/python/2.7/lib/python2.7', >> '/usr/local/Cellar/python/2.7/lib/python2.7/plat-darwin', >> '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac', >> '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac/lib-scriptpackages', >> '/usr/local/Cellar/python/2.7/lib/python2.7/lib-tk', >> '/usr/local/Cellar/python/2.7/lib/python2.7/lib-old', >> '/usr/local/Cellar/python/2.7/lib/python2.7/lib-dynload', >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages', >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/PIL', >> '/usr/local/lib/python2.7/site-packages', >> >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info'] >> >> Server time: Tue, 14 Feb 2012 12:17:42 -0600 >> >> >> With 'pim.models.UserProfile' I get a slightly different: >> >> SiteProfileNotAvailable at / >> >> app_label and model_name should be separated by a dot in the >> AUTH_PROFILE_MODULE setting >> >> Request Method: GET Request URL: http://localhost:8000/ Django Version: >> 1.3.1 Exception Type: SiteProfileNotAvailable Exception Value: >> >> app_label and model_name should be separated by a dot in the >> AUTH_PROFILE_MODULE setting >> >> Exception Location: >> /usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py >> in get_profile, line 373 Python Executable:/usr/local/bin/python Python >> Version:2.7.0 Python Path: >> >> ['/Users/jonathan/pim', >> >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg', >> >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg', >> '/usr/local/Cellar/python/2.7/lib/python27.zip', >> '/usr/local/Cellar/python/2.7/lib/python2.7', >> '/usr/local/Cellar/python/2.7/lib/python2.7/plat-darwin', >> '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac', >> '/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac/lib-scriptpackages', >> '/usr/local/Cellar/python/2.7/lib/python2.7/lib-tk', >> '/usr/local/Cellar/python/2.7/lib/python2.7/lib-old', >> '/usr/local/Cellar/python/2.7/lib/python2.7/lib-dynload', >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages', >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/PIL', >> '/usr/local/lib/python2.7/site-packages', >> >> '/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info'] >> >> Server time: Tue, 14 Feb 2012 12:25:41 -0600 >> >> >> "pim" is the name of the p
Re: Where are the 2+ places user_id is defined?
I forgot to specify where. The traceback is on a '''python manage.py syncdb''', and happens immediately after the password is entered twice. On Wed, Feb 15, 2012 at 3:39 PM, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I'm getting an error: > > Traceback (most recent call last): > File "manage.py", line 14, in > execute_manager(settings) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", > line 438, in execute_manager > utility.execute() > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", > line 379, in execute > self.fetch_command(subcommand).run_from_argv(self.argv) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", > line 191, in run_from_argv > self.execute(*args, **options.__dict__) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", > line 220, in execute > output = self.handle(*args, **options) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", > line 351, in handle > return self.handle_noargs(**options) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", > line 109, in handle_noargs > emit_post_sync_signal(created_models, verbosity, interactive, db) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/sql.py", > line 190, in emit_post_sync_signal > interactive=interactive, db=db) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", > line 172, in send > response = receiver(signal=self, sender=sender, **named) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", > line 70, in create_superuser > call_command("createsuperuser", interactive=True) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", > line 166, in call_command > return klass.execute(*args, **defaults) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", > line 220, in execute > output = self.handle(*args, **options) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", > line 134, in handle > User.objects.create_superuser(username, email, password) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", > line 140, in create_superuser > u = self.create_user(username, email, password) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", > line 136, in create_user > user.save(using=self._db) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", > line 460, in save > self.save_base(using=using, force_insert=force_insert, > force_update=force_update) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", > line 570, in save_base > created=(not record_exists), raw=raw, using=using) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", > line 172, in send > response = receiver(signal=self, sender=sender, **named) > File "/Users/jonathan/pim/accounts/models.py", line 12, in > create_user_profile > UserProfile.objects.create(user = instance) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/manager.py", > line 138, in create > return self.get_query_set().create(**kwargs) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/query.py", > line 360, in create > obj.save(force_insert=True, using=self.db) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", > line 460, in save > self.save_base(using=using, force_insert=force_insert, > force_update=force_update) > File > "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", > line 553, in save_base > result = manager._insert(values, return_id=update_pk, using=using) > File > "/usr/local/Cellar/python/2.7/lib/py
Re: Where are the 2+ places user_id is defined?
P.S. The source is at http://JonathansCorner.com/project/pim.tgz. On Wed, Feb 15, 2012 at 3:40 PM, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I forgot to specify where. The traceback is on a '''python manage.py > syncdb''', and happens immediately after the password is entered twice. > > > On Wed, Feb 15, 2012 at 3:39 PM, Christos Jonathan Hayward < > christos.jonathan.hayw...@gmail.com> wrote: > >> I'm getting an error: >> >> Traceback (most recent call last): >> File "manage.py", line 14, in >> execute_manager(settings) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", >> line 438, in execute_manager >> utility.execute() >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", >> line 379, in execute >> self.fetch_command(subcommand).run_from_argv(self.argv) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", >> line 191, in run_from_argv >> self.execute(*args, **options.__dict__) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", >> line 220, in execute >> output = self.handle(*args, **options) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", >> line 351, in handle >> return self.handle_noargs(**options) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", >> line 109, in handle_noargs >> emit_post_sync_signal(created_models, verbosity, interactive, db) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/sql.py", >> line 190, in emit_post_sync_signal >> interactive=interactive, db=db) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", >> line 172, in send >> response = receiver(signal=self, sender=sender, **named) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", >> line 70, in create_superuser >> call_command("createsuperuser", interactive=True) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", >> line 166, in call_command >> return klass.execute(*args, **defaults) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", >> line 220, in execute >> output = self.handle(*args, **options) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", >> line 134, in handle >> User.objects.create_superuser(username, email, password) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", >> line 140, in create_superuser >> u = self.create_user(username, email, password) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", >> line 136, in create_user >> user.save(using=self._db) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", >> line 460, in save >> self.save_base(using=using, force_insert=force_insert, >> force_update=force_update) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", >> line 570, in save_base >> created=(not record_exists), raw=raw, using=using) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", >> line 172, in send >> response = receiver(signal=self, sender=sender, **named) >> File "/Users/jonathan/pim/accounts/models.py", line 12, in >> create_user_profile >> UserProfile.objects.create(user = instance) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/manager.py", >> line 138, in create >> return self.get_query_set().create(**kwargs) >> File >> "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/query.py", >> line 360, in create >>
Integrating django-honeypot with Pinax
I would like to incorporate django-honeypot ( https://github.com/sunlightlabs/django-honeypot) into a Pinax site so there's less spam; the project was cloned from the social network. The basic instructions for django-honeypot are "Add X to your settings.py, do Y to templates containing forms you want to honeypot, and do Z to views servicing those templates." However, after looking through my Pinax project and the virtual environment, I don't see where the templates and views are for me to do Y and Z to. Where should I be looking to appropriately change templates and views to lessen the load of spam? -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Google Plus <http://jonathanscorner.com/plus> • LinkedIn<http://www.linkedin.com/in/jonathanhayward> • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Integrating django-honeypot with Pinax
Breadcrumb note: someone on the list pointed out the middleware described at the bottom of django-honeypot's homepage. That was what I wanted. On Thu, Sep 8, 2011 at 1:21 PM, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I would like to incorporate django-honeypot ( > https://github.com/sunlightlabs/django-honeypot) into a Pinax site so > there's less spam; the project was cloned from the social network. > > The basic instructions for django-honeypot are "Add X to your settings.py, > do Y to templates containing forms you want to honeypot, and do Z to views > servicing those templates." > > However, after looking through my Pinax project and the virtual > environment, I don't see where the templates and views are for me to do Y > and Z to. > > Where should I be looking to appropriately change templates and views to > lessen the load of spam? > > -- > [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> > Christos Jonathan Hayward, an Orthodox Christian author. > > Author Bio <http://jonathanscorner.com/author/> • > Books<http://cjshayward.com/> > • *Email * • > Facebook<http://www.facebook.com/christos.jonathan.hayward> > • Google Plus <http://jonathanscorner.com/plus> • > LinkedIn<http://www.linkedin.com/in/jonathanhayward> > • Twitter <http://twitter.com/JonathansCorner> • > *Web<http://jonathanscorner.com/> > * • What's New? <http://jonathanscorner.com/> > I invite you to visit my "theology, literature, and other creative works" > site. > > -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Google Plus <http://jonathanscorner.com/plus> • LinkedIn<http://www.linkedin.com/in/jonathanhayward> • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Where is "base.html" that "templates/site_base.html" extends?
"site_base.html", directly under the templates folder, extends a "base.html". Where is the base.html? I see several under the project heirarchy somewhere, and I'd like to know which one of them site_base.html extends (if it does so), or else where I can go to edit site_base.html. -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Google Plus <http://jonathanscorner.com/plus> • LinkedIn<http://www.linkedin.com/in/jonathanhayward> • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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: Where is "base.html" that "templates/site_base.html" extends?
Thanks for both responses; I have what I need now. On Fri, Sep 9, 2011 at 9:09 AM, Leonardo Giordani < giordani.leona...@gmail.com> wrote: > Hi Christos, > > if you put > > {% extends "somefile.html" %} > > in your template, Django expects to find it in one of the directories > specified in your TEMPLATE_DIRS variable in settings.py. > They are considered in the order they are written, so the base.html you are > extending is the first you find in this sequence. > > Hope this helps, feel free to reply > > 2011/9/9 Christos Jonathan Hayward > >> "site_base.html", directly under the templates folder, extends a >> "base.html". >> >> Where is the base.html? I see several under the project heirarchy >> somewhere, and I'd like to know which one of them site_base.html extends (if >> it does so), or else where I can go to edit site_base.html. >> >> -- >> [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> >> Christos Jonathan Hayward, an Orthodox Christian author. >> >> Author Bio <http://jonathanscorner.com/author/> • >> Books<http://cjshayward.com/> >> • *Email * • >> Facebook<http://www.facebook.com/christos.jonathan.hayward> >> • Google Plus <http://jonathanscorner.com/plus> • >> LinkedIn<http://www.linkedin.com/in/jonathanhayward> >> • Twitter <http://twitter.com/JonathansCorner> • >> *Web<http://jonathanscorner.com/> >> * • What's New? <http://jonathanscorner.com/> >> I invite you to visit my "theology, literature, and other creative works" >> site. >> >> -- >> 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. > -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Google Plus <http://jonathanscorner.com/plus> • LinkedIn<http://www.linkedin.com/in/jonathanhayward> • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Email settings to use localhost's email
I have a Pinax social project that earlier was holding emails as rejected (they came from webmaster@localhost), and near the beginning of settings.py added: DEFAULT_FROM_EMAIL = 'Orthodox Network ' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_TLS = True EMAIL_HOST = 'mail.orthodox-network.com' EMAIL_HOST_USER = 'cjshayward' # Mailbox name from https://my.webfaction.com/mailbox/list EMAIL_HOST_PASSWORD = '' EMAIL_PORT = 25 EMAIL_SUBJECT_PREFIX = '[Orthodox Network] ' There were earlier seven emails from friends who had tried to confirm their email address; when I originally did: python manage.py send_mail python manage.py retry_deferred it gave error messages and didn't send the messages. Now I added to the settings.py: DEFAULT_FROM_EMAIL = 'Orthodox Network ' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_TLS = True EMAIL_HOST = 'mail.orthodox-network.com' EMAIL_HOST_USER = 'cjshayward' # Mailbox name from https://my.webfaction.com/mailbox/list EMAIL_HOST_PASSWORD = '' EMAIL_PORT = 25 EMAIL_SUBJECT_PREFIX = '[Orthodox Network] ' it ran without reported error, but none of my users have reported receiving the expected email. The VPS is set up to allow Mail; the following appears to work: $ Mail cjshayw...@pobox.com Subject: Test Test . Cc: Which brings me to my question: *How can I tell Django to use the VPS's regular sendmail to power send_mail, retry_deferred, and emit_notices?* * * Thanks in advance. -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Google Plus <http://jonathanscorner.com/plus> • LinkedIn<http://www.linkedin.com/in/jonathanhayward> • Orthodox Network <http://orthodox-network.com/> (Profile<http://orthodox-network.com/profiles/profile/cjshayward/>) • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> I invite you to visit my "theology, literature, and other creative works" site. -- 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.
Up-to-date Pinax social network?
I look at http://pinaxproject.com/ and see lots of Legos I could use to build a social network. Is there a current pre-built or HOWTO social network project that I could use to get a Pinax social network up and running in two hours or less, including stupid user mistakes on my part? I have a Pinax 0.5 social network core, and I could fall back on that if needed, but that is really a losing solution unless the free-of-effort social network has been phased out in favor of bigger and better sites. I know that Pinax was intended as a tabula rasa with batteries/Legos included and not as a system whose features are best showcased in what happens to be a social network, but I have more easily gotten a social network running on 0.5 than more recent releases. -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. *Amazon <http://amazon.com/author/cjshayward>* • Author Bio<http://jonathanscorner.com/author/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Fan Page <http://fan.cjshayward.com/> • Google Plus<http://jonathanscorner.com/plus> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • *Professional<http://jonathanhayward.com/> * • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> If you read just *one* of my books, you'll want *The Best of Jonathan's Corner <http://www.amazon.com/dp/1478219912>*. -- 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.
Up-to-date Pinax Social Network *working*?
I'vd found pinax-social-project but it's bleeding; it doesn't offer even a styled page, just a page that fails to load CSS and JavaScripts and comes out POSH bare as bare can be. I've put a tarball of my current version at http://JonathansCorner.com/project/stornge.tgz, was wondering if you could give me any help to load static content appropriately (it doesn't work to copy the line that loads media and change it to point to static values). -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. *Amazon <http://amazon.com/author/cjshayward>* • Author Bio<http://jonathanscorner.com/author/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Fan Page <http://fan.cjshayward.com/> • Google Plus<http://jonathanscorner.com/plus> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • *Professional<http://jonathanhayward.com/> * • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> If you read just *one* of my books, you'll want *The Best of Jonathan's Corner <http://www.amazon.com/dp/1478219912>*. -- 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.
As posted on StackOverflow
After a day or so of losing at trying to make pinax-social-network 1.0 have the merits of Pinax social-project 0.5 or .7, I'd like to ask how to cut with the grain instead of against it. The earlier version came as a fully functional site: you could override and customize if you want, but it came "batteries included", as a room with well-chosen pegs on the walls, pictures hanging on the hooks, and furniture as needed. You could replace as much of the room's initial contents as you wanted, but it came as a furnished room. Pinax-social-network 1.0 is not a furnished room. It has pegs, and the pegs are about as well-placed as you could ask for, but if you want pictures on those pegs, it's on you to put pictures on the pegs. And there is space you can put furniture in the room; the room is left empty so you can put whatever furniture you want in. And the room comes with elegantly placed lorem ipsum graffiti on the walls, to motivate you to paint or wallpaper the walls to meet your taste. It comes "batteries removed." So... what are the resources, and how does one go about, making a social network here? Do I just take it as a bit of Django putty? I expect I'd do a lot of reinventing the wheel if I just use Django knowledge. Is there a tutorial that shows how to make a live site out of one of Pinax's projects? I spent a bit of time reading about Liferat Liferay before remembering how painful it was even when I knew it well. The problem here may just be that I am ignorant about Pinax, and ignorance is a changeable condition. So let's say I know something about Python, something about Django and something about older, fully assembled versions of Pinax, but not how to take a starter Pinax project and make a finished site out of it. I'm ignorant on that point. How can I cure my ignorance? What resources are out there so I can get what was so easily in reach in older versions of Pinax? -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. *Amazon <http://amazon.com/author/cjshayward>* • Author Bio<http://jonathanscorner.com/author/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Fan Page <http://fan.cjshayward.com/> • Google Plus<http://jonathanscorner.com/plus> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • *Professional<http://jonathanhayward.com/> * • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> If you read just *one* of my books, you'll want *The Best of Jonathan's Corner <http://www.amazon.com/dp/1478219912>*. -- 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.
An alternate cry for help
I wrote earlier asking if someone could correct my ignorance to go from Pinax building blocks to a working site. Since then, I searched Safari, and found five references to Pinax, at http://my.safaribooksonline.com/search?q=Pinax . One is a tangent in a Django book I wrote; three are Python books I didn't write; and one is an iPhone JavaScript book that includes 'pinax' in a Greek-English lexicon's URL. I realized after posting the original post below that although I'm an avid learner my ignorance of Pinax may be a bit of a challenge to straighten out. So besides the possibility of educating me to really know how to put Pinax sites together, could someone preassemble a complete social site that just needs database setup, a syncdb, and a gunicorn invocation? It would be nice to have the earlier Pinax Social Project reimplemented using the new tools, as opposed to the pinax-social-project which is a set of building blocks to complete a social project. It seems the general approach is to turn over better and better building blocks to the user, but the already-working sensible default has its merits, and I'd appreciate those merits after a day of struggling with old Pinax, new Pinax, borrowed Pinax, blue Pinax, not getting any responses with good learning resources, and searching Safari and recognizing that O'Reilly's whole Safari does not contain as much information about Pinax as the email you are reading, not enough by half, and that kind of makes my ignorance a less changeable condition. If I'm ignorant about Django but have the Django documentation and the Django book, I can reduce my ignorance. Here I don't see how I can reduce my ignorance, and my thoughts turn to an evaluation that working Pinax is excellent, not-configured Pinax that you don't know how to improve is worth very little, and Liferat is mediocre but works, in its own special way. *After a day or so of losing at trying to make pinax-social-network 1.0 have the merits of Pinax social-project 0.5 or .7, I'd like to ask how to cut with the grain instead of against it.* *The earlier version came as a fully functional site: you could override and customize if you want, but it came "batteries included", as a room with well-chosen pegs on the walls, pictures hanging on the hooks, and furniture as needed. You could replace as much of the room's initial contents as you wanted, but it came as a furnished room.* *Pinax-social-network 1.0 is not a furnished room. It has pegs, and the pegs are about as well-placed as you could ask for, but if you want pictures on those pegs, it's on you to put pictures on the pegs. And there is space you can put furniture in the room; the room is left empty so you can put whatever furniture you want in. And the room comes with elegantly placed lorem ipsum graffiti on the walls, to motivate you to paint or wallpaper the walls to meet your taste. It comes "batteries removed."* *So... what are the resources, and how does one go about, making a social network here? Do I just take it as a bit of Django putty? I expect I'd do a lot of reinventing the wheel if I just use Django knowledge. Is there a tutorial that shows how to make a live site out of one of Pinax's projects?* *I spent a bit of time reading about Liferat Liferay before remembering how painful it was even when I knew it well. The problem here may just be that I am ignorant about Pinax, and ignorance is a changeable condition.* *So let's say I know something about Python, something about Django and something about older, fully assembled versions of Pinax, but not how to take a starter Pinax project and make a finished site out of it. I'm ignorant on that point. How can I cure my ignorance? What resources are out there so I can get what was so easily in reach in older versions of Pinax?* -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. *Amazon <http://amazon.com/author/cjshayward>* • Author Bio<http://jonathanscorner.com/author/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Fan Page <http://fan.cjshayward.com/> • Google Plus<http://jonathanscorner.com/plus> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • *Professional<http://jonathanhayward.com/> * • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> If you read just *one* of my books, you'll want *The Best of Jonathan's Corner <http://www.amazon.com/dp/1478219912>*. -- 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.
Installing Pinax 0.7 on Ubuntu
I've been working to make a 0.7 Pinax social project work with current versions of Django and Pinax, and it's been a time sink: we're talking zero to sixty for one week and counting for a timesaver for the web framework for perfectionists with deadlines. I realized today that I was maybe halfway through an ersatz port of the project and my virtualenv to current versions of Python and Django. In other words, my approach has been a losing approach. Is there any way that I can forcibly install Pinax 0.7, with a corresponding Python version, on my Ubuntu machine? Part of the difficulty is that I don't know how to get Pinax 0.7; it's not available from its original URL, and there are dozens of websites offering a free download for Pinax 0.7, but when you drill down they link to the official site. Meaning I haven't found an independent Pinax 0.7 source tarball. *Does anyone happen to have a Pinax 0.7.x source tarball available?* And can anyone tell me what version of Django would work best with that Pinax? And if Python 2.7.3 is going to cause problems, what version of Python should I have Django running on? I've certainly identified a losing way to get a Pinax social project up. A couple of them, actually, if you count pulling the pinax-soclal-project stub from the official site and then try to do anything more social then edit a minimal account profile. I made a tarball snapshot before trying to "make it work together." Now I was wondering if people could help me with what I hope is a winning approach, installing 0.7 and dependencies. Thanks, -- [image: Christos Jonathan Hayward] <http://jonathanscorner.com/> Christos Jonathan Hayward, an Orthodox Christian author. *Amazon <http://amazon.com/author/cjshayward>* • Author Bio<http://jonathanscorner.com/author/> • *Email * • Facebook<http://www.facebook.com/christos.jonathan.hayward> • Fan Page <http://fan.cjshayward.com/> • Google Plus<http://jonathanscorner.com/plus> • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • *Professional<http://jonathanhayward.com/> * • Twitter <http://twitter.com/JonathansCorner> • *Web<http://jonathanscorner.com/> * • What's New? <http://jonathanscorner.com/> If you read just *one* of my books, you'll want *The Best of Jonathan's Corner <http://www.amazon.com/dp/1478219912>*. -- 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.