Re: importing all forms/models etc with one statement

2008-11-23 Thread dash86no
Cheers Malcom, that sounds like solid advice. Actually, I went through a few online Python tutorials a couple of months ago, enough to write some basic apps. I had though that that was going to carry my through this Django adventure but obviously I need a brush up! Cheers, On Nov 24, 2:01 pm, M

easily getting all the admin functionality in your templates and views

2008-11-23 Thread dash86no
OK, So I posted a couple of days ago that I had finished implementing my application's admin interface, and that I was really impressed. So impressed, I was considering sticking with the Admin as the front end for my entire app. (A sales quotation system). A user on this site recommended that it

Re: "available user permissions" list incomplete

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 22:22 -0800, sajal wrote: > thanks a lot.. that fixed it. > > Even after making the mess that i made, a syncdb solved the issue > keeping all my other data intact. > > I however have a related question. > > While modifying the existing classes, i.e. adding fields, i do th

Re: "available user permissions" list incomplete

2008-11-23 Thread sajal
thanks a lot.. that fixed it. Even after making the mess that i made, a syncdb solved the issue keeping all my other data intact. I however have a related question. While modifying the existing classes, i.e. adding fields, i do the "ALTER TABLE" by hand as suggested by http://www.djangobook.co

Re: {% ifequal %} Confusion

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 21:52 -0800, Andy Young wrote: > Hi all, > > I've attempted a shortcut in an {% ifequal %} tag and ran into some > unexpected consequences. Basically, I have two DateFields in a model > named begin_date and end_date. I am iterating through field names > ({{ f }}) and thei

Re: "available user permissions" list incomplete

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 21:47 -0800, sajal wrote: > Apologies for the lack of details, didnt really know what details to > provide. > > Here is what I did. Good step-by-step accounting of what you did. Makes it easy to spot where the problem is. > 2 users (one superadmin and one regular user) >

{% ifequal %} Confusion

2008-11-23 Thread Andy Young
Hi all, I've attempted a shortcut in an {% ifequal %} tag and ran into some unexpected consequences. Basically, I have two DateFields in a model named begin_date and end_date. I am iterating through field names ({{ f }}) and their corresponding values ({{ item|getattr:f }}) to populate a webpag

Re: "available user permissions" list incomplete

2008-11-23 Thread sajal
Apologies for the lack of details, didnt really know what details to provide. Here is what I did. 2 users (one superadmin and one regular user) make a new "app" and add few models to it. Assign permission for the new models class to the staff user via the django admin interface. modify the exist

Re: importing all forms/models etc with one statement

2008-11-23 Thread dash86no
Andy, Thanks. That was exactly what I was looking for. I'll be sure to check out that link too. On Nov 24, 1:35 pm, Andy Young <[EMAIL PROTECTED]> wrote: > On Nov 23, 8:31 pm, dash86no <[EMAIL PROTECTED]> wrote: > > > Is there no way to call all models implicitly. For example: > > > from mysite

Re: "available user permissions" list incomplete

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 20:47 -0800, sajal wrote: > +1 > > Having exactly the same issue. Last night i was busy adding classes > and stuff, after uploading to the dev server, im unable to add > permissions to a "staff" user since the new class isint in the list. > > me (superuser) can see it allr

Re: 1.02 Bug with Flatpages and Append_Slash?

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 20:26 -0800, watusee wrote: > Picture a site with a flatpage at the root. This root flatpage in the > admin tool has a "/" for the URL. The root flatpage gets into a > redirect loop. All other flatpages except the root flatpage work fine. > If Append_Slash is set to false, t

Re: importing all forms/models etc with one statement

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 19:31 -0800, dash86no wrote: > I have around 15 or so models in my system, and I find it pretty > tedious to have to explicitly import each and every one into my > forms.py etc. > > Is there no way to call all models implicitly. For example: > > from mysite.myapp import mo

Re: "available user permissions" list incomplete

2008-11-23 Thread sajal
+1 Having exactly the same issue. Last night i was busy adding classes and stuff, after uploading to the dev server, im unable to add permissions to a "staff" user since the new class isint in the list. me (superuser) can see it allright. For now ill make the "staff" a superuser until i can find

Re: importing all forms/models etc with one statement

2008-11-23 Thread Andy Young
On Nov 23, 8:31 pm, dash86no <[EMAIL PROTECTED]> wrote: > Is there no way to call all models implicitly. For example: > > from mysite.myapp import models > PS. I tried looking round the documentation. I found > this:http://www.djangobook.com/en/1.0/chapter08/ > > from django.conf.urls.defaults im

1.02 Bug with Flatpages and Append_Slash?

2008-11-23 Thread watusee
Picture a site with a flatpage at the root. This root flatpage in the admin tool has a "/" for the URL. The root flatpage gets into a redirect loop. All other flatpages except the root flatpage work fine. If Append_Slash is set to false, this perplexing behavior no longer occurs and the root flatp

Re: redirection 2 links back after signing up?

2008-11-23 Thread [EMAIL PROTECTED]
btw this requires that you use render_to_response with the 3rd argument, context_instance=RequestContext(request) see docs. http://docs.djangoproject.com/en/dev/ref/templates/api/?from=olddocs session docs http://docs.djangoproject.com/en/dev/topics/http/sessions/#topics-http-sessions On Nov 23

Re: redirection 2 links back after signing up?

2008-11-23 Thread [EMAIL PROTECTED]
I just solved this issue. I did by using using sessions. I initialize this in a couple of views. request.session['last'] = request.get_full_path() If a user tries to do something restricted it requires them to login which I do the same exact way you do. After they login they get redirected to

Certificates for Authentication

2008-11-23 Thread Mike Hjorleifsson
Has anyone tried or been successful implementing authentication with clien certificates i.e. PKI x.509 user certs ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

inlineformset_factory: shows only 1 extra even extra=5

2008-11-23 Thread izzy
I'm trying to make use inlineformset_factory to add several data on an object at the sime time. I want to show 5 extra forms but when I view it in browser it only shows 1formsets instead of 5. Here's my view code: formset = inlineformset_factory(PackagingReport, PeopleProblem, max_num=0,

Re: Can't get tiny_mce in admin

2008-11-23 Thread waltbrad
On Nov 23, 9:00 pm, waltbrad <[EMAIL PROTECTED]> wrote: > On Nov 22, 9:09 pm, waltbrad <[EMAIL PROTECTED]> wrote: > > > I'm working with James Bennet's book Practical Django Projects. He > > puts a tiny_mce text editor into the admin flatpage interface. > > Just want to chime in one more time to

importing all forms/models etc with one statement

2008-11-23 Thread dash86no
I have around 15 or so models in my system, and I find it pretty tedious to have to explicitly import each and every one into my forms.py etc. Is there no way to call all models implicitly. For example: from mysite.myapp import models PS. I tried looking round the documentation. I found this: h

Re: Can't get tiny_mce in admin

2008-11-23 Thread waltbrad
On Nov 22, 9:09 pm, waltbrad <[EMAIL PROTECTED]> wrote: > I'm working with James Bennet's book Practical Django Projects. He > puts a tiny_mce text editor into the admin flatpage interface. > > I have this in the change_form.html, (at the proper place, I > checked it umpteen times): > =

Re: Help for crontab

2008-11-23 Thread R. Gorman
Here's a third option that I've found useful when wanting to run a cron job: http://blog.capstrat.com/articles/making-django-environmentally-friendly/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" gr

Re: simple reverse( ) errors

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 12:42 -0700, Dj Gilcrease wrote: > You should not have both; > (r'^$', include('basicBlog.blog.urls')), > (r'^blog/', include('basicBlog.blog.urls')), > > since now your reverse is going to match two diffrent URL, > /2008/nov/21/secondPost/ > and > /blog/2008/

Re: unicode cipher & generic views

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 07:56 -0800, oleg wrote: > Sorry, I forgot to put it :) > > view.py: > def add(request): > return create_object(request, Firm) > > def edit(request, key): > return update_object(request, Firm, key) > > > models.py: > INDUSTRIES_CHOICES= set([('1','Авто'), ('2','А

Re: template variable default filter not doing what is expected

2008-11-23 Thread Malcolm Tredinnick
On Sun, 2008-11-23 at 03:33 -0800, gv wrote: > Hello > > I'm constucting a table in the Django template language, and have this > problem. When there is no value (from the dictionary generated by the > view), I would like to fill in -1 like this: > > {{ item.ActiveSessions|default:"-1" }} > >

Re: help, ORM memory problems

2008-11-23 Thread Doug B
One thing that has bitten me more times than I care to remember is forgetting to disable DEBUG in settings.py before processing large datasets. The SQL queries build up in connection.queries until the process dies. I ended up patching my django install to store queries in a wrapper around buffer

Re: flatpage at root/home?

2008-11-23 Thread watusee
It seems to be an issue with upgrading. I did try your suggestion (thank you!) but to no avail. I receive the same redirect message. Is anyone else using the flatpages for the root url of their web site with 1.02? Thank you! -r On Nov 23, 3:48 pm, derek73 <[EMAIL PROTECTED]> wrote: > try replac

Re: UnicodeEncodeError using mysql as db

2008-11-23 Thread Karen Tracey
On Sun, Nov 23, 2008 at 6:42 PM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > Hello, > > I'm one of the developers of Rancho (www.getrancho.com) > > One of our users reported a problem using mysql and unicode with we > haven't been able to solve. > > Here is the traceback: http://dpaste.com/9

Re: help, ORM memory problems

2008-11-23 Thread [EMAIL PROTECTED]
Try doing Legacy.objects.all().iterator(), this isn't technically the public API, but this grabs the results at a lower level, so it doesn't get cached. On Nov 23, 5:44 pm, derek73 <[EMAIL PROTECTED]> wrote: > I have written a management script to migrate data from an existing > site into our new

Ad Management System

2008-11-23 Thread Nick
I'm exploring whether or not to use Django for redesigned website and the only thing I haven't really been able to find out is whether there is an existing, portable, robust solution for advertising management on the site. This would need to control what advertising goes where, track its performan

help, ORM memory problems

2008-11-23 Thread derek73
I have written a management script to migrate data from an existing site into our new Django-powered site. The script runs fine with one exception, memory consumption. A few of the tables I need to migrate have around 250,000 records, and it seems that the Django ORM caches each record in memory a

UnicodeEncodeError using mysql as db

2008-11-23 Thread [EMAIL PROTECTED]
Hello, I'm one of the developers of Rancho (www.getrancho.com) One of our users reported a problem using mysql and unicode with we haven't been able to solve. Here is the traceback: http://dpaste.com/93163/ Any help is appreciated. Best regards, Luis --~--~-~--~~~

Re: flatpage at root/home?

2008-11-23 Thread derek73
try replacing: (r'', include('django.contrib.flatpages.urls')), with (r'^$', include('django.contrib.flatpages.urls')), On Nov 23, 6:48 am, watusee <[EMAIL PROTECTED]> wrote: > Upgraded from 96 to 1.02. My home/root (at 127.0.0.1/) page (using > flatpages) now doesn't work using runserver. O

Re: Problem upgrading to Django 1.0.2

2008-11-23 Thread lazyant
Thanks. I ignore the compile errors but the problem is the second part; my web site shows 'Internal Error' and I get those messages in apache error log. On Nov 23, 3:37 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote: > lazyant wrote: > > Hello, > > > I've been running django 0.96.3 installed from t

Re: Problem upgrading to Django 1.0.2

2008-11-23 Thread Jeff Anderson
lazyant wrote: > Hello, > > I've been running django 0.96.3 installed from the tar file for over > half a year without problems, I'm using python 2.3.4 on CentOS 4. > > I'm trying to upgrade to 1.0.2 from tar file and after running 'sudo > python setup.py install' I get about 20 byte-compiling erro

Problem upgrading to Django 1.0.2

2008-11-23 Thread lazyant
Hello, I've been running django 0.96.3 installed from the tar file for over half a year without problems, I'm using python 2.3.4 on CentOS 4. I'm trying to upgrade to 1.0.2 from tar file and after running 'sudo python setup.py install' I get about 20 byte-compiling errors, they are all syntax er

Re: simple reverse( ) errors

2008-11-23 Thread goblue0311
excellent! that was indeed the issue - thank you both for your explanations. On Nov 23, 2:42 pm, "Dj Gilcrease" <[EMAIL PROTECTED]> wrote: > You should not have both; > (r'^$',          include('basicBlog.blog.urls')), > (r'^blog/',      include('basicBlog.blog.urls')), > > since now your reverse

Re: simple reverse( ) errors

2008-11-23 Thread Dj Gilcrease
You should not have both; (r'^$', include('basicBlog.blog.urls')), (r'^blog/', include('basicBlog.blog.urls')), since now your reverse is going to match two diffrent URL, /2008/nov/21/secondPost/ and /blog/2008/nov/21/secondPost/ thus cause the NoReverseMatch error since reverse sho

Re: simple reverse( ) errors

2008-11-23 Thread Valts Mazurs
I see that you are using two url prefixes ("/" and "/blog") for the same functionality. This probably is the reason why reverse() feels confused and throws NoReverseMatch exception. To avoid this situation you should use only one url prefix for accessing blog functionality. You can achive it eithe

Re: Can't get tiny_mce in admin

2008-11-23 Thread waltbrad
On Nov 22, 9:37 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sat, 2008-11-22 at 18:09 -0800, waltbrad wrote: > > [...] > > >     # Uncomment the next line to enable the admin: > >     (r'^admin/(.*)', admin.site.root), > >    (r'^tiny_mce/(?P.*)$', 'django.views.static.serve', > > { 'd

Re: simple reverse( ) errors

2008-11-23 Thread goblue0311
I'm not sure I understand what you're suggesting - can you provide a brief example, or highlight the specific lines where this change would go? On Nov 23, 12:35 pm, "Valts Mazurs" <[EMAIL PROTECTED]> wrote: > Hello, > > Quick solution: use redirect from "/" to "/blog" or vice versa. > > -- > Valt

new installable live CD of the Django framework

2008-11-23 Thread Liraz
Hi guys, I am one of the developers for TurnKey Linux, an opensource project that aims to develop high-quality software appliances that are easy to use, easy to deploy, and free. Our motto is "everything that can be easy, should be easy!" We recently released TurnKey Django, an easy-to-use, ligh

Re: simple reverse( ) errors

2008-11-23 Thread Valts Mazurs
Hello, Quick solution: use redirect from "/" to "/blog" or vice versa. -- Valts On Sun, Nov 23, 2008 at 19:16, goblue0311 <[EMAIL PROTECTED]> wrote: > > This post is an update to "NoReverseMatch question", which was an epic > fail in terms of resolving my issue. I blame myself for posting an >

simple reverse( ) errors

2008-11-23 Thread goblue0311
This post is an update to "NoReverseMatch question", which was an epic fail in terms of resolving my issue. I blame myself for posting an overly complex question. I will try again... I am trying to use reverse( ) in this manner: >> python manage.py shell >> from django.core.urlresolvers import r

Re: unicode cipher & generic views

2008-11-23 Thread oleg
Sorry, I forgot to put it :) view.py: def add(request): return create_object(request, Firm) def edit(request, key): return update_object(request, Firm, key) models.py: INDUSTRIES_CHOICES= set([('1','Авто'), ('2','Авиа')]) class Firm(db.Model): name= db.StringProperty(required=True

Re: No module gets imported, eventhough its there in the codebase

2008-11-23 Thread madhav
In continuation to my previous query It works absolutely fine with "daemonize=false". I dont why? On Nov 23, 7:50 pm, madhav <[EMAIL PROTECTED]> wrote: > Hello everybody, > I am struck with a very-weird problem. I am unable to import any view/ > module from my urls.py. This problem is ONLY wh

Re: dynamic method calling

2008-11-23 Thread Ned Batchelder
getattr is definitely preferable to self.__class__.__dict__ --Ned. http://nedbatchelder.com Henry Andrews wrote: > I've aways been under the impression that direct use of __dict__ was > discouraged. Something along the lines of __dict__ being an > implementation detail while getattr and hasattr

No module gets imported, eventhough its there in the codebase

2008-11-23 Thread madhav
Hello everybody, I am struck with a very-weird problem. I am unable to import any view/ module from my urls.py. This problem is ONLY when I run the webserver (lighttpd). When I run my app server(without lighttpd) alone, I wont be getting any exception/500 screen. Every url/view gets properly execu

flatpage at root/home?

2008-11-23 Thread watusee
Upgraded from 96 to 1.02. My home/root (at 127.0.0.1/) page (using flatpages) now doesn't work using runserver. Other flatpages are working fine. The entry in the urlconf looks like this: urlpatterns = patterns('', #(r'^works/$', 'django.views.generic.list_detail.object_list', dict (work_dict

Re: dynamic method calling

2008-11-23 Thread Henry Andrews
I've aways been under the impression that direct use of __dict__ was discouraged. Something along the lines of __dict__ being an implementation detail while getattr and hasattr are the proper interfaces. But I might be wrong. thanks, -henry On Nov 22, 4:07 am, "Steve McConville" <[EMAIL PROTEC

Re: Why are models referenced without a capital letter in templates

2008-11-23 Thread David Zhou
On Sun, Nov 23, 2008 at 6:31 AM, dash86no <[EMAIL PROTECTED]> wrote: > So what passes the poll context variable to the template? This isn't > done explicitly, right? How is the variable name determined? It's explicitly passed. There are some variables that are populated implicitly based on the

template variable default filter not doing what is expected

2008-11-23 Thread gv
Hello I'm constucting a table in the Django template language, and have this problem. When there is no value (from the dictionary generated by the view), I would like to fill in -1 like this: {{ item.ActiveSessions|default:"-1" }} However, only the cells that get values are filled in, if no va

Re: Why are models referenced without a capital letter in templates

2008-11-23 Thread dash86no
Thanks for the reply David. So what passes the poll context variable to the template? This isn't done explicitly, right? How is the variable name determined? Cheers, On Nov 23, 8:25 pm, "David Zhou" <[EMAIL PROTECTED]> wrote: > The key is the sentence above that snippet on that page: > > "Given

Re: Why are models referenced without a capital letter in templates

2008-11-23 Thread David Zhou
The key is the sentence above that snippet on that page: "Given the context variable poll" 'poll' is a variable passed into the template context. If you called that variable 'a_poll', you could've done: {{a_poll.question}} As for choice, notice the line: {% for choice in poll.choice_set.all

Why are models referenced without a capital letter in templates

2008-11-23 Thread dash86no
http://docs.djangoproject.com/en/dev/intro/tutorial03/#intro-tutorial03 I'm following the above tutorial, and I'm confused with the following section: {{ poll.question }} {% for choice in poll.choice_set.all %} {{ choice.choice }} {% endfor %} The 'poll' and 'choice' are referred to wit

Re: Ordering a ManyToManyField with "through" relation

2008-11-23 Thread Benjamin Hell
On Nov 23, 5:19 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > You might also be able to write > >         coll.members.order_by('membership_set') Works (with a small modification)! In order to get template for loops working I wrapped this in a Collection method: class Collection(models.Mod