Re: New to DJANGO

2012-06-21 Thread LJ
I started out learning Django using the "Writing your first Django app" article: https://docs.djangoproject.com/en/dev/intro/tutorial01/ This is a very well-written tutorial that goes through each part in detail. Please note, at the bottom of each section there is a link to the next section. The

What happens underneath when I save to a model with ManyToMany relationships?

2012-06-21 Thread LJ
I have a Python script that will be called daily from a scheduled service or daemon. The script uses MySQLdb to read a csv file and import data into a MySQL database that is used in my Django application. Some of the models contain ManyToMany relationships. I am directly inserting the relations

Saving ManyToMany models

2012-06-21 Thread LJ
name='T', last_name='Duck') newParent.save() newStudent.parents.add(newParent) However, when I call save_m2m(), it throws an error: newStudent.save_m2m() Perhaps I do not need to call save_m2m(). Does the relationship get saved to the database when I c

How to get the Exception Type

2012-05-14 Thread LJ
I am trying to add exception handling to my application. I have been reading the documentation on Django Exceptions: https://docs.djangoproject.com/en/dev/ref/exceptions/ I also found the list of Exceptions (both Django and Python). But for testing purposes, I need a way to handle all exceptions an

Trouble with query syntax in Django view

2012-04-30 Thread LJ
I have a Student model that stores information about a student, including the student's teacher. The teacher's information is stored in the Employee model that inherits from the Person Model. I am having trouble figuring out how to query the teacher, when a student id is passed as an ajax argument

URL resolution in a Django template

2012-04-28 Thread LJ
I am using ajax to update a list of participants in my html page, based on the student id selected. I am trying to figure out how Django knows what path to look to find my method. Does it just go through all of the urls.py files until it finds a method that matches the url request? $('#id_s

Re: Returning template data from a ManyToMany model

2012-04-18 Thread LJ
Thank you, Daniel. That makes sense now. If the full objects are already there, then this should work great! L J On Apr 17, 4:07 am, Daniel Roseman wrote: > On Tuesday, 17 April 2012 07:10:35 UTC+1, LJ wrote: > > > I am having trouble figuring out how to query the database and re

Re: Returning template data from a ManyToMany model

2012-04-18 Thread LJ
Thank you, Phang. I was not familiar with the locals() method, so I may look into this. L J On Apr 17, 2:22 am, Phang Mulianto wrote: > On Tue, Apr 17, 2012 at 2:10 PM, LJ wrote: > > I am having trouble figuring out how to query the database and return > > the results in a

Returning template data from a ManyToMany model

2012-04-16 Thread LJ
I am having trouble figuring out how to query the database and return the results in a format that my template can render appropriately. I have a model that has a ManyToMany field: class Student() ... parents = models.ManyToManyField('parents.Parent', blank=True, null=True) ... The

Re: Script to call loaddata on multiple fixtures

2012-02-18 Thread LJ
wrote: > On Sat, 18 Feb 2012 08:46:25 -0800 (PST), LJ > wrote: > > >I would like to create a script to call all of these, so I can insert > >them all at once. > >I do not want to combine all of the json files. > >         Are they order dependent? That is, do a

Re: Script to call loaddata on multiple fixtures

2012-02-18 Thread LJ
That worked great. I haven't done much shell scripting, but it was easier than I thought. Thanks, Shawn! L J On Feb 18, 9:46 am, LJ wrote: > I have quite a number of fixtures that I call loaddata to insert > fixtures into my sqlite database using the following syntax: > > p

Script to call loaddata on multiple fixtures

2012-02-18 Thread LJ
I have quite a number of fixtures that I call loaddata to insert fixtures into my sqlite database using the following syntax: python ./manage.py loaddata ./apps/addresses/fixtures/cities.json python ./manage.py loaddata ./apps/addresses/fixtures/addresses.json ... I would like to create a script

Re: Rendering only a portion of the page

2011-04-02 Thread LJ
Thank you, Jorge! Yes, that helps a lot! On Apr 2, 5:18 am, Jorge Bastida wrote: > Hi Lj, > > > I am building a django web app that has a control panel with various > > icons.  Right now, the icons have href tags that load a new page when > > the user clicks the icon.  

Rendering only a portion of the page

2011-04-01 Thread LJ
I am building a django web app that has a control panel with various icons. Right now, the icons have href tags that load a new page when the user clicks the icon. I want to change this to instead call a jQuery function that will use ajax, or dajaxice, to render only the content part of the page.

Re: Dajax, what do you think about it?

2011-03-31 Thread LJ
My opinion would be to add it in. But, I am not as experienced with Dajaxice as others may be. I just know it took me a long time to figure out how to manually add it and get it working. It wasn't until I learned how to use virtualenv that I was able to get Dajaxice installed and working correctl

Virtualenv and Dajaxice up...Now looking for Django Twitter Birds

2011-03-30 Thread LJ
I can't tell you how helpful this User Group has been to me! With the help of several helpful responses and a lot of great articles out there, I was finally able to install virtualenv and virtualenvwrapper and get dajaxice working. I wrote all about it on my blog, if there are any newbies wanting s

Re: How to reinstall Python Interpreters?

2011-02-22 Thread LJ
r way than from the sources. > > On Feb 18, 5:04 pm, LJ wrote: > > > Just adding a note for anyone else struggling with a similar > > 'unresolved import' problem... > > This article explains in details how to modify the PYTHONPATH if you > > decide to go tha

Re: How to reinstall Python Interpreters?

2011-02-18 Thread LJ
s method, but I now understand how django is able to find imported libraries. I am still looking for a good article on how to install/configure a 3rd party app in site packages--or dist-packages on Ubuntu (Python 2.6). On Feb 18, 12:39 pm, LJ wrote: > I am on Ubuntu 10, using Python 2.6 and Dj

Re: How to reinstall Python Interpreters?

2011-02-18 Thread LJ
errors are: Unresolved import: dajaxice_autodiscover Unresolved import: dajaxice_functions On Feb 18, 7:17 am, CrabbyPete wrote: > I wouldn't reinstall python because of an unresolved import error. > What's unresolved and what type of system are you on PC/Linux? > > On Feb

How to reinstall Python Interpreters?

2011-02-17 Thread LJ
I installed the latest version of dajaxice, but I am still getting Unresolved import errors. My guess is that I need to remove and reinstall the Python Interpreters. Is there a some documentation somewhere that explains how to reinstall the Python Interpreters, so I can resolve all of my Unresolved

Dajaxice Unresolved Import

2011-02-15 Thread LJ
I followed the installation instructions on the dajaxice project website (http://docs.dajaxproject.com/dajaxice/installation.html). Some parts of the simple example project work great, but some parts do not work. I am getting the error: Unresolved import: dajaxice_autodiscover This is on the line