Writing a subclassable Django singleton model

2009-03-10 Thread shabda
In [6]: y=SubSingleton(name='a', tag='b') In [7]: y.save() --- AttributeErrorTraceback (most recent call last) /home/shabda/django_design_pats/ in () /home/shabda/django_design_pats/testf/models.pyc

How to install django on Apache/Linux

2007-08-19 Thread shabda
I have apache installed on linux with mod_php, mysql. I am trying to get django working here, and am following the intsallation steps at http://www.djangobook.com/en/beta/chapter21/ . Step 1. Install mod_python did yum install mod_python. Checked that mod_python is installed. Step 2. Add this to

How to install mysql-python

2007-08-19 Thread shabda
I am trying to setup django with mysql, After installing django and mysql I am trying to set up mysql-python. So I give the command $ easy_install MySQL-python And am getting a ton of errors. On the page http://www.djangobook.com/en/beta/chapter02/, under comments for mysql it says, "Don't forget

Re: How to install mysql-python

2007-08-19 Thread shabda
: error: `PyExc_ImportError' undeclared (first use in this function) error: command 'gcc' failed with exit status 1 3. cd /sw/lib/mysql (that file is not on my system) So unabl;e to build the MySQL-python-1.2.2 library. On Aug 19, 12:52 pm, shabda <[EMAIL PROTECTED]> wrote: > I am trying

Re: How to install mysql-python

2007-08-19 Thread shabda
Yes the problem was with python-devel. After installing all the depndebcies, it went through fine. On Aug 19, 1:20 pm, Thejaswi Puthraya <[EMAIL PROTECTED]> wrote: > On Aug 19, 1:16 pm, shabda <[EMAIL PROTECTED]> wrote: > > > But even that is not helping. I am on a

Problems with syncdb

2007-08-22 Thread shabda
When I run the command $ python manage.py syncdb I am getting an error like Failed to install index for auth.Message model: (2006, 'MySQL server has gone away')Installing index for auth.Permission model I am on python 2.3.4, mysql 5.0.46, cent OS. My tables get created though. What can be the

How to add a non database item to a python model

2007-09-03 Thread shabda
I have a python model class MyModel(models.Model): fld1 = models.TextField() fld1 = models.TextField() I want to have a non database item in this model class, which I can populate in the views. What is the recommended way to do this.

Re: hai am new one to django

2007-09-05 Thread shabda
http://diveintomark.org/archives/2004/07/06/nfc I was walking across a bridge one day, and I saw a man standing on the edge, about to jump off. So I ran over and said, "Stop! Don't do it!" "I can't help it," he cried. "I've lost my will to live." "What do you do for a living?" I asked. He

Re: How to add a non database item to a python model

2007-09-05 Thread shabda
That seems too easy to be true. :). I have one more query, where should I add this code? Considering this attribute would be used in many views, I am trying to override __init__. def __init__(self, *vargs): models.Model.__init__(self, *vargs)

Re: How to add a non database item to a python model

2007-09-05 Thread shabda
Oh shucks, since I want to recalculate this attribute each time, I would need this to be in the view function. Still how would I override __init__ in django Models? On Sep 5, 11:10 pm, shabda <[EMAIL PROTECTED]> wrote: > That seems too easy to be true. :). > I have one more query, wh

Re: How to add a non database item to a python model

2007-09-05 Thread shabda
Traceback (most recent call last): File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "C:\Python24\lib\site-packages\django\contrib\auth\decorators.py" in _checklogin 14. return

How to start shell without ipython

2007-09-08 Thread shabda
I need to write some doctests for my app. So I am running the interactive shell by manage.py shell But since ipython is already installed on my system, the i python prompt starts and I can't just copy paste the shell output for creating the doctests. Is there some way I can ask the manage.py

Problems with deploying django

2007-09-10 Thread shabda
I am trying to deploy django on a fedora 7 system. After following these steps I am stuck! (Long tale of woes ahead, If you can just tell me where can I get apxs for apache, my problem is solved.) 1. Downloaded django, tried running setup.py, got an error saying something like unable to open

More deployment woes

2007-09-10 Thread shabda
I am trying to deploy django, and to test the install I am doing this, I run django-admin.py startproject hello in directory /root/django I have added to my httpd.conf SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE hello.settings

Weird problem with Flatpages

2007-09-12 Thread shabda
I have deployed a app on Apache with mod_python. I have the flat pages app+middleware installed. If I let debug = True in my settings.py and try to access any flatpage url they work fine. But if I put the debug = False in settings.py, the flatpages return 500 http respnse. Any way I can try to

Getting an 'User' object has no attribute 'startswith' when trying to use django.contrib.auth.views.login

2007-09-12 Thread shabda
e = callback(request, *callback_args, **callback_kwargs) File "/home/shabda/django/redpy/reddit/views.py" in register 290. login(request, user) File "/usr/lib/python2.4/site-packages/django/contrib/auth/views.py" in login 32. }, context_instance=RequestContext(request)) File "/usr

Re: Getting an 'User' object has no attribute 'startswith' when trying to use django.contrib.auth.views.login

2007-09-12 Thread shabda
:06 pm, shabda <[EMAIL PROTECTED]> wrote: > I am trying to loging a user after they fill a form, using code > > if request.method == 'POST': > data = request.POST.copy() > errors = form.get_validation_errors(data) > if not errors: >

how to put a cookie which is visible from all domains

2007-09-17 Thread shabda
If I have my site setup at example.tld and I have used the built in django authentication system, any page at foo.example.tld (or any subdomain of example.tld) is not able to access the user. So if the view is accesed from a subdomain the login_required or other decorators fail. It looks to me

Re: how to put a cookie which is visible from all domains

2007-09-17 Thread shabda
max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN, 44 secure=settings.SESSION_COOKIE_SECURE or None) Putting SESSION_COOKIE_DOMAIN = '.example.tld' in settings.py solves the problem. On Sep 17, 6:06 pm, shabda <[EMAIL PROTECTED]> wrote: >

How can we map a specific HTTP error to a python exception?

2007-09-20 Thread shabda
I have a number of pages which can potentially raise the self.model.DoesNotExist exception. Whenever this exception is raised, it maps to a HTTP 404 for me. (That object does not exist in the database, so I cant show this, so I want to return a 404 exception). So apart from manually adding

Re: How can we map a specific HTTP error to a python exception?

2007-09-20 Thread shabda
Bond <[EMAIL PROTECTED]> wrote: > Hi, > > On Thu, Sep 20, 2007 at 08:47:57AM -0700, shabda wrote: > > I have a number of pages which can potentially raise the > > self.model.DoesNotExist exception. Whenever this exception is raised, > > it maps to a HTTP 404 fo

Possible pug with Model inheritence - Inserts instead of Update

2008-10-12 Thread shabda
]: shabda = Foo(name = 'Shabda') In [3]: shabda.save() In [4]: Foo.objects.all() Out[4]: [] In [5]: shabda.name = 'Shabda Raaj' In [6]: shabda.save() In [7]: Foo.objects.all() Out[7]: [, ] Which is what I expect. Now doing the same thing to Bar In [1]: from djcalendar.models import Bar

How can I check which view is being called in response to a specific Url?

2008-10-12 Thread shabda
One of my views is returning a Http404, and I think it is calling a view function diffrent from what I am expecting to be called. So How can I check which view is being called in response to a specific Url? --~--~-~--~~~---~--~~ You received this message because

Re: Possible pug with Model inheritence - Inserts instead of Update

2008-10-12 Thread shabda
> so I would expect more problems > > On Oct 12, 9:16 am, shabda <[EMAIL PROTECTED]> wrote: > > > My models.py > > > class Foo(models.Model): > >     name = models.CharField(max_length = 100) > > >     def save(self): > >         self.i

Re: Feature like "acts_as" in Django ORM or contrib ?

2008-10-21 Thread shabda
Ordering: qs = Model.objects.filter(...).order_by('ordering_field') ord_list = [el for el in qs] Versioning: code.google.com/p/django-rcsfield (There are a few others, cant remember the names offhand.) On Oct 21, 12:13 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 21 oct, 08:37,

Order of fields reset on Dynamically generated Forms.

2008-10-27 Thread shabda
I need to use DynamicForm(form generated using database values), so I am using this method, http://uswaretech.com/blog/2008/10/dynamic-forms-with-django/ Now the order in which I define the fields is not the same as that for the rendered Html. If I change the line like setattr(EmployeeForm,

Re: trying to understand get_absolute_url, NoReverseMatch and url configs

2008-10-27 Thread shabda
You want something like this @models.permalink def get_absolute_url(self): return ('orgs.views.org', [self.type.slug, self.slug]) Essentially, you code would be doing something like reverse('/org/ hoa/', kwargs={..}) which fails. Templates supress Exceptions so you do not see them. On

How to get the Html representation of forms.Fields

2008-10-28 Thread shabda
I have some forms.Fields, which are not attached to any forms.Form. How can I get the Html representation of it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Why is my string not auto escaped?

2008-10-29 Thread shabda
I need to create a custom filter which displays some data from db depending on its data type. My code is something like, from django.template.defaultfilters import linebreaks, urlize def filterxx(data) return linebreaks(urlize(data.value)) My data.value is Asdfghjkl alert('hole') This

Re: Why is my string not auto escaped?

2008-10-29 Thread shabda
So if these built in filters are marking my strings safe, inspite of unsafe data being passed in, should they not handle escaping as well? Rajesh Dhawan wrote: > On Oct 29, 8:35 am, shabda <[EMAIL PROTECTED]> wrote: > > I need to create a custom filter which displays so

Filtering the modelform in Admin on request.user

2008-11-06 Thread shabda
I have an Admin site which I want to filter based on request.user. My ModelAdmin class is something like this, class FilterOnUser(admin.ModelAdmin): def queryset(self, request): return self.model._default_manager.filter(user = request.user) def get_form(self, request, obj=None,

How do test Middleware

2008-11-14 Thread shabda
I want to write some test for my middleware seperate from the views that would be using them. So I am using this snippet http://www.djangosnippets.org/snippets/963/ to get a request, and calling my middleware with it to test it, but it looks a little hackish to me. Is there a better way?

Is there a place from where I can get the completed code for the Django 4-part tutorial?

2008-11-17 Thread shabda
Is there a place where I can get the app completed as part of http://docs.djangoproject.com/en/dev/intro/tutorial04/#intro-tutorial04 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Anyone maintaining a Svn repo for django-registration?

2008-12-16 Thread shabda
Django registration has moved from googlecode to Bitbucket, which means my projects which are svn:externaled to django-registration might not get the latest code. Is anyone maintaining an svn repository which is I can svn:external to? --~--~-~--~~~---~--~~ You

Arbitrary precision arithmetic in django

2008-07-09 Thread shabda
I need to do some Financial calculations in an app in Django. models.DecimalField is fixed precision, while I need an arbitrary precision field. How can I do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Value proposition of Rails

2009-03-18 Thread shabda
[Trying not be trollish, but the subject might be so. My apologies in advance.] I run a small Django development firm ( www.uswaretech.com ), and a lot of clients we go after need to be convinced on why they should choose Django. What is your experience in this? Specifically am I looking for is,

Cross post from Djangoindia list: [Pycon] IRC Meeting to discuss how to represent Django

2009-08-10 Thread shabda
] sessions. Shabda will let us know the venue of the IRC meeting. In the meantime, let us decide on a suitable timing for the meeting. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou

Object paginator deprecated?

2008-03-26 Thread shabda
What are he new capbilities of the new paginator? Is there some wiki page tracking the deprications, like the backwardsincompatible changes? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

How to do background processing with Django

2008-03-26 Thread shabda
I response to some urls, my views need to start some potentially time taking actions. So how can I start background process, would it be as simple as ... t = threading.Thread(...) t.setDaemon(True) t.start() return HttpResponse(..) Or does django/apache have limitation on how threading can be

Re: How often do you update your django?

2008-03-26 Thread shabda
And if you are on windows, TortoiseSvn is a great way to get strated with svn. On Mar 26, 3:06 pm, James Tauber <[EMAIL PROTECTED]> wrote: > It might be worth adding that this approach works for Django because > development takes place on branches not the trunk. Other open source > projects may

Re: How to do background processing with Django

2008-03-26 Thread shabda
AIL PROTECTED]> wrote: > On Mar 26, 7:58 pm, shabda <[EMAIL PROTECTED]> wrote: > > > I response to some urls, my views need to start some potentially time > > taking actions. So how can I start background process, would it be as > > simple as > > > ... >

Re: How to do background processing with Django

2008-03-26 Thread shabda
Not the end user but the people who would be downloading this application, and want to use this, in a shared hosting environment. On Mar 26, 7:39 pm, "Ian Lawrence" <[EMAIL PROTECTED]> wrote: > Hi > > > are django and apache. Adding a HTTP server or configuring django- > > queuing is too

Re: Log a user in after registration?

2008-03-26 Thread shabda
You need to call authenticate() before you can call login() http://www.djangoproject.com/documentation/authentication/#how-to-log-a-user-in On Mar 26, 10:52 pm, truebosko <[EMAIL PROTECTED]> wrote: > I want to log a user in after they have registered on my site. > > Right now, I am using

Is identity map planned for Django ORM?

2008-03-27 Thread shabda
A test case showing the problem http://dpaste.com/41542/ . I always get bitten by this behaviour when I am writing tests. There was a discussion long ago about adding this feature of Identity maps

How are you storing binary data in db

2008-03-27 Thread shabda
Considering that BlobField is not supported, what are you using to store binary data. Recipes, snippets .. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How to check the SQL that the Django ORM is executing?

2008-03-27 Thread shabda
wouldn't getting the queries from connection.queries be abetter approach? On Mar 28, 1:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw... > > or > > you can make a function like this: > > In [19]: def show_sql(query):

Re: How are you storing binary data in db

2008-03-28 Thread shabda
Yes I was looking for snippets and recipes, not storing them in DB. There are some instances when storing things in DB is just too convinient comaring to storing them on files. For example I get some JSON from a external web service call. I want to cache it in the system, so I want to just pickle

Re: sports ratings

2008-03-29 Thread shabda
Read this, www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/ , and create a standalone django script. Then set up a cron job to run your script when you want. On Mar 29, 11:53 pm, ameriblog <[EMAIL PROTECTED]> wrote: > i have my own formula used for sports ratings (like jeff sagarin,

Optional else block in for

2008-03-31 Thread shabda
I was looking at jinja[1] and there was one feature which I really liked "for loops have an optional else block executed if there was no iteration." Right now most of my for loops are like, {% if comments %} {% for comment in comments %} {{comment}} {% endfor %} {% else %} There are no

Using CsrfMIddleware with ajax post requests

2008-04-02 Thread shabda
I have a some links, simple like .. . I handle clicks on them as ajax, and do a post . I want to protect this post against CSRF attacks, but CsrfMiddleware works only for form posts, because it add a form field. Is there some way I can get the CsrfMiddleware to work with ajax posts?

How to pass location to profiler.hotshot?

2008-04-03 Thread shabda
By default profiler.hostshot[1] creates profiling info in "/var/log/ cmsprofile". I am on a shred hosting, and do not have access to this location. Is there any way I can specify the location without modifying this django file. Currently this values is hardcoded into this file as

Transactions with custom sql

2008-04-04 Thread shabda
I am using mysql ith InooDB. I have some cutsom sql doing inserts. These inserts are not visible after the function returns, if I so something like sql = 'INSERT INTO tbl1 ...' from django.db import connection cursor = connection.cursor() cursor.execute(sql) return

Re: Weird unicode errors when using cutsom sql

2008-04-05 Thread shabda
Ouch, there was a % in the generated SQL. Guess I should have debugged a little more before posting here. :) On Apr 5, 1:44 pm, shabda <[EMAIL PROTECTED]> wrote: > I am using MYSql with latin-1 encoding. > > I get some weird intermittent errors when using custom sql. I

Making login work with every page.

2008-04-06 Thread shabda
If a user is not logged in, then on each page, I have a login form. This form posts to /accounts/login/ which does calls contrib.auth.views.login. This view only logs in a user if the session.test_cookie_worked(). So this means that from each page I need to call, if not

When does form.clean get called?

2008-04-07 Thread shabda
If I have a required field and I do not specify a value for the field, should form.clean get called? My understanding, after reading http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation, is that it should not, as clean_ will fail, and so form.clean will not be

Re: When does form.clean get called?

2008-04-07 Thread shabda
So is there a cleaner way to work in form.clean instead of doing if for.cleaned_datahas_key(field): for every element? On Apr 7, 6:06 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, Apr 7, 2008 at 8:19 AM, shabda <[EMAIL PROTECTED]> wrote: > > > I

Anybody used Google app engine, and wanna share their experience?

2008-04-07 Thread shabda
I got the news too late, and no more invites were avialable. Anyone who is using this, and their views ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

cursor.execute throws exception on MySql warning

2008-04-07 Thread shabda
I have a call like, crsr = connection.cursor() crsr.execute('DROP TABLE IF EXISTS news_linksearch') when table news_linksearch does not exists this would lead to a mysql warning, (Not an error, as it has a IF EXISTS clause), but this leads to a django exception. Should not the behaviour in

Re: Anybody used Google app engine, and wanna share their experience?

2008-04-08 Thread shabda
eptance note around 10:15, but haven't had time to play around with > it yet. > > On Apr 7, 9:14 pm, shabda <[EMAIL PROTECTED]> wrote: > > > I got the news too late, and no more invites were avialable. Anyone > > who is using this, and their views ... --~--~-

Anybody successfully deployed Django to appengine? Having some problems

2008-04-08 Thread shabda
I am trying to follow http://code.google.com/appengine/articles/django.html Which has a line # Log errors. django.dispatch.dispatcher.connect( log_exception, django.core.signals.got_request_exception) but log_exception is not defined/imported, so it gives a NameError. I guess they left the

Using Django with Appengine tutorial

2008-04-09 Thread shabda
Hi, I have written about how to build a Simple Django blog with appengine. You can find the tutorial here, http://www.42topics.com/dumps/appengine/doc.html. This documents what I learnt playing with appengine yesterday, and is very much a work in progress. This doc is released under

Re: When does form.clean get called?

2008-04-09 Thread shabda
gt; wrote: > On Mon, 2008-04-07 at 07:29 -0700, shabda wrote: > > So is there a cleaner way to work in form.clean instead of doing > > if for.cleaned_datahas_key(field): > > for every element? > > It depends what you want to do in the clean() method. The example you >

Appengine, a few questions about imports

2008-04-09 Thread shabda
In Django's code I see from imp import find_module [1] However in google's runtime the app module is empty.[2] Can someone more experienced than me, tell when this code will be hit, and what can I do to not hit this code. [1]

Anybody successfully deployed their Django app to Appengine?

2008-04-09 Thread shabda
Anybody successfully deployed their Django app to Appengine, and willing to share their code? I have a fair bit of code working on the dev_webserver, but it fails on deploying. Until the logging bug is resolved I think I am stuck behind seeing 500 server errors. I am sure I am missing something

Re: Using Django with appengine - Port of the django tutorial for appengine

2008-04-10 Thread shabda
Oops, gave wrong link. The correct link is http://www.42topics.com/dumps/django/docs.html . That one I wrote yesterday for people who already know Django. On Apr 10, 11:35 pm, shabda <[EMAIL PROTECTED]> wrote: > I have tried to write a Django tutorial for Appengine. This can be > fo

Using Django with appengine - Port of the django tutorial for appengine

2008-04-10 Thread shabda
I have tried to write a Django tutorial for Appengine. This can be found here http://www.42topics.com/dumps/appengine/doc.html. This is a port of the django tutorial from http://www.djangoproject.com/documentation/tutorial01/ to use Appengine. A live install of this can be seen at

Re: Tree from the model.

2008-04-11 Thread shabda
Though I do not always use a reusable app, even if it exists, (leaky abstractions[1]), django-mptt is awesome. It does what it claims to do, and stays out of the way. Very recommended if you need to model hierarchical data. On Apr 11, 11:43 am, "James Bennett" <[EMAIL PROTECTED]> wrote: >

Re: How we can integrate Django app in Google appengine.

2008-04-12 Thread shabda
[Shameless plug :)] http://www.42topics.com/dumps/django/docs.html http://www.42topics.com/dumps/appengine/doc.html On Apr 12, 4:49 pm, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > I'm not sure wether you're asking how to run django on GAE [1], or how > to do that using appengine's webapp

Re: I'd like to learn more about Django internals

2008-04-12 Thread shabda
I have been meaning to learn the code in django.db, but I can never get my head around metaclasses enough to do so. Anything you can suggest, Malcom? On Apr 12, 5:52 pm, "Erik Vorhes" <[EMAIL PROTECTED]> wrote: > You might be thinking of this >

Dynamic queryset to ModelChoiceField

2008-04-14 Thread shabda
I have a form where I want to do something like, class SetDefaultForm(forms.Form): topics = forms.ModelChoiceField() def __init__(self, user): super(SetDefaultForm, self).__init__() self.fields['topics'].queryset = Topic.objects.filter(user) This does not work, of

Multi DB question

2008-04-17 Thread shabda
I have a forum(non-Django) and a Django app both are in different databases. When a user is created in the Django I want to create another User in Forum. Do I need to use MultiDB branch for this, or is there a simpler way? Maybe using python-MysqlDB directly? Is there a recent merge of Django and

Re: Multi DB question

2008-04-17 Thread shabda
On Thu, Apr 17, 2008 at 6:00 AM, shabda <[EMAIL PROTECTED]> wrote: > > > I have a forum(non-Django) and a Django app both are in different > > databases. > > Can you install django on the forum database? It would probably make your > life a lot easier as you could w

Regression with QS-RF

2008-04-29 Thread shabda
I have a queryset with .extra call where I do something like this, self.get_query_set().extra ... tables=['news_topic as permission_table'] .. Pre qs-rf, the values in tables were not being escaped and so this was working, with qs-rf the value in tables is escaped, so my code fails.

Re: Tutorial: __str__() problems

2008-04-29 Thread shabda
Though __str__ should work here, until you can get this working, try writing __unicode__ method [EMAIL PROTECTED] wrote: > Hello, > I'm just going through the mysite tutorial and can't seem to get the > __str__() method to work when adding it to the two classes, I still > get []. This happened

Re: Tutorial: __str__() problems

2008-04-29 Thread shabda
Though __str__ should work here, until you can get this working, try writing __unicode__ method [EMAIL PROTECTED] wrote: > Hello, > I'm just going through the mysite tutorial and can't seem to get the > __str__() method to work when adding it to the two classes, I still > get []. This happened

Re: Suggestions on UI (client side web) framework to complement Django

2008-04-30 Thread shabda
We used Dojo for our last project, but there was far too many things happening behind the scenes, and not really documented. We finally decided to rewrite evrything in Jquery. Now I never look farther than JQuery. :) Andre Meyer wrote: > On Tue, Apr 29, 2008 at 9:00 PM, Szaijan <[EMAIL

[Repost] Error with .extra(tables=[]) after qs-rf

2008-04-30 Thread shabda
Reposting: Essentially my question is, what does "If that isn’t possible, put your extra() call at the front of the queryset construction so that your table is the first use of that table." mean? If I have overriden .get_query_set, to add a .extra, how can I move it too beginning of queryset

Announce: Djikiki - Django wiki application

2008-05-07 Thread shabda
Wanted to announce Djikiki - A Django based wiki to the community. Looks like there is no Django wiki, well apart from [1]. I had this done a few months ago, but I wanted to polish thing up a bit before I announced it here, but I guess right now I am going to be sorta busy for a long time with

Installing GeoDjango help

2008-05-22 Thread shabda
Is there a simpler way to install GeoDjango, than the one mentioned at http://code.djangoproject.com/wiki/GeoDjangoInstall ? Also is there any documentation about GeoDjango apart form the one at the wiki? --~--~-~--~~~---~--~~ You received this message because

Django-India Google group

2008-05-30 Thread shabda
Hello All Django people based in India! Did you know that there was no django-india Google group? Ouch. So I have created the Django-India google group. [http:// groups.google.com/group/djangoindia]. If you are a django-developer based in India join this group, so we have a centraol place to

Getting template errors before control goes to Django (Or so it seems)

2008-06-02 Thread shabda
I am trying to access an URL, and I get an error like this, Traceback (most recent call last): File "C:\Python25.1\lib\site-packages\django\core\servers \basehttp.py", line 277, in run self.result = application(self.environ, self.start_response) File

Trouble trying to use formtools.preview.FormPreview

2008-06-09 Thread shabda
I am trying to use formtools.preview.FormPreview after reading http://www.djangoproject.com/documentation/form_preview/ and am getting weird errors. This is what I did, 1. Have a form called AddReviewForm which is working as expected. 2. Created a class class ReviewPreviewForm(FormPreview):

Re: oracle-django problem

2008-06-09 Thread shabda
Or use this, >From http://www.djangoproject.com/documentation/model-api/#table-names "To override the database table name, use the db_table parameter in class Meta." On Jun 9, 7:46 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, Jun 9, 2008 at 6:43 AM, Harish <[EMAIL PROTECTED]> wrote: >

Re: Django Tutorial Clarification

2008-06-13 Thread shabda
> I have never used generic views, so share your confusion Well you really should. :) Well I have seen your name many times on the list so know that you are a longtime Django user. If you are not using generic views, you are missing something. On Jun 13, 12:41 pm, Kenneth Gonsalves <[EMAIL

Django test Client problems

2008-06-13 Thread shabda
I have some code like this, c = Client() client.get('/myurl/') where '//myurl' calls view function, def foo(request): ip_addrs = request.META['REMOTE_ADDR'] This view function works when I use a browser, as request.META['REMOTE_ADDR'] is populated. But when I use test Client, I get a

Should not ModelObj.objects.get() have a .values method?

2007-12-15 Thread shabda
The call ModelObject.objects.filter(id = entry_id).values() works fine and the call to .values converts the model object to a dictionary. But the call ModelObject.objects.get(id = entry_id).values() fails as the object returned by get doesnot have a .values method. So to convert this to

Is there a setting which will provide RequestContext to each view autmatically?

2007-12-16 Thread shabda
Since I need my logged in user to be available to each template, I need to go and add context_instance=RequestContext(request) to each view. Is there any setting which can make RequestContext available to each view? A related question is, I have some objects I need to make available to each

Re: How to modify every element in a list all at once

2007-12-16 Thread shabda
How about for s in s2: s.price.name *= s.price.name * .9 s.price.save() You are getting a type error coz you can not mutlipy a Model object by float, and that is what s.price is. BTW s2[0].price * .9 would not have worked as well, because of the same reasons! On Dec 16, 11:08

Are paginators lazy?

2007-12-18 Thread shabda
I am using the paginators(django.core.paginator) as describes at http://www.djangoproject.com/documentation/models/pagination/ . Are paginators lazy, like .filter and related method are? If I use paginator = ObjectPaginator(Article.objects.all(), 5) and then paginator.get_page(0) would the first

How to get the urls defined in urls.py

2007-12-18 Thread shabda
I have my urls.py defined as urlpatterns = patterns('app.views', (r'^foo/$', 'foo'), (r'^bar/$', 'bar'),) Now from a template i need to access these urls. So inside the template we can refer them as /foo/, /bar/. However later when I change the urls.py, these urls defined in urls.py

Template text are not being escaped when used with textile

2007-12-18 Thread shabda
I am using textile markup filter. When I am using a variable in the template without any filter they are being auto escaped, as they should. However, if I use any markup filter like textile or markdown, the text is not being auto escaped. Even using the escape filter manually does not help. (as

Re: Template text are not being escaped when used with textile

2007-12-18 Thread shabda
range from some days, I can not see the styling on some pages, :( . On Dec 18, 9:03 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Dec 18, 2007 8:56 AM, shabda <[EMAIL PROTECTED]> wrote: > > > I am using textile markup filter. When I am using a variable in the &g

Re: Template text are not being escaped when used with textile

2007-12-18 Thread shabda
And is there some setting which allows markdown to convert linebreaks to for all line breaks? Askin users to add two spaces when they want a line break in comment seems strange to me. On Dec 18, 10:39 pm, shabda <[EMAIL PROTECTED]> wrote: > So should not {{text|escape|textile}} remove

Weird problem with request.POST, correct data not coming out from request.POST

2007-12-18 Thread shabda
I am trying to get a value from request.POST. After form submit, request.POST contains the values of the ids from the checkbox selected. I want the list of those ids. SO I am doing something like, entry_ids = request.POST['delete'] , but this doesnot pick the list, but instead gets me the last

How to do a bulk update?

2007-12-19 Thread shabda
I have a QuerySet returned by a call like this foos = Foo.objects.filter(id__in = [1, 2, 3]) Now I want to update each of these elements' attributes to a specific value. What I need to do is some thing like, for foo in foos: foo.price = 0 foo.save() But this would make as many

Re: How to do a bulk update?

2007-12-19 Thread shabda
Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2007-12-19 at 05:35 -0800, shabda wrote: > > I have a QuerySet returned by a call like this > > > foos = Foo.objects.filter(id__in = [1, 2, 3]) > > > Now I want to update each of these elements' attributes to a specific >

Is there a HTML table widget for Django?

2007-12-19 Thread shabda
Is there a widget which can generate HTML tables from within django? My requirement is that I have a list of ModelObjects. Now I want to provide a UI where user can select a number of the ModelObjects, and then press the delte button to delte them or take a action on all of them. What I am doing

How to get named url patterns from inside a view function

2007-12-19 Thread shabda
I can get access to a named url from within a template by using {% url %} tag. What can I do to get access to named url from a view function? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Getting exception when trying to generate feed

2007-12-20 Thread shabda
I am trying to generate a feed. So I added the following lines to urls.py feeds = {'latest': main_feed} urlpatterns += patterns('', (r'^rss/(?P.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}) ) The class main_feed is, def main_feed (Feed): blog =

How to get the months for which a object exists in a table?

2007-12-21 Thread shabda
I have table say BlogEntries. Now to show an archive view I need to find the months for which at least one entry exists in the database. If I drop to raw SQL i can write to query to achieve this as, SELECT created_on , count( created_on ) FROM `myapp_blogentry` GROUP BY year( created_on ) ,

  1   2   >