Re: Working with outside data sources

2010-02-18 Thread Rishabh Manocha
hat you can have access to it via Python. Also, have you taken a look at the inspectdb management command - it might go a long way in helping you get your models.py files setup - see http://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb > > Michael lissnermliss...@michaeljaylissner.c

Re: Working with outside data sources

2010-02-18 Thread Rishabh Manocha
On Fri, Feb 19, 2010 at 10:04 AM, mjlissner wrote: > I'm using django for a final project in my masters program at UC > Berkeley, and I'm trying to sort out exactly how the database works. I > would spend a bunch of time figuring this out myself, but I am working > in a

Re: django-debug-toolbar and 404's

2010-02-12 Thread Rishabh Manocha
gt; seem something in the toolbar is causing the problem. > > And you are right... those settings you refer to are optional. > > Thanks, > Rob > > On Feb 11, 10:57 pm, Rishabh Manocha <rmano...@gmail.com> wrote: > > Mike, > > > > Thanks for replying. Re

Re: django-debug-toolbar and 404's

2010-02-11 Thread Rishabh Manocha
toolbar.panels.logger.LoggingPanel', >) > >MIDDLEWARE_CLASSES += ( >'debug_toolbar.middleware.DebugToolbarMiddleware', >) > >INSTALLED_APPS += ( >'debug_toolbar', >) > > Mike > > > On 11/02/2010 2:07pm, Rishabh Manocha wrote: > >> Hey Guys, >> &

django-debug-toolbar and 404's

2010-02-10 Thread Rishabh Manocha
Hey Guys, I know I must be doing something stupid here, but for the life of me, I can't seem to be able to get django-debug-toolbar to work - I keep getting a 404 error whenever I visit http://localhost:8000/admin/ (see [1]). I've followed the Installation instructions at

Re: ModelAdmin.get_readonly_fields with ForeignKey's

2010-02-06 Thread Rishabh Manocha
On Sat, Feb 6, 2010 at 10:35 PM, Karen Tracey <kmtra...@gmail.com> wrote: > On Sat, Feb 6, 2010 at 6:16 AM, Rishabh Manocha <rmano...@gmail.com>wrote: > >> [snip] >> While this works just fine, the one problem I'm having is that instead of >> showing the ti

ModelAdmin.get_readonly_fields with ForeignKey's

2010-02-06 Thread Rishabh Manocha
Hi Guys, I was trying to use the newly introduced ModelAdmin.get_readonly_fields method to mark a OneToOne relation as read only - something along the lines of: models.py: class Book(models.Model): title = models.CharField(max_length = 50) ... def __unicode__(self): return

Re: Default Selection in ChoiceField

2010-02-01 Thread Rishabh Manocha
On Tue, Feb 2, 2010 at 8:56 AM, Sumanth wrote: > Hi all, > > I  have a basic form > > class AssumptionsForm(forms.Form): >       writedownoper  = forms.ChoiceField( required=True, choices = > [('1','1'),('2',2='),('3','3')]) > > Now in my view after I create the form I want

'Reverse' (??) InlineModelAdmin objects

2010-01-29 Thread Rishabh Manocha
Hey guys, I've been trying to get InlineModelAdmin objects setup in my admin app, but am unable to figure out how to do so correctly. Using the same example as the one listed in the docs [1]: class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model):

Re: newbie question on 'clean_' functions

2009-12-09 Thread Rishabh Manocha
On Thu, Dec 10, 2009 at 12:12 PM, Rishabh Manocha <rmano...@gmail.com> wrote: > On Thu, Dec 10, 2009 at 11:21 AM, Kenneth McDonald > <kenneth.m.mcdon...@sbcglobal.net> wrote: >> >>> And the code to create and validate the form is...?  That might help >>>

Re: newbie question on 'clean_' functions

2009-12-09 Thread Rishabh Manocha
On Thu, Dec 10, 2009 at 11:21 AM, Kenneth McDonald wrote: > >> And the code to create and validate the form is...?  That might help >> in figuring out what is wrong. >> > Sure. It's just: > > > > def buysell(request): >     form = BuySellForm() >     return

Re: Using a form to UPDATE a record?

2009-12-03 Thread Rishabh Manocha
On Thu, Dec 3, 2009 at 4:17 PM, Todd Blanchard wrote: > All the tutorials on forms discuss creating a new record. > > I've got a record in the database, I want to fetch it, plunk its values into > a form, let the user edit it and save it. > > I don't see how to conveniently

Re: How to lookup tables which has ForeignKey relationship

2009-11-17 Thread Rishabh Manocha
On Tue, Nov 17, 2009 at 7:40 PM, guptha wrote: > hi group, > > class Parent(models.Model): >user = models.ForeignKey(User,unique=True) >school=models.ForeignKey(School) >def __unicode__(self): > return self.user.username > > class Student(models.Model): >

Re: need foreign key help quick

2009-11-08 Thread Rishabh Manocha
On Sun, Nov 8, 2009 at 9:41 PM, Bobby Roberts wrote: > > anyone out there that can help me? > > On Nov 7, 8:39 pm, Bobby Roberts wrote: > > Hi. I have never used foreign keys I need to start and I need > > help. I'm running python2.5 and

Re: Display a value from another table

2009-11-01 Thread Rishabh Manocha
On Mon, Nov 2, 2009 at 1:43 PM, Denis Bahati wrote: > Hi All, > Am developing an application where by it links two tables author and book, > the id of author is a foreign key to book table. How can i display the name > of the author when am displaying the book list. > > > >

Re: syncdb for INSTALLED_APPS throws errors

2009-10-29 Thread Rishabh Manocha
On Thu, Oct 29, 2009 at 2:47 PM, sridharpandu wrote: > > Hi, > > I ran the syncdb command to create the tables for INSTALLED_APPS. I > get the errors as shown in the output below. Can someone tell me > what's wrong. I am using a laptop that runs Django as well as the >

Re: Django cookies

2009-10-25 Thread Rishabh Manocha
On Mon, Oct 26, 2009 at 9:37 AM, Jeffrey Taggarty wrote: > > Hello, > > I have a web site which shows different content based on a location > the visitor chooses. e.g: User enters in 55812 as the zip. I know what > city and area lat/long. that is and give them their content

Re: extending django-registration ( MixIn ModelForm and Form)

2009-06-01 Thread Rishabh Manocha
On Tue, Jun 2, 2009 at 9:10 AM, Marco Bazzani wrote: > > On Mon, Jun 1, 2009 at 23:19, V wrote: > > > > On Jun 1, 6:50 pm, Marco Bazzani wrote: > >> I'm trying to extends django-registration app with some more fields

Re: Ajax and https

2009-04-30 Thread Rishabh Manocha
On Thu, Apr 30, 2009 at 4:10 PM, ruben.django wrote: > > Hi, > > i've got a template with a jquey ajax call. Before, the web service > (Apache) always redirects to a http direction and the ajax call worked > perfectly, but from now, it redirects to a secure https direction

Re: Design Question

2009-02-05 Thread Rishabh Manocha
On Fri, Feb 6, 2009 at 5:48 AM, mguthrie wrote: > > Anybody? > > On Feb 3, 9:41 am, mguthrie wrote: > > I'm looking at creating an application that would use Django Auth for > > managing users but once logged in the user will "belong" only to a >

Re: Admin in Django

2008-11-25 Thread Rishabh Manocha
On Wed, Nov 26, 2008 at 10:00 AM, Praveen <[EMAIL PROTECTED]>wrote: > > Hi All, i am very new bie of Django, i have started work on before 3 > days. > I am following DJango book. I am playing with 6 chapter "Using the > admin interface" > In my urls.py file i set the url for admin > > from

Re: How to show only 2 decimal places in my view?

2008-11-25 Thread Rishabh Manocha
On Wed, Nov 26, 2008 at 9:59 AM, Greg <[EMAIL PROTECTED]> wrote: > > Hello, > I have the following code: > > /// > > b = Choice.objects.filter(choice=a.collection.id) >for cb in b: >discount_price = cb.price.name * Decimal(str(.75)) >cb.price.name = discount_price >

Re: Django-Registration and NewForms Error

2008-10-08 Thread Rishabh Manocha
On Wed, Oct 8, 2008 at 5:07 PM, Chris <[EMAIL PROTECTED]> wrote: > > I installed django-registration via easy_install, and followed the > directions for setting it up in my app, but when I go to /register, I > get the error: > > File "/usr/lib/python2.5/site-packages/django_registration-0.5- >

Re: dictionary from object

2008-08-26 Thread Rishabh Manocha
On Wed, Aug 27, 2008 at 10:55 AM, Vance Dubberly <[EMAIL PROTECTED]>wrote: > > So I want to do something I'd think would be extremely common and simple. > > user = User.objects.get(pk=data['id']) > > I want a dictionary of the model attributes/values from user. > > user_dict = { 'first_name' :

Re: forms.ChoiceField()

2008-07-25 Thread Rishabh Manocha
In your form field definition, set empty_labal = None This was somewhere in the docs, but am unable to find it in the 2 mins I spent on the search. Best, R On Fri, Jul 25, 2008 at 10:14 AM, JF Simon <[EMAIL PROTECTED]> wrote: > > hi ! > > How to remove the first --- in a from a >

Re: forms.ChoiceField()

2008-07-25 Thread Rishabh Manocha
That's "empty_label = None". Sorry for the typo Best, R On Fri, Jul 25, 2008 at 3:07 PM, Rishabh Manocha <[EMAIL PROTECTED]> wrote: > In your form field definition, set empty_labal = None > > This was somewhere in the docs, but am unable to find it in the 2 min

Re: i18n: How to the language on per-user basis

2008-07-18 Thread Rishabh Manocha
You could use "user profiles" which will allow you to store various user specific preferences. See [1] to learn how to do this. I am currently using profiles to identify users by the department they work in and the last time they edited a form (this is different from last login). Best, R [1] -

Re: Add filters to the Users List/Page in the admin app

2008-06-25 Thread Rishabh Manocha
Anybody got any ideas here?? I could really use some help with this problem. Thanks, Rishabh On Tue, Jun 24, 2008 at 9:49 AM, Rishabh Manocha <[EMAIL PROTECTED]> wrote: > Ok, so I need a bit more direction here. I've got newforms-admin setup and > working as far as displaying th

Re: dynamic value of a ModelChoiceField

2008-06-23 Thread Rishabh Manocha
You're probably looking for http://www.djangoproject.com/documentation/newforms/#initial Best, Rishabh On Tue, Jun 24, 2008 at 9:04 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I probably need to be more specific.. > > here's my model: > > class Recipe(modesl.Model): > > recipetitle

Re: Add filters to the Users List/Page in the admin app

2008-06-23 Thread Rishabh Manocha
Ok, so I need a bit more direction here. I've got newforms-admin setup and working as far as displaying the various FK relationships a user has on his/her page. However, I'm still not able to figure out how to display FK relationships in the list_filter page. Here is my setup (the UserTechSkill

Re: dynamically filling ChoiceField

2008-06-22 Thread Rishabh Manocha
Some more details would be good, but off the top of my head, something like this might work: def my_view(request): form = MyForm() form.fields['mychoice'].choices = ((1,'ABC'),(2,'XYZ')) I havent' been able to test this out, so make sure you do before you using it. You can of-course do

Re: Model - Only allow One

2008-06-16 Thread Rishabh Manocha
Why not just override the save method for the model and delete any instances of it before calling super.save(). I'm not a 100% sure on this, but I do think the admin interface calls the model save method whenever you edit something from there. So, something like this: class About(models.Model):

Re: Add filters to the Users List/Page in the admin app

2008-06-13 Thread Rishabh Manocha
This is what I was thinking, but I thought there was a glimmer of hope of achieving this without moving over to newforms-admin. Is there absolutely no way to do this using trunk?? I'll give newforms-admin a shot on my dev box over the weekend and see what comes out of it. I will research this

Re: Custom validationrules for newforms?

2008-06-11 Thread Rishabh Manocha
http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validationis probably what you're looking for. Best, Rishabh On Wed, Jun 11, 2008 at 3:20 PM, mwebs <[EMAIL PROTECTED]> wrote: > > I want to add a custom validation rule for a newforms form. > I could not figure out how

Add filters to the Users List/Page in the admin app

2008-06-11 Thread Rishabh Manocha
Hey all, I'm using django's in-built authentication mechanism for my app. Several of my models are of the form: class UserTechSkill(models.Model): user = models.ForeignKey(User,edit_inline = models.TABULAR) skill = models.ForeignKey(TechSkillsList,core=True) prof_level =

Re: use my own widgets when creating a form out of a model

2008-06-04 Thread Rishabh Manocha
What you want to do is perfectly doable. If (for example) you want the street field to show up as a textarea with 40 columns in your form, you would put something like this in your forms.py: class PersonForm(ModelForm): street = forms.CharField(widget = forms.TextArea(attrs = {"cols":40}))

Re: Apache (and dev server) throws "connection reset" when accessing pages via IE 6

2008-05-23 Thread Rishabh Manocha
seems like that could be an issue if my app ever goes large. Thanks for your help, R On Wed, May 21, 2008 at 5:42 AM, Graham Dumpleton < [EMAIL PROTECTED]> wrote: > > > > On May 20, 10:53 pm, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote: > > Hey Guys, > &g

Re: Really, realy strange MySQLdb problem, cycling through error messages.

2008-05-20 Thread Rishabh Manocha
There was a permission denied error 'cause if your webserver was running under some user other than root (as it should be), it won't be able to write to the root's home directory (as it shouldn't). Assuming you are using Apache with mod_python, here is something you could put in your httpd.conf:

Apache (and dev server) throws "connection reset" when accessing pages via IE 6

2008-05-20 Thread Rishabh Manocha
Hey Guys, I have just deployed my code to my test server (from my laptop) and setup apache/mod_python to serve the pages. Everything works just fine when I work with Firefox, but whenever I access my pages using IE 6, I keep getting the following errors in the apache error logs: [Tue May 20

Re: Adding database table to Selection Widget on newforms

2008-05-19 Thread Rishabh Manocha
Since the list of countries is coming from a model, why not use ModelChoiceField [1]. So, your field will look something like: Country = forms.ModelChoiceField(required=True,widget=forms.Select(attrs = attrs_dict), queryset = Country.objects.all()) Best, R On Mon, May 19, 2008 at 10:02 AM,

Re: get for errors as string and not as HTML

2008-04-30 Thread Rishabh Manocha
Did you take a look at http://www.djangoproject.com/documentation/newforms/#customizing-the-error-list-format ?? You could just return the error message without wrapping it in any div/span/ul etc. R On Tue, 2008-04-29 at 22:23 -0700, Mike Chambers wrote: > Thanks. > > This was the only way I

Re: Confused on a foriegnkey error

2008-04-26 Thread Rishabh Manocha
008 at 12:06 PM, Rishabh Manocha <[EMAIL PROTECTED]> > wrote: > > > > > > Thanks for writing back, Karen. I guess the snippets of code I > > inserted were a little misleading. I have many other modelforms too, > > which all have a user = ForeignKey(User)

Re: sys.path on freebsd 6.2 HALP!

2008-04-24 Thread Rishabh Manocha
I'm having similar issues gettind mod_python to work with Apache on a windows box. I don't have my httpd.conf in front of me atm, but i'm basically seeing what zoggernaut is seeing :( Best, R On 25-Apr-08, at 8:14 AM, zoggernaut wrote: > > FYI, I followed the instructions on the tutorial

Re: How to use ImageField to save images to dynamic path

2008-04-22 Thread Rishabh Manocha
> form.save() > else: > form = ThingForm() > > return render_to_response('iuv.html', {'form': form}) > > > > On Apr 21, 3:19 pm, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote: > > I don't know if this answers your

Re: DateField widget, ModelForm and javascript

2008-04-21 Thread Rishabh Manocha
AFAIK that JS date picker is only available in the admin interface. rendering a form as {{ my_form}} does not print that date picker either. I'd be interested in knowing how to get it to show up too (what JS/CSS files need to be added, whether there is some setting we can use in the python code

Re: Widgets with an error class

2008-04-21 Thread Rishabh Manocha
http://www.djangoproject.com/documentation/newforms/#customizing-the-error-list-format documentation ftw :) On Mon, Apr 21, 2008 at 5:15 AM, J. Pablo Fernández <[EMAIL PROTECTED]> wrote: > > No ideas on this? > > > > On Apr 6, 2:38 am, J. Pablo Fernández <[EMAIL PROTECTED]> wrote: > > Hello,

Re: Confused on a foriegnkey error

2008-04-21 Thread Rishabh Manocha
set the queryset for each list on submission. Hope that clears up my problem a little bit more. Best, R On Mon, Apr 21, 2008 at 6:38 PM, Karen Tracey <[EMAIL PROTECTED]> wrote: > > On Mon, Apr 21, 2008 at 2:53 AM, Rishabh Manocha <[EMAIL PROTECTED]> wrote: > > > >

Re: How to use ImageField to save images to dynamic path

2008-04-21 Thread Rishabh Manocha
I don't know if this answers your specific question, but this is being worked on, apparently - http://code.djangoproject.com/ticket/5361. I had a similar requirement, where I wanted to dynamically append a model field to the filename before saving it. I ended up getting the model field's value

Confused on a foriegnkey error

2008-04-21 Thread Rishabh Manocha
Hey Guys, I have 4 models working something like this: class User(models.Model): name = models.CharField() email = models.EmailField() ... class A(models.Model): domainname = models.CharField() class B(models.Model): domain = models.ForigenKey(A) name = models.CharField()

Re: Is there a better way to strip CharFields?

2008-04-18 Thread Rishabh Manocha
You could just write a clean_mycharfield() (assuming mycharfield is your field name) and just return self.cleaned_data['mycharfield'].strip(). Check http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation for more details. On Sat, Apr 19, 2008 at 2:37 AM, Peter

Re: Images

2008-04-16 Thread Rishabh Manocha
Did you take a look at http://www.djangoproject.com/documentation/static_files/#how-to-do-it. If you are using the dev server, this is the way to do it. Hence, you should not be using anything like (http://127.0.0.1:8000/detail/...) in your view. R On Wed, Apr 16, 2008 at 4:37 AM, [EMAIL

Re: ModelMultipleChoiceField updating HTML choices after 2nd reload

2008-04-11 Thread Rishabh Manocha
ngo code. As you said in > > your post, I've never seen it documented anywhere. I came across it > > after I found it in a few bug reports because apparently, there were > > similar issues. I posted that ticket in my first post. > > > > When you use this, are you ha

Re: ModelMultipleChoiceField updating HTML choices after 2nd reload

2008-04-10 Thread Rishabh Manocha
I would like to get an answer for this too. Just reading through Justin's code, I have figured out the solution to a problem I was stuck on for a few days (I am new to Django so reading and learning about the _set_queryset function was a godsend). Also, I was wondering if someone can point me in

Re: newforms with the polls/choice example

2008-04-08 Thread Rishabh Manocha
Does anyone have any ideas here?? If the question is unclear, I'd be happy to clarify myself. Thanks, Rishabh On Fri, Apr 4, 2008 at 4:50 PM, Rishabh Manocha <[EMAIL PROTECTED]> wrote: > Hey Guys, > > I was trying to rewrite parts of the Poll app example described in the

Re: some help with urls

2008-03-31 Thread Rishabh Manocha
PM, Ronny Haryanto <[EMAIL PROTECTED]> wrote: > > Try: > > r'^test/fullpath/(?P[\w/]+) > > Ronny > > > > On Mon, Mar 31, 2008 at 4:08 PM, Rishabh Manocha <[EMAIL PROTECTED]> wrote: > > > > Hey guys, > > > > I'm trying to

Re: How are you storing binary data in db

2008-03-27 Thread Rishabh Manocha
I think he meant recipes in that are there any recipes to accomplish this (storing binary data to the DB). Unless I'm getting this completely wrong, he was not talking about cooking recipes :). I would be interested in a solution for this too. There are cases where apps running as the apache/web

Where do I put the code to fetch data not coming from a DB

2008-03-27 Thread Rishabh Manocha
Hey guys, I'm starting work on a project and for now, won't be using a db with it. Instead, I'll be using a library which fetches all the data I need from a local SVN store. I was wondering where should I access this library from - the model (models.py) or the view (views.py)?? I don't know if