Re: cannot import name User (from django.contrib.auth.models)

2007-06-18 Thread RajeshD
> I was making an application that included user profiles, and I thought > I was done with the first part so I entered an sql command and got > this: > > Ian-Smiths-Computer:~/Sites/matches ismith$ python manage.py sql nest > matches.cafe: cannot import name User Notice that the error is in 'mat

Re: Introducing DjangoSites.Org

2007-06-20 Thread RajeshD
Hi Ross, This is very neat! Wish you great success with the site. -Rajesh --~--~-~--~~~---~--~~ 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 T

Re: How to know what went wrong with the .save()

2007-07-03 Thread RajeshD
Hi Ana, > > [views.py] > level=Level() > level.level_name=form.clean_data.get('level_Name') > level.instrument_name=form.clean_data.get('instrument_Name') > level.available=form.clean_data.get('available') > level.tablename=form.clean_data.get('tabelname') > > level.save()

Re: Form isn't appearing properly in template

2007-07-03 Thread RajeshD
Hi, > I was basing my template off > of:http://www.djangoproject.com/documentation/0.95/forms/ You should definitely move to the newforms framework with either the 0.96 release or the SVN trunk. See the newforms docs here: http://www.djangoproject.com/documentation/newforms/ -Rajesh --~--~-

Re: How to know what went wrong with the .save()

2007-07-04 Thread RajeshD
On Jul 4, 12:14 pm, AnaReis <[EMAIL PROTECTED]> wrote: > Hi again, > Thanks for the suggestion, but this still isn't working... the > difference between this module and the others that I have already made > is that (besides the fact that the others actually work) this one > involves a table with

Re: How to know what went wrong with the .save()

2007-07-05 Thread RajeshD
On Jul 5, 8:44 am, AnaReis <[EMAIL PROTECTED]> wrote: > Hi again,>From what I could understand, I would have to recreate the database > so > > that django could create an ID field for me. Unfortunately that isn't > possible because I'm using a legacy database and I can't change it. Right. > In

Re: Unicode branch merged into trunk

2007-07-05 Thread RajeshD
Thank you, Malcolm! --~--~-~--~~~---~--~~ 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 [EMAIL PROTE

Re: Django Trigger

2007-07-10 Thread RajeshD
> > I currently have "Service_1_Profile.client" set as a foreign key to > "Client", and I am creating the profiles manually. Any suggestions on > how to automate this in accordance with steps 1-5? Here's a thought: 1. You can leave Service_1_Profile.client and add distinct=True to it's definiti

Re: saving many2many relations

2007-07-11 Thread RajeshD
Hi, > Anyone knows where the problem is? If you are using the Admin app to populate tags then the automatic manipulators first call Receta.save() followed by setting the models M2M field. This wipes out your changes to etiquetas inside Receta.save() One solution is to add get_tags and set_tags

Re: Displaying the contents of a Dict (Using POST)...showing 'x' and 'y' keys?

2007-07-27 Thread RajeshD
> {% for a in pad %} > > > I would suggest adding a prefix to that name: This way, when you are looping through your request.POST dictionary keys, you can skip keys that don't start with "pad-" that will prevent your loop from breaking if you get unexpected keys in the form post. --~--

Re: Newforms and GET Requests for Search Result Pagination?

2007-07-30 Thread RajeshD
> Is it not possible to use Newforms with GET requests? It is. You can pass it any "dictionary-like" object instance as its submitted data (request.GET and request.POST are both dictionary-like objects.) > I'm trying to > figure out how to paginate results from a search form, and I'm passing > G

Re: Newforms - passing form data in sessions - Trouble with ForeignKey

2007-08-02 Thread RajeshD
> But I run into trouble when saving in sessions via clean_data and then > trying to initiate a newform with the saved clean_data. This occurs > only when ForeignKeys are in the Game. > > This is probably due to the nature foreignkeys are stored as an object > in clean_data (see below). Correct.

Re: Trigger a django user password change...

2007-08-02 Thread RajeshD
> > One idea is this: > > ===- > > old_passwords = {} > def save_old_pass(sender, instance, signal, *args, **kwargs): > user_obj = instance > old_pass = user_obj.password > old_passwords[user_obj] = old_pas

Re: Trigger a django user password change...

2007-08-02 Thread RajeshD
> > Any better ideas? You could also use the pre_save signal in your first solution (instead of post_save). That will give you the new password before it's saved to the DB. So, you can pull up that user's DB User object and compare the two passwords. Of course, and send a message to the user. O

Re: Python/Django n00b having problems with flup/fastcgi .

2007-08-08 Thread RajeshD
> I attempt to run the project with fastcgi instead of > runserver, python manage.py runfcgi protocol=fcgi daemonize=false > host= port= . No errors or warnings are sent to the > screen. When I attempt to view the site on my browser, the django > fastcgi script instance does not respond in any m

Re: A question on lists and sorting, to prepare for a template

2007-08-08 Thread RajeshD
{'Breakfast':[{'day':'1', 'main_course':'pancakes', 'beverage':'milk'}, {'day':'3', 'main_course':'cereal', 'beverage':'orange_juice'}, {'day':'2', 'main_course':'waffles', 'beverage':'milk'}], 'Supper': [{'day':'1', 'main_course':'spaghetti', 'beverage':'water'}, {'day':'2', 'main_course':'pork_c

Re: Using Filter on a list of objects?

2007-08-09 Thread RajeshD
Try changing this fragment: for q in y: styles = Choice.objects.get(id=q.id).style_set.all() to something like this: choice_ids = [c.id for c in y] styles = Style.objects.filter(choice__id__in=choice_ids).distinct() If that works, you shouldn't need a set or a map to weed out duplicates. I

Re: Using Filter on a list of objects?

2007-08-09 Thread RajeshD
Hi Greg, > myset.add(styles) You don't need the myset part anymore. > It's bringing back the right records (not filtered though), however > they are not visible. Probably because of a list within a list. Right. I assume that you were using the set idiom to eliminate duplicate records of Styl

Re: Using Filter on a list of objects?

2007-08-10 Thread RajeshD
Hi Greg, Please see some notes below. > def searchresult(request): > if request.method == 'POST': > NOT_PICKED = "---" > y = Choice.objects.all() > if ('price' in request.POST and request.POST['price'] <> > NOT_PICKED): You cou

Re: Fwd: Proposal for the Web User Interface of the OSSEC HIDS

2007-08-10 Thread RajeshD
> > -- Forwarded message -- > From: Ian Scott Speirs <[EMAIL PROTECTED]> > Date: 10 ago, 14:27 > Subject: Proposal for the Web User Interface > To: ossec-list > > Jonas wrote: > > > On 9 ago, 23:33, Jeff Schroeder <[EMAIL PROTECTED]> wrote: > >> In opensource, proposing something

Re: object doesn't have get_absolute_url() methods

2007-08-15 Thread RajeshD
On Aug 15, 1:03 pm, Drasty <[EMAIL PROTECTED]> wrote: > I have a get_absolute_url() method on the object, but it doesn't > appear in the template, and the admin throws the error in the subject > line if I try to follow the "view on site" link. What error does it throw? --~--~-~--~

Re: object doesn't have get_absolute_url() methods

2007-08-15 Thread RajeshD
I don't see anything wrong with what you have there. Try these: 1. Make sure the get_absolute_url method uses correct indentation (tab vs. 4 spaces) consistent with the rest of your models.py 2. Drop into a shell with "python manage.py shell" and get an instance of your model object. Then issue

Re: object doesn't have get_absolute_url() methods

2007-08-15 Thread RajeshD
On Aug 15, 4:33 pm, Drasty <[EMAIL PROTECTED]> wrote: > Which actually works. Oh, you Django with your various appropriate > ways to call things! You would get a faster response here next time if you'd make your sample model more like the one that's giving you the problem :) --~--~-~-

Re: Odd 404 error on Textdrive with Lighty

2007-08-20 Thread RajeshD
Hi Dave, > line 72, in find_template_source > raise TemplateDoesNotExist, name > TemplateDoesNotExist: 404.html This is really saying that you do not have a 404.html template defined. Just create a simple 404.html file at the base of your template dir path and add a simple message to it. Th

Re: Odd 404 error on Textdrive with Lighty

2007-08-20 Thread RajeshD
On Aug 20, 6:11 pm, "David Merwin" <[EMAIL PROTECTED]> wrote: > Fixed the 404 template and 500 templates. > > Here is the site wide URLS:http://dpaste.com/hold/17376/ > > Here is the object URLS:http://dpaste.com/hold/17375/ A couple of URLs that give you the 404 error? --~--~-~--~---

Re: Odd 404 error on Textdrive with Lighty

2007-08-20 Thread RajeshD
On Aug 20, 7:53 pm, "David Merwin" <[EMAIL PROTECTED]> wrote: > http://stpaulswired.org/media/audio/2007/aug/05/straight-from-t/is > teh main one and then derivitaves of the same: > > http://stpaulswired.org/media/audio/2007/aug/05/http://stpaulswired.org/media/audio/2007/aug/ > > Thanks so much

Re: FileField: changing file names

2007-08-21 Thread RajeshD
> dscn0001___.jpg > dscn0001.jpg > dscn0001_.jpg > > I could override the save() method to save the files under / > , but that would make the get_FOO_url and others fail. No it won't. As long as your ImageField ends up pointing to the correct relative path of your renamed imag

Re: quiz design

2007-08-21 Thread RajeshD
On Aug 19, 10:40 pm, "Ramdas S" <[EMAIL PROTECTED]> wrote: > Hi, > > Has anyone worked on a quiz/ multiple choice contest design using Django > using Newforms? Yes. http://popteen.com/feature/view/style/looks/what-s-your-sunbathing-style-/ --~--~-~--~~~---~--~

Re: In-line Comments

2007-08-21 Thread RajeshD
> So the question is, if anybody is aware of an in-line comment system > we could use or build upon, otherwise I guess I'll try and do > something myself. A good starting point: http://www.jackslocum.com/blog/2006/10/09/my-wordpress-comments-system-built-with-yahoo-ui-and-yahooext/ --~--~

Re: queryset cache

2007-08-22 Thread RajeshD
On Aug 22, 8:08 am, sean <[EMAIL PROTECTED]> wrote: > Hi all, > I'm running into a performance problem with some pages i created. The > page has multiple forms, which are all the same, with the exception of > the initial data (it's a kind of batch insert functionality), but all > foreign keys an

Re: queryset cache

2007-08-22 Thread RajeshD
On Aug 22, 10:21 am, sean <[EMAIL PROTECTED]> wrote: > That's the problem, I don't know how to cache the queryset. > But for what it's worth, here's something i tried. I tried to take > advantage of the default caching of querysets, but that doesn't work > here. > > mediaform = CustomMediaForm >

Re: site/section/app

2007-08-29 Thread RajeshD
1. You could use a GenericForeignKey in your 'App' model: http://www.djangoproject.com/documentation/models/generic_relations/ Quote: "Generic relations let an object have a foreign key to any object through a content-type/object-id field. A generic foreign key can point to any object, be it ani

Re: Multi page article

2007-08-29 Thread RajeshD
I would second Michael's suggestion to use a page break marker. I have used that in many instances with great succcess -- your content admins will thank you :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: forms, views and foreign key

2007-09-06 Thread RajeshD
> -- > so.. the problem is: > > Request Method: GET > Request URL:http://127.0.0.1:8000/profile/ > Exception Type: AttributeError > Exception Value:'Profile' object has no attribute 'get' > > what's wrong? :( > What line of c

Re: Translating strings with placeholder in template

2007-09-06 Thread RajeshD
> I think this would work with Python code. However, can I do the > translation in Django's Template language? If so, how? See blocktrans: http://www.djangoproject.com/documentation/i18n/#in-template-code In short, you would use: {% blocktrans %}login.before.you.proceed {{ login_url }}{% endbl

Re: Custom template tags within a textarea field

2007-09-06 Thread RajeshD
On Sep 5, 12:03 pm, MichaelMartinides <[EMAIL PROTECTED]> wrote: > Hi, > > Just to be sure. > > If I have custom template tags within a TextAreafield of a model. I > would do something like to following: > > def view(request, page): > p = Page.objects.get(name=page) > t = Template( p.content

Re: overriding save, non-admin error

2007-09-06 Thread RajeshD
On Sep 4, 7:18 am, canburak <[EMAIL PROTECTED]> wrote: > I have a problem on overriding the save() method. > my new save is: > class ClassName: > def save(self): > self.title = self.title.title() > super(ClassName, self).save() > > when admin site uses this save(), I get the non-unique

Re: unique_true option of the fields works as case-sensitive, how can we make it case-insensitive?

2007-09-06 Thread RajeshD
On Sep 4, 9:28 am, parabol <[EMAIL PROTECTED]> wrote: > When I mark a field as unique_true is works as case-sensitive and does > not catch something like "problem" and "Problem". What is the correct > way of making it case-insensitive? Thus it will catch even "problem" > and "ProBLem". > > I tr

Re: using querysets to populate a form

2007-09-06 Thread RajeshD
> I have a requirement to use querysets as choices in various elements > of a form, and as the data grows this is clearly going to have a big > hit on the database every time this form is loaded. Can anyone think > of a way around this? Is there a way to cache the query set and only > up

Re: Storing Lookup Data

2007-09-06 Thread RajeshD
> > It seems like the Choice table is easier on the user. You tell them > to go to the Choices table to enter all the look-up data, as opposed > to giving them X tables to wade through. As you said, it is probably a DB design question -- even within a single project, you might need to use both a

Re: User Administration

2007-09-07 Thread RajeshD
> > please have a method to add one user to a specific group? Try this: grp = Group.objects.get(name='registered') us.groups.add(grp) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: hidden fields

2007-09-07 Thread RajeshD
On Sep 7, 9:55 am, Ana <[EMAIL PROTECTED]> wrote: > Hi, > I'd like to have "last modified by" and "owner" fields in my > application. I'd like to set fields value automatically, and I want > those fields to be hidden. Is there any way I can do that? Yes. Here's one way to do it: Add those t

Re: data manipulation in templates or views?

2007-09-07 Thread RajeshD
> I hope I am not inviting a quasi-religious war > on this issue, but I am wonder if people could provide some insight on > when or why I should do this sort of thing within the template (via > template tag or not) or if I should continue doing that within the > view, which not only currently make

Re: best practice for lookup

2007-02-26 Thread RajeshD
> from schools.models import School > def schools(request, country, city) > schools = School.objects.? Try this: schools = School.objects.filter(city__exact=city, city__country__exact=country) Basically, use double underscores in the query fields to traverse through your model heira

Re: Be sure filenames are unique in imagefield

2007-03-15 Thread RajeshD
> I think to put the id of the object on the "upload_to" keyword but I > don't know if this is possible. > Is there a way to ensure the filename is unique for that model? Actually, Django already takes care of this for you. It adds underscore(s) to your upload file's name until the filename is un

Re: tryin edit a user in DJANGO ADMIN and get 404

2007-03-16 Thread RajeshD
> Hi all. I try to edit user in DJANGO ADMIN, I can see user list but > when I click on one of them I get Page not found (404). What URL does your browser show when you get that 404 error? --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: select_related() - how to get multiple depth joins

2007-03-17 Thread RajeshD
> For example: using python manage.py shell > - > from myproject.myapp.models import * > req = Request.select_related().get(request_id = '000N07') > req.request_id > outputs -> '000N07' > req.country >

Re: ERROR: current transaction is aborted, commands ignored until end of transaction block SET TIME ZONE 'America/Chicago'

2007-03-23 Thread RajeshD
> > 1) /var/log/pgsql is empty... The PgSQL log should not be empty. 1. Check that pgsql is actually running :) 2. Check that pgsql is not set to log to your system log (syslog) Once you see the pg log, it will show you which query failed. --~--~-~--~~~---~--~--

Re: Custom SQL - Do I need to close the connection?

2007-03-23 Thread RajeshD
> Do I need to close the connection after I'm done with the results? You shouldn't have to. Django closes the connection at the end of the request. > I've also recently started receiving 'too many connections' errors... > and thought this might be the reason? What database are you using? Can yo

Re: post_save and M2M

2007-03-23 Thread RajeshD
> > Maybe the related objects are manipulated in a post_save signal, but > after 'my' post_save, so I can't see them at all. Yes. The post_save signal is sent out right at the end of the save method of your main model object. The M2M objects are saved later than this. > Any clues? 1. Use your o

Re: foreign key filtering

2007-03-26 Thread RajeshD
> > msgs = Messages.active.filter( Q( project=project.id, project.active=True ) ) > Try this: msgs = Messages.active.filter(project__active=True) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group

Re: filters/sql

2007-03-27 Thread RajeshD
> I can do pretty much any part of the filtering by itself and it works, > just not all together like I need it. What's the correct way to do > this sort of a query/filter? 1. What does your model for Message look like? 2. Where in your code are you trying to add more filtering? In a view? -

Re: Session support

2007-03-27 Thread RajeshD
On Mar 27, 11:00 am, "SlavaSh" <[EMAIL PROTECTED]> wrote: > Is it any way to use session (django) on browsers without cookie > support ? No. See the following for why not: http://www.djangoproject.com/documentation/sessions/#session-ids-in-urls --~--~-~--~~~---~--~-

Re: Dynamically List By Category

2007-03-27 Thread RajeshD
On Mar 23, 9:26 pm, "makebelieve" <[EMAIL PROTECTED]> wrote: > Ok, from a previous post I've found that the best way to list items by > a category is to use _set: > > {% for c in categories %} > {{ c }} > {% for i in c.item_set.all %} > {{ v }} > {% endfor %} > {%

Re: Managing users through Admin app

2007-03-28 Thread RajeshD
See this Django Snippet by Chris: http://www.djangosnippets.org/snippets/74/ --~--~-~--~~~---~--~~ 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

Re: Managing users through Admin app

2007-03-28 Thread RajeshD
On Mar 28, 5:15 pm, "Thom" <[EMAIL PROTECTED]> wrote: > Thanks for pointing me to the snippets, however, this doesn't seem to > work in the built in Admin Application. Any other thoughts? Actually, that should work from the Admin application too. The Admin app uses the same set of authenticatio

Re: Managing users through Admin app

2007-03-29 Thread RajeshD
Hi Thom, On Mar 28, 10:13 pm, "Thom Allen" <[EMAIL PROTECTED]> wrote: > I'll try it with just the one backend, but maybe I haven't explained my > problem correctly. This won't fix the problem. Multiple authentication backends are supported by Django (it just tries them all in succession and stop

Re: Search tables related by a foreign key in admin

2007-04-13 Thread RajeshD
> > search_fields = ['question', 'choice_choice'] > > Where choice_choice is supposed to be pointing to the choice field in > the choice model, but something is not working with that. I am sure > that I am missing something very easy and I was wondering if someone > could point it out to me. Tr

Re: __str__ referencing variables in other classes

2007-04-20 Thread RajeshD
Hi Jason and Paul On Apr 20, 2:52 pm, Paul Childs <[EMAIL PROTECTED]> wrote: > Hey Jason > > Try: > return self.title + self.member.first_name + self.member.last_name That's still not going to work since member is a many-to-many field -- self.member really references a collection of values not a

Re: Preventing saving of objects in admin: how to send message back to the user?

2007-04-20 Thread RajeshD
> > def save(self): > # code to determine if image is RGB or CMYK > if isRGB is True: > super(Photo, self).save() > else: > return > > Is there a way to tell the user that their photo was rejected because > it was in CMYK? Should I be returning something in particular

Re: IEPngFix Hack for Django ?

2007-04-27 Thread RajeshD
> > Has anyone else got this hack to work with django ? > > http://www.twinhelix.com/css/iepngfix/demo > I have used the "PNG Fix" successfully on a couple of sites. You're right the hack has nothing to do with Django. Here's my PNG: http://gaylefitzpatrick.com/media/style/images/denmarkteak.png

Re: Whether 2G RAM dedicated server could support a django site with 190 reqs/sec?

2007-04-27 Thread RajeshD
On Apr 27, 8:16 am, "Benjamin Slavin" <[EMAIL PROTECTED]> wrote: > On 4/27/07, Nicola Larosa <[EMAIL PROTECTED]> wrote: > > > You may consider starting with a virtual server, and then moving to > > dedicated ones when the traffic warrants it. > > I second the recommendation to go with a virtual

Re: Decoupling templates

2007-09-12 Thread RajeshD
> How can I decouple my templates to an app specific directoy? The way that my > apps are self contained also regarding their templates? That feature is built in to Django. Create a templates sub-directory in your app directory and place your app specific templates in there. Look at the the djan

Re: django-voting question

2007-09-12 Thread RajeshD
> > Problem is, I can't manage to do anything with posts in my template. What exactly are you trying to do that's not working? > When I view source, I see an object reference, so I know it's getting > there, and I know this is probably a terribly dumb question, but how > do I access posts? How

Re: form_for_instance + user profile

2007-09-12 Thread RajeshD
> > Basic example: > > user = User.objects.get(id=1) > user_profile = user.get_profile() This should work if you have settings.AUTH_PROFILE_MODULE pointing to your UserProfile model. See: http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/ --~--~-~--~~---

Re: Signals not working correctly

2007-09-13 Thread RajeshD
On Sep 13, 11:13 am, Greg <[EMAIL PROTECTED]> wrote: > Hello, > I'm trying to use signals so that when a Publication gets deleted from > within the Admin it will 'assert False, "Here"' (This will obviously > change at a later date). Currently, when I delete a Publication (in > the django admin

Re: sharing django on production and dev

2007-09-28 Thread RajeshD
Hi, On Sep 28, 1:46 pm, Milan Andric <[EMAIL PROTECTED]> wrote: > Is there some standard practice on a machine that has production code > running in mod_python but also has developers running their django- > python web server? Is that discouraged? Yes absolutely discouraged. The standard practi

Re: Random objects in view

2007-10-04 Thread RajeshD
Hi Alessandro, Replace: items.filter(provincia__iexact=provincia) with items = items.filter(provincia__iexact=provincia) Similarly, replace items.filter(tipo__iexact=tipo) with items = items.filter(tipo__iexact=tipo) Remember that whenever you filter an existing queryset in order to progressiv

Re: Signals error - I can't do a import

2007-10-11 Thread RajeshD
Perhaps try the import this way: // sig.py def thesignal(sender, instance, signal, *args, **kwargs): from mysite.plush.models import Photo assert False, "It got here" // --~--~-~--~~~---~--~~ You received this message bec

Re: Accessing many-to-many relations in save()

2007-10-12 Thread RajeshD
On Oct 11, 6:54 pm, Adam Endicott <[EMAIL PROTECTED]> wrote: > I've got an app where I'd like to set some properties in an object's > save method based on ManyToMany relationships. Can you describe generally what you are trying to update in the parent object when its ManyToMany relationships ar

Re: Accessing many-to-many relations in save()

2007-10-12 Thread RajeshD
On Oct 12, 1:04 pm, Adam Endicott <[EMAIL PROTECTED]> wrote: > > How about something along these lines (a lazy initialization pattern): > > Well, the point of saving that boolean was so I could do database > queries on it (MyModel.objects.filter(has_m2m_thing=True)). That > wouldn't really work

Re: Possible ifequal and/or ifnotequal bug

2007-10-12 Thread RajeshD
> > The above code is NOT catching the first instance of an NAICS > description which begins with "A". The filter on the first parameter there won't work (as you've already discovered.) 1. If you are using Django SVN trunk, try assigning that filtered value first to a variable using the 'with' t

Re: Accessing many-to-many relations in save()

2007-10-12 Thread RajeshD
> Sure. I'm trying to set a boolean property on the object based on the > existence (or absence) of a ManyToMany relationship. So I originally > thought something like: > > def save(self): > self.has_m2m_thing = bool(self.m2m_relation.count()) > super(MyModel, self).save() > > This works f

Re: newforms problems

2007-10-15 Thread RajeshD
> 1) pass_matched always return False > how can i compare two fields in my class??? def pass_matched(self): if self.fields['pass'] == self.fields['repass']: return True else: return False 1. use self.cleaned_data instead of self.fields 2. call pass_matche

Re: select choices

2007-10-15 Thread RajeshD
> Does anybody know a more easy way? Any particular reason you have to have type as an IntegerField? If you had it as a CharField, you could do: TYPE = (('foo', 'foo'), ('BAR', 'BAR')) type = models.CharField(choices=TYPE) Foo.objects.filter(type='BAR') And, possibly add db_index=True to the ty

Re: Multiple app environments on the same machine - settings & more

2007-10-15 Thread RajeshD
> The idea is I would like to set up a production (prod) and pre- > production (preprod) and have preprod updated and unit tests run > everytime I commit changes to the SVN repo from my local machine (this > can be easily done with svn-hooks). > > No problems so far, however what worries me is ho

Re: select choices

2007-10-15 Thread RajeshD
> > Arn't stings slower against integers? You can always set db_index=True on the type field if you'll be using it a lot in your lookups and if the number of records in that table is going to be huge. http://www.djangoproject.com/documentation/model-api/#db-index --~--~-~--~~--

Re: Fastcgi always gives 301

2007-10-15 Thread RajeshD
On Oct 15, 10:23 am, maqr <[EMAIL PROTECTED]> wrote: > Does anyone have any suggestions as to why this 301 MOVED PERMANENTLY > is the only response I can get out of my FCGI script? Did you follow the official FCGI docs over here? http://www.djangoproject.com/documentation/fastcgi/ --~--~-

Re: problem in uploading image

2007-10-16 Thread RajeshD
> > if form.is_valid(): > clean_data = form.clean_data > t = Image If Image is a model class, the above should read: t = Image() > > but it is showing an error saying 'module' object has no > attribute 'save_photo_file' --~--~-~--~~

Re: newform: Why Doesn't This work

2007-10-17 Thread RajeshD
class myForm(forms.Form): def __init__(self, *args, **kwargs): try: self.q_prime = kwargs.pop('q') except: pass super(myForm, self).__init__(*args, **kwargs) choice = forms.ChoiceField(label="My choice", choices=myCho

Re: newform: Why Doesn't This work

2007-10-17 Thread RajeshD
Aaargh...the indentation got screwed up. Here's another attempt: class myForm(forms.Form): def __init__(self, *args, **kwargs): self.q_prime = [] # default choices here? try: self.q_prime = kwargs.pop('q') except: pass super(myForm, self

Re: Custom Managers and Model Methods

2007-10-17 Thread RajeshD
Hi Jason, > Using the models below I'd like to be able to create Querysets such as: > > a = Treatment.objects.filter(total_dose__range=(4000,1)) > b = a.filter(tumor__patient__gender = 'M') > > Both of the above work, but then I'd like to have an additional filter: > c = b.filter(tumor__patie

Re: bypassing reverse relation (related_name)

2007-10-17 Thread RajeshD
> > Is there a way to express that I don't need the reverse relation? No. Even if you don't need them, Django will want to dynamically endow your Location objects with them. And, as you know, it can't do it if two reverse relations have the same name. --~--~-~--~~~--

Re: using newforms, an uncommon case.

2007-10-30 Thread RajeshD
Here's a different approach: You could serialize an incomplete form instance to another table (could just be serialized to the user's session too.) Then, when the user requests to continue filling out an incomplete form, just deserialize the form instance and you have the form exactly as the user

Re: Django newbie, URL resloving problem

2007-11-01 Thread RajeshD
On Nov 1, 7:26 am, gizmo <[EMAIL PROTECTED]> wrote: > Hello, > I started learning about Django and I followed an example > athttp://www.djangobook.com/en/beta/chapter03/ > > I've done: > from django.conf.urls.defaults import * > from gizmo_site.datetime import current_datetime This suggests th

Re: template question

2007-11-02 Thread RajeshD
On Nov 1, 9:56 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have this code in my view, for example: > > a=['a','b','c'] # a list of row labels > b=[1,2,3] # a list of col label > c=tab # an array (list of list) with len(a) rows and len(b) cols. If c[i, j] previously had a value of x,

Re: Standard place for signal processing code?

2007-11-02 Thread RajeshD
> I'm looking for a hint as to where put signal processing code. Various > objects in many apps in my project emit one signal, that has to be > processed in single place and is not directly related to any particular > app nor object. I do not want it in any app, since apps can be turned on > and o

Re: Displaying error messages if form data not valid

2007-11-02 Thread RajeshD
On Nov 2, 12:08 pm, jim <[EMAIL PROTECTED]> wrote: > OK. This approach works. Thanks. > > Would you have any link to a best practice where such a approach is > detailed? The very first simple view example in the New forms documentation shows what Malcolm recommended to you. http://www.djangopr

Re: Limiting Foreign Key choices to members of a certain group using generic views

2007-11-02 Thread RajeshD
> > I'm after a way of limiting what choices are populated into a drop-down > box from a foreign key field when I'm using the generic create/update views: I would recommend not using the generic create/update views as those views use old forms and manipulators which are going away in favor of "n

Re: Limiting Foreign Key choices to members of a certain group using generic views

2007-11-02 Thread RajeshD
On Nov 2, 4:02 pm, rm <[EMAIL PROTECTED]> wrote: > On Nov 2, 3:54 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > > When you acquire a Customer newform instance in your view, you will be > > able to modify the choices attribute of its domain field so that these > &g

Re: Limiting Foreign Key choices to members of a certain group using generic views

2007-11-02 Thread RajeshD
> > # run with this form following the examples in the newforms > documentations. You can also change the domain "choices" after the form class is created for you by modifying the form class's base_fields as I see you have done in your post in another thread here: http://groups.google.com/group/

Re: Is there a simpler solution?

2007-11-02 Thread RajeshD
On Nov 2, 4:05 pm, "Ramdas S" <[EMAIL PROTECTED]> wrote: > Hi, > > I am sure there is something absolutely simple, but I guess I am missing it. > I need to display some content/ news articles over 3 columns on a home page, > where the order is latest stories coming in top rows from left to right

Re: Is there a simpler solution?

2007-11-02 Thread RajeshD
Disregard the overflow:hidden piece in my CSS above. It's not needed: .article {width:32%;float:left;} .clear_all {clear:both;} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: i18n and choices from database

2007-11-03 Thread RajeshD
> Question is how to show query from database on template with localized > output Try this in your template (assuming p is a person model instance available to your template): {{ p.get_gender_display }} See: http://www.djangoproject.com/documentation/db-api/#get-foo-display Also, another sugge

Re: encoding problem in instance signal / dispatcher?

2007-11-03 Thread RajeshD
Take a look at your Tag model's __unicode__ method (or paste your Tag model here). I suspect that's where the problem is. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Newforms validation error not displayed:

2007-11-03 Thread RajeshD
> > def clean_guess_the_number(self): > if self.max_number > self.cleaned_data['guess_the_number']: Change that to: if self.max_number < self.cleaned_data['guess_the_number']: > raise forms.ValidationError('Your Number have to be lower > or equal to Max Number.') >

Re: permissions on media files

2007-11-03 Thread RajeshD
> So is my only solution to read and serve the file > using django ? Or is there a mod_python extension that can do this > more efficiently ? Perhaps Amazon S3 would serve your needs? http://www.amazon.com/gp/browse.html?node=16427261 --~--~-~--~~~---~--~~ You r

Re: form_for_instance and form argument, empty form?

2007-11-07 Thread RajeshD
> > > Paste here your FooForm and Foo model code that doesn't work for you. > > class Foo(models.Model): > title = models.CharField(_("Title"), core=True, maxlength=100) > > class FooForm(forms.Form): > title = forms.CharField(label = _("Title")) Now, I am more confused about your actual

Re: Does anyone know a good method for creating one time pages with Django?

2007-11-07 Thread RajeshD
On Nov 7, 10:11 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thanks, flat pages look really useful. > > Unfortunately I don't think they solve my problem here - the rest of > the page needs to be dynamic and driven by custom content; it's only a > subset of the page elements that I want

Re: form_for_instance and form argument, empty form?

2007-11-07 Thread RajeshD
On Nov 7, 9:42 am, David Larlet <[EMAIL PROTECTED]> wrote: > I thought that it was more appropriated to post it on the devlist > because it sounds like a bug but ok let's move it on the userlist, sorry > for the noise here. I'll be glad to hear your solution. Paste here your FooForm and Foo mod

  1   2   3   >