Re: newforms-admin inlines question

2008-02-11 Thread shabda
I dunno if this is the answer you are looking for, but if you want to enforce that there is only one user set unique = True for the user in the UserProfile class. class UserProfile(models.Model): user = models.ForeignKey(User, unique = True) On Feb 11, 10:42 am, Aaron Fay <[EMAIL PROTECTED]>

Using property() with model attributes

2008-02-11 Thread shabda
I have a model something like, class Task(models.Model): name = models.CharField() parent_task = models.ForeignKey('Task') is_complete = models.BooleanField() class TaskItem(models.Model) name = models.CharField() task = models.ForeignKey(Task) is_complete = models.BooleanField() I

Re: Subclassing forms.CharField so that it gets a widget.

2008-02-07 Thread shabda
'): kwargs.update({'widget' : forms.TextInput(attrs={'dojoType':'dijit.form.TextBox'})}) super(DojoCharField, self).__init__(*args, **kwargs) or some thing similar. On Feb 8, 12:32 am, shabda <[EMAIL PROTECTED]> wrote: > I want to subclass CharField so that, its has a widget, and I do not

Subclassing forms.CharField so that it gets a widget.

2008-02-07 Thread shabda
I want to subclass CharField so that, its has a widget, and I do not always need to set it. So I do class DojoCharField(forms.CharField): def __init__(self, *args, **kwargs): super(DojoCharField, self).__init__(*args, **kwargs) if self.widget == None: self.widget

Specifying custom upload to with FileField

2008-02-06 Thread shabda
I have a model like class ProjectFile(models.Model): project = models.ForeignKey(Project) file = models.FileField(upload_to = '/files/') class Project(models.Model): name = models.CharField(max_length = 100) With this the uploaded files will go to <>/files/, howeverI want to upload

Using guids wih mysql

2008-02-03 Thread shabda
I want to use guids instead of auto incrementing keys with my models for primary keys. I am using mysql. Using the UUID funcion in mysql I can do this, but is there a simpler way? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Announce: 7days7apps.com

2008-01-27 Thread shabda
/ . If you use them for learning or in a production setting be sure to let me know. And if you got a few seconds, can you tell me your opinion at http://day4.7days7apps.com/poll/Does-7days7apps-suck/ Thanks, Shabda --~--~-~--~~~---~--~~ You received this message because you

Re: best configuration options for background processes

2008-01-27 Thread shabda
http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/ On Jan 28, 12:39 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'd like to run a few background processes on my server. > > They need access to the models in my app, the database, and the whole > django framework. > >

Re: Getting Out of range value adjusted for column 'created_on' at row 1

2008-01-26 Thread shabda
do not get the exception. The traceback is at, http://dpaste.com/32727/ On Jan 27, 12:26 pm, shabda <[EMAIL PROTECTED]> wrote: > When trying to save a model object I get an error saying, > > This is the line, which is causing the error. If I remove this line > and add null +

Getting Out of range value adjusted for column 'created_on' at row 1

2008-01-26 Thread shabda
When trying to save a model object I get an error saying, This is the line, which is causing the error. If I remove this line and add null + True to created_on firld I do not get the exception. The traceback is at, http://dpaste.com/32727/ --~--~-~--~~~---~--~~

django-queue-service documentation

2008-01-26 Thread shabda
I want to use django-queue-service to run long running processess in background, but I can not find any documentation about this. Their website http://code.google.com/p/django-queue-service/ does not contain any docs. Does any one have any links, about how to use it?

Re: Finding details of a Model object, which do not have objects of a given M2M field

2008-01-26 Thread shabda
(user__ne=some_uesr) > > On Jan 26, 6:14 am, shabda <[EMAIL PROTECTED]> wrote: > > > I have the model like, > > > class Blog(models.Model): > > url = models.URLField() > > > class Entry(models.Model): > > blog = models.ForeignKey(Blog) > >

Finding details of a Model object, which do not have objects of a given M2M field

2008-01-26 Thread shabda
I have the model like, class Blog(models.Model): url = models.URLField() class Entry(models.Model): blog = models.ForeignKey(Blog) user = models.ManyToManyField(User) User is contrib.auth.db.USER Now I given a blog and a user I need to find out all the Entry objects which are a

How to get sum of fields without using custom SQL?

2008-01-24 Thread shabda
My model is something like this, class Job(models.Model): name = models.CharField(...) class Entry(models.Model): job = models.ForeignKey(Job) hrs_worked = models.IntegerField() Now I want to get the sum of the hours worked in a job which I can get by summing Entries for that job.

How to use newforms ChoiceField to show dynamic choices

2008-01-24 Thread shabda
I want to use the ChoiceField to show choices depending on a query set. For exmple the ChoiceField must get all active Users and them show them in a drop down, something like what happens in Admin. How can I do that? --~--~-~--~~~---~--~~ You received this message

Striped tables in Django

2008-01-22 Thread shabda
Does anybody have a code snippet for getting striped tables with django? Basically I would need to apply alternating classes to the the rows returned by the rowset. I do not want to do this from javascript, but from server side. --~--~-~--~~~---~--~~ You received

Re: Tutorial03: question about efficiency

2008-01-22 Thread shabda
This is the right way to do so. Querysets are lazy. Only the rows needed will be fetched in this example. code_berzerker wrote: > theres line of code in tutorial: > > Poll.objects.all().order_by('-pub_date')[:5] > > this gives 5 Poll objects. I wonder if this is efficient way of > getting them?

Getting string index out of range error on using DateField

2008-01-22 Thread shabda
I have field in a form like, foo = forms.DateField(required = False, input_formats = '%m/%d/%Y') Now when I try to enter a date like 10/25/2006 I am getting an error string index out of range . Full stack trace, Traceback: File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in

Re: How to apply a class to a specific field's label in newforms

2008-01-22 Thread shabda
? On Jan 22, 5:23 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 22-Jan-08, at 5:45 PM, shabda wrote: > > > I want to have the one of the field for my form have a specific css > > class. But if I do something like, > > widget = forms.TextInput(attrs = {'size':60, 'cl

How to apply a class to a specific field's label in newforms

2008-01-22 Thread shabda
I want to have the one of the field for my form have a specific css class. But if I do something like, widget = forms.TextInput(attrs = {'size':60, 'class':'main'} The textInput, and not its associated label gets the class. How can I specify the class for label?

Re: filtering on a date field's component; a bug?

2008-01-22 Thread shabda
You have two underscores after start_date in start_date__month, probably that is the problem. Change this to start_date_month, (one underscore) and see if it works. On Jan 22, 2:15 pm, omat <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a model with a date field. When I try to filter based on

manage.py dbshell not working

2008-01-19 Thread shabda
I am trying to use the manage.py dbshell call. I give the command, F:\djangoprojects\polls>manage.py dbshell This is giving me an error like F:\djangoprojects\polls> ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) However in my settings.py I have set the user

Re: Loading Template

2008-01-17 Thread shabda
Save yourself the trouble of writing a view function and use the generic view direct_to_template http://www.djangoproject.com/documentation/generic_views/#django-views-generic-simple-direct-to-template On Jan 17, 12:50 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Jan 17, 2008 2:32 AM,

Re: Unable to find custom filters

2008-01-16 Thread shabda
function is being called. On Jan 16, 9:54 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Jan 16, 2008 11:31 AM, shabda <[EMAIL PROTECTED]> wrote: > > > > > > > I want to use some custom filters, and so I am using the steps given > > at > >h

Re: Unable to find custom filters

2008-01-16 Thread shabda
I also have added this to __init__.py __all__ = ['myfilters'] On Jan 16, 9:31 pm, shabda <[EMAIL PROTECTED]> wrote: > I want to use some custom filters, and so I am using the steps given > athttp://www.djangoproject.com/documentation/templates_python/#writing-... > > W

Unable to find custom filters

2008-01-16 Thread shabda
I want to use some custom filters, and so I am using the steps given at http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-filters What I did was, 1. Created a templatetags directory under th app and created __init__.py, myfilters.py under it. Its structure is

Re: Django Performance

2008-01-15 Thread shabda
Umm yes, I just meant that you get a own apache, and python instance, and can customise it. On Jan 15, 11:17 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > shabda wrote: > >> use django in a shared hosting environment or I need to buy a > >> Dedicated server? >

Re: Django Performance

2008-01-15 Thread shabda
Can I > use django in a shared hosting environment or I need to buy a > Dedicated server? While many people run Django in shared hosting, IMHO, that leads to much more trouble than it is worth. But you surely do not need a dedicated server for running django. I use Webfaction, and they are one

Re: Problem with Css and django template

2008-01-15 Thread shabda
You need to change this line type="text/css" href="testing1.css" /> to type="text/css" href="/static/testing1.css" /> On Jan 15, 1:00 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Jan 15, 2008 1:08 AM, laspal <[EMAIL PROTECTED]> wrote: > > This: > > > (r'^static/(?P.*)$',

Re: Can not login on running behind Apache, but can when on development server

2008-01-14 Thread shabda
But If it were so how would running it from the development server allow me to login? On Jan 14, 5:13 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 14-Jan-08, at 5:40 PM, shabda wrote: > > > Exception Type: SuspiciousOperation at /admin/ > > Exception Value

Re: Can not login on running behind Apache, but can when on development server

2008-01-14 Thread shabda
Trying to login many times in a row produced this Exception, Exception Type: SuspiciousOperation at /admin/ Exception Value: User may have tampered with session cookie. Full traceback, Traceback: File "/home/shabda/lib/python2.5/django/core/handlers/base.py" in get_res

Re: Can not login on running behind Apache, but can when on development server

2008-01-13 Thread shabda
orms.error, and forms.is_valid fails. On Jan 13, 11:31 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > What daes it mean "I am unable to login". Error aqcures, exception > raises or something else? > > On 13 янв, 18:33, shabda <[EMAIL PROTECTED]> wrote: > > > I have a v

Can not login on running behind Apache, but can when on development server

2008-01-13 Thread shabda
I have a view function I am using for logging in people. When I am deploying it to Apache/Mod_python, I am unable to login, but If I am running it on the development server, I am able to login. Any pointers? (I am not using the builtin login, as I want to use newforms.) The view function is, def

Re: Inserting a date into DateField

2008-01-12 Thread shabda
_dob = request.POST['dob'] gets the string representation of dob, and so python complains as it can't find the strftime method. You need to change your code to, _dob = form_name.cleaned_data['date_attribute_name'] form.cleaned_data, gets you the canonical representation for the data type

Re: Manually Inserting Non Field Errors in a newform

2008-01-12 Thread shabda
Override __init__ for the Form, passing it the request object and store it. Access it in .clean method. On Jan 12, 10:45 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I also just realized that the reason clean() wouldn't work when I > tried to pass it the request as an argument is simply

Working with object paginator

2008-01-12 Thread shabda
Ove of my view function is, def recently_featured (request): featured = FeaturedPage.objects.all().order_by('-ordering') paged_featured = ObjectPaginator(featured, djikikisettings.details_per_page) try: page_num = request.GET['page'] page_num = int(page_num) except:

Re: using newforms

2008-01-12 Thread shabda
Instead of this def __init__(self, user): profile = user.get_profile() for g in profile.groups.all(): self.GROUP_CHOICES += (g.id, g.name) super(MyForm, self) Should it not be, def __init__(self, user, *args, **kwargs): profile = user.get_profile()

Re: The last records of table by using of Pagination

2008-01-11 Thread shabda
instead of q_list = ObjectPaginator(Queue.objects.all(), 20) Provide a order_by, if you would like them to be in descending order, in order when they were created have, q_list = ObjectPaginator(Queue.objects.all().order_by('-id'), 20) Or better yet have a created_on field in the model,

How are the ids for Django models calculated?

2008-01-11 Thread shabda
Django adds an ID field to all models by default. Some questions about that. How are the values calculated. If Django asks the DB to provide it those values, can we be sure, for all supported backends, that 1. The ids are auto incrementing, (and not just unique). 2. They start from zero. 3. The

How to refer to a class defined later in the file

2008-01-07 Thread shabda
I want to have a models.py like this, class PageRevision(models.Model): """Stores a specific revision of the page""" text = models.TextField() revision_for = models.ForeignKey(Page, related_name = 'revision_for') class Page(models.Model): """Stores the latest page, the page

Re: How to bind data to a form, and not make the validation fire

2008-01-06 Thread shabda
text = forms.CharField(widget = forms.Textarea, initial = self.page.text) I just can't get this to work? Any place where I can look for dynamic values to initial? On Jan 6, 2:38 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2008-01-06 at 01:32 -0800, shabda wrote: > >

How to bind data to a form, and not make the validation fire

2008-01-06 Thread shabda
I have a form, to which I want to pass some data when it is first dipalyed, My form is, class EditPage(forms.Form): text = forms.CharField(widget = forms.Textarea) edit_summary = forms.CharField() In my view I bind data to this form as if request.method == 'GET': page =

How to mark a model attribute as safe?

2008-01-06 Thread shabda
I have a model attribute of type TextField, where I am storing html data. While displaying in template I do not want to escape it, and so should mark this as safe. How can I do this? I read the link at http://www.djangoproject.com/documentation/templates_python/#filters-and-auto-escaping , but

Re: Fields not displaying in the admin interface

2008-01-05 Thread shabda
Damn, I am feeling so stupid now :( . Thanks, that was the problem! On Jan 6, 11:30 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 06-Jan-08, at 11:52 AM, shabda wrote: > > > I have an app, and that app is included in the installed_apps in > > settings.py. Whn I

Fields not displaying in the admin interface

2008-01-05 Thread shabda
I have an app, and that app is included in the installed_apps in settings.py. Whn I run manage.py runserver, tables referred in the app are created. However none of the entities in that table are displayed in the admin interface, which shows tables from contrib.sites and contrib.auth. What could

django-websearch

2008-01-05 Thread shabda
Many of us would like to do a search for our website from within django. With django-websearch[1] you can do a search for your site, any general search on the web. I had talked about this a long time ago here[2], and had the code, but never got around to posting this online. The usage instruction

Getting exception 'User' object has no attribute 'backend'

2008-01-02 Thread shabda
I have this code, from django.contrib.auth import login user = User.objects.get(username = login_form.cleaned_data['username']) login(request, user) Which is giving me exception 'User' object has no attribute 'backend' Traceback: File

How to load test a website

2007-12-31 Thread shabda
This is not really specific to Django, still. How can I load test a website. I have a Django website, and I want to see how many users its can serve concurrently, and how many pages can it generate each second. How can I do this? (I am not looking to profile it at this moment, I just want to see

Blogango - a blog software written with django

2007-12-31 Thread shabda
Hi everyone, Its almost the new year here, so Happy new year! Let me just say a big thanks to every one on the django-users list, who helped me with most of my questions, many of them inane. In particular James Bennet and Malcolm Tredinnick were very helpul. Django wont be as much fun without the

How to check which view got called by a request

2007-12-29 Thread shabda
Using the testing framework how can we make sure that the correct view got called. Documentation at http://www.djangoproject.com/documentation/testing/#testcase says that (django.test.client can be used to) "Test that the correct view is executed for a given URL.", but I can't figure out how.

How to pass extra attributes to User authentication view?

2007-12-22 Thread shabda
To allow users to log-in, I have something like this in urls.py (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'myapp/login.html'}), But myapp/login.html expects a number of extra objects from that populated by the login view. In other generic views, I could have

Re: Getting Error - "Error while importing URLconf 'blogango.urls': list index out of range"

2007-12-22 Thread shabda
g_line def items (self): entries = BlogEntry.objects.all()[:10] return entries I get no error. What I do not understand is why should the main_feed class be instantiated as soon as I import feeds? Should not the instantiation happen only when the feed is accesed? On Dec 22, 1:2

Getting Error - "Error while importing URLconf 'blogango.urls': list index out of range"

2007-12-22 Thread shabda
Getting this error, "Error while importing URLconf 'blogango.urls': list index out of range". The exception stack does not give any cles to what might be wrong. The exception stack is, Traceback: File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in get_response 73.

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 ) ,

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 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

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

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 >

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

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

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

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

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

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

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

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

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

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

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

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 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 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: 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: >

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

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

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

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

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

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

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
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: 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

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.

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

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

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

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

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

Re: how to define stored procedures within django

2007-06-21 Thread shabda
thanks, That solves my problem. On Jun 21, 11:05 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > I want to use some stored procedures. I am mySql. Is there > > some way I can define stored procedures from withing django? > > (We can call already defined procedures, >

how to define stored procedures within django

2007-06-21 Thread shabda
Hi, I want to use some stored procedures. I am mySql. Is there some way I can define stored procedures from withing django? (We can call already defined procedures, http://www.djangosnippets.org/snippets/118/ discusses how, but can we also define stored procedures from within django?)

recommendations for hosts

2007-06-18 Thread shabda
Hi, What host do you people recommend for hosting a small-medium traffic django site. Its just a hobby hobby site so I dont want too costly a host, but since this is the first django app I would be hosting, I would prefer a host with reasonable support and one which specialises in django.

Re: Developing without tempplates

2007-06-18 Thread shabda
Also using locals() and printing is not very useful as it dumps too much data to screen to be any use. On Jun 18, 10:04 pm, shabda <[EMAIL PROTECTED]> wrote: > Hi, > > I am prototyping an app. Since I am just prtotyping I do not want to > write templates yet. SO is there some

Re: Providing defaults to models

2007-06-18 Thread shabda
ue of ``None`` So providing default values for models should be possible. On Jun 18, 9:30 pm, shabda <[EMAIL PROTECTED]> wrote: > Hi, > > I have a model class like this > > class Link(models.Model): > link = models.URLField() > user = models.ForeignKey(User, unique=F

Providing defaults to models

2007-06-18 Thread shabda
Hi, I have a model class like this class Link(models.Model): link = models.URLField() user = models.ForeignKey(User, unique=False) text = models.TextField(maxlength = 20) votes = models.IntegerField() I want some of the fields to have defaults, like I want votes to have a

<    1   2