Newbie question on re-defining an XML schema in my Django data model...

2011-11-29 Thread Marc Edwards
I need some help in resetting my thinking on creating my Django data
model.

I have previously created an XML schema definition for my data model,
but am now trying to re-create this XML data model in a Django data
model.

In my XML schema, I had defined "collections" of XML complex types
that essentially were lists that I could XQuery.  I used the ID &
IDREF tags to cross-reference my elements between lists of elements.
As XML is a tree structure, my schema defined a top down tree
hierarchy.  Now I want to redefine this in a Django data model.

In my primary scenario, I had a list of "singular" workflows that
constituted a "parent" element "catalog" of workflows, i.e. a workflow
catalog. Multiple "singular" workflows can be combined into an ORDERED
collection of workflows called a "reference" or "composite" workflow.
There are many composite/reference workflow instances with varied
ordered combinations of singular workflows.

In my XML hierarchy, I used the IDREF tags to reference the "singular"
workflows from within the "reference" workflow element instance.

In my Django object model, I can define a class for a "singular"
workflow...easy enough, and I can query the Django database model to
select the "singular" workflows.

But, what is the correct method of now creating the "composite"
workflow that will reference the singular workflows?

My pseudo-code for the composite workflow class looks like this...

class SingularWorkFlow(models.Model):
   pass

class CompositeWorkflow(models.Model):
   OrderedListOfSingularWorkflows =
list(models.ForeignKey(SingularWorkFlow)

I don't think this will work, but would kindly ask for some guidance.

Regards, Marc

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Retrieve object model admin userid & password?

2011-11-30 Thread Marc Edwards
I am working through some authentication examples.

When I created my first database, I "recall" entering a username and
password, but entering what I recall was the correct input is not
authenticating.

Is there an easy way to reset or retrieve the username and password
that was used to create the object model?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Conditional choice fields for model specification...

2011-12-05 Thread Marc Edwards
I would like to create my choice fields in my models according to a
hierarchy of conditions, but I can't think of how to specify this in
Python.

For example...pseudo code...

class mod1(models.Model):

choice1 = (
  ('a', 'A'),
  ('b', 'B'),
)

choice_a_if_choice1_is_A = (
   ('z', 'Z'),
   ('y', 'Y'),
)

choice_a_if_choice1_is_B = (
('m', 'M')
('n', 'N')
)

field1 = models.CharField(max_length=30, choices=choice1)

field2 = models.CharField(max_length=30,
choices=choice_a_if_choice_is_A)
field2 = models.CharField(max_length=30,
choices=choice_a_if_choice_is_B)

How to I set the choices for field2 depending upon the choice
selected in field1??

)

Kind regards, Marc

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Can't figure out this Object Model error...

2011-12-05 Thread Marc Edwards
I am receiving the following error from the Django debugger when
trying to access my EDA_AppCatalog object.  My class definition is
listed below.  I have similar defined objects that are working with no
problem, but I can't seem to clear this error message up.

Thanks, Marc

DatabaseError at /admin/bookmarks/eda_appcatalog/

no such column: bookmarks_eda_appcatalog.eda_app_id

Request Method: GET
Request URL:http://127.0.0.1:8000/admin/bookmarks/eda_appcatalog/
Django Version: 1.3.1
Exception Type: DatabaseError
Exception Value:

no such column: bookmarks_eda_appcatalog.eda_app_id

Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/
backends/sqlite3/base.py in execute, line 234
Python Executable:  /usr/bin/python2.7
Python Version: 2.7.2
Python Path:

['/home/jmarcedwards/KeplerDevelopment/KeplerEclipseWorkspace_1/
JME_DjangoTest_3/JME_DjangoTest_3',
---
class EDA_AppCatalog(models.Model):

eda_app = models.ForeignKey(EDA_App)






































































-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't figure out this Object Model error...

2011-12-05 Thread Marc Edwards
This is the confusing part.  The EDA_AppCatalog imports from my
bookmarks package with no problem.

My class definition for this object has only 1 field, a ForeignKey to
an EDA_App.

I know that the Object Model will be assigning an "ID" to the object
when it stores it in the database.  I am not assigning this ID field.
I also don't do this with the other object models that I have defined
and that seem to be working with no problem.

Why the admin interface is complaining about this ID field even before
I have even instantiated an initial EDA_App to add to the database is
strange.

I have another object defined that uses 3 ForeignKeys that works fine
in the admin interface.  There seems to be something that is not
defined properly with this particular object definition.

-M

On Dec 5, 7:35 pm, Furbee  wrote:
> Don't mean to sound remedial, but have you verified that the table
> bookmarks_eda_appcatalog exists and that it has a column named eda_app_id?
> Did you use manage.py syncdb to create the tables?
>
> Furbee
>
>
>
>
>
>
>
> On Mon, Dec 5, 2011 at 4:24 PM, Marc Edwards  wrote:
> > I am receiving the following error from the Django debugger when
> > trying to access my EDA_AppCatalog object.  My class definition is
> > listed below.  I have similar defined objects that are working with no
> > problem, but I can't seem to clear this error message up.
>
> > Thanks, Marc
>
> > DatabaseError at /admin/bookmarks/eda_appcatalog/
>
> > no such column: bookmarks_eda_appcatalog.eda_app_id
>
> > Request Method:         GET
> > Request URL:    http://127.0.0.1:8000/admin/bookmarks/eda_appcatalog/
> > Django Version:         1.3.1
> > Exception Type:         DatabaseError
> > Exception Value:
>
> > no such column: bookmarks_eda_appcatalog.eda_app_id
>
> > Exception Location:     /usr/local/lib/python2.7/dist-packages/django/db/
> > backends/sqlite3/base.py in execute, line 234
> > Python Executable:      /usr/bin/python2.7
> > Python Version:         2.7.2
> > Python Path:
>
> > ['/home/jmarcedwards/KeplerDevelopment/KeplerEclipseWorkspace_1/
> > JME_DjangoTest_3/JME_DjangoTest_3',
>
> > --- 
> > 
> > class EDA_AppCatalog(models.Model):
>
> >    eda_app = models.ForeignKey(EDA_App)
>
> > --
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't figure out this Object Model error...

2011-12-05 Thread Marc Edwards
Even when I delete the class definition, re-sync the db, and then re-
define the object, even setting the primary_key=True on a new
CharField, I am still receiving the same error.

Can it be that the database file has become corrupted in some manner
for this object.  I have not modified my SQLite file in any way except
through the admin interface.

On Dec 5, 7:44 pm, Marc Edwards  wrote:
> This is the confusing part.  The EDA_AppCatalog imports from my
> bookmarks package with no problem.
>
> My class definition for this object has only 1 field, a ForeignKey to
> an EDA_App.
>
> I know that the Object Model will be assigning an "ID" to the object
> when it stores it in the database.  I am not assigning this ID field.
> I also don't do this with the other object models that I have defined
> and that seem to be working with no problem.
>
> Why the admin interface is complaining about this ID field even before
> I have even instantiated an initial EDA_App to add to the database is
> strange.
>
> I have another object defined that uses 3 ForeignKeys that works fine
> in the admin interface.  There seems to be something that is not
> defined properly with this particular object definition.
>
> -M
>
> On Dec 5, 7:35 pm, Furbee  wrote:
>
>
>
>
>
>
>
> > Don't mean to sound remedial, but have you verified that the table
> > bookmarks_eda_appcatalog exists and that it has a column named eda_app_id?
> > Did you use manage.py syncdb to create the tables?
>
> > Furbee
>
> > On Mon, Dec 5, 2011 at 4:24 PM, Marc Edwards  wrote:
> > > I am receiving the following error from the Django debugger when
> > > trying to access my EDA_AppCatalog object.  My class definition is
> > > listed below.  I have similar defined objects that are working with no
> > > problem, but I can't seem to clear this error message up.
>
> > > Thanks, Marc
>
> > > DatabaseError at /admin/bookmarks/eda_appcatalog/
>
> > > no such column: bookmarks_eda_appcatalog.eda_app_id
>
> > > Request Method:         GET
> > > Request URL:    http://127.0.0.1:8000/admin/bookmarks/eda_appcatalog/
> > > Django Version:         1.3.1
> > > Exception Type:         DatabaseError
> > > Exception Value:
>
> > > no such column: bookmarks_eda_appcatalog.eda_app_id
>
> > > Exception Location:     /usr/local/lib/python2.7/dist-packages/django/db/
> > > backends/sqlite3/base.py in execute, line 234
> > > Python Executable:      /usr/bin/python2.7
> > > Python Version:         2.7.2
> > > Python Path:
>
> > > ['/home/jmarcedwards/KeplerDevelopment/KeplerEclipseWorkspace_1/
> > > JME_DjangoTest_3/JME_DjangoTest_3',
>
> > > ---
> > >  
> > > class EDA_AppCatalog(models.Model):
>
> > >    eda_app = models.ForeignKey(EDA_App)
>
> > > --
> > > 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
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread Marc Edwards
I'm looping through some JSON code and generating new model instances
that I am saving to my SQLiteDB.

I have 3 nested "for" loops, like this:

for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
for eda_app in app_catalog['EDA_App']:
new_eda_app =
EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_category=eda_app['product_category'])
new_eda_app.save()
for cmd_str_pair in eda_app['CmdStrings']['name']:
new_cmd_str = CmdString(name=cmd_str_pair['Text'],
cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
new_cmd_str.save()

My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
respectively.

When I loop through the second nested "for" for the CmdStrings,
the .save() is writing to the same model instance, and at the end of
the first nested "for" loop, I have 3 CmdString instances in my DB,
NOT 3+4+4=11 CmdString instances.

Since my DB has 3 EDA_Apps in the DB, I think that the code to
instance a new model instance to save to the DB seems to be fine. It
is the second nested "for" loop that is acting fishy.  I don't know if
I am doing something wrong relative to the DB, because when I step
through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
taking on the next values from the JSON file.  This must be related to
how I am using the DB.

When I try using .save(force_insert=True) on the 2nd nested "for" loop
save, I receive a Django DEBUG page message that the "PRIMARY KEY must
be unique".

Any thoughts or observations on my code style?

Kind regards, Marc

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread Marc Edwards
OK...adding the .pk=None did the trick, but why didn't I have to do
this on the outer loop?

On Dec 8, 11:52 am, Brian Schott  wrote:
> I think if you set:
> new_cmd_str.id = None
> That will force a new PK.  Not sure why the CmdString constructor isn't 
> clearing this..
>
> Brian Schott
> bfsch...@gmail.com
>
> On Dec 8, 2011, at 11:47 AM, Marc Edwards wrote:
>
>
>
>
>
>
>
> > I'm looping through some JSON code and generating new model instances
> > that I am saving to my SQLiteDB.
>
> > I have 3 nested "for" loops, like this:
>
> >    for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
> >        for eda_app in app_catalog['EDA_App']:
> >            new_eda_app =
> > EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_cat 
> > egory=eda_app['product_category'])
> >            new_eda_app.save()
> >            for cmd_str_pair in eda_app['CmdStrings']['name']:
> >                new_cmd_str = CmdString(name=cmd_str_pair['Text'],
> > cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
> >                new_cmd_str.save()
>
> > My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
> > respectively.
>
> > When I loop through the second nested "for" for the CmdStrings,
> > the .save() is writing to the same model instance, and at the end of
> > the first nested "for" loop, I have 3 CmdString instances in my DB,
> > NOT 3+4+4=11 CmdString instances.
>
> > Since my DB has 3 EDA_Apps in the DB, I think that the code to
> > instance a new model instance to save to the DB seems to be fine. It
> > is the second nested "for" loop that is acting fishy.  I don't know if
> > I am doing something wrong relative to the DB, because when I step
> > through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
> > taking on the next values from the JSON file.  This must be related to
> > how I am using the DB.
>
> > When I try using .save(force_insert=True) on the 2nd nested "for" loop
> > save, I receive a Django DEBUG page message that the "PRIMARY KEY must
> > be unique".
>
> > Any thoughts or observations on my code style?
>
> > Kind regards, Marc
>
> > --
> > 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 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread Marc Edwards
Probably because I was setting the ForeignKey in the new_cmd_str to
the new_eda_app that was in the outer loop.  That created a new
reference to that instance, and Django knew that it would need a new
primary key.  Without another external reference, it seemed that the
same primary key was being used.

Would this explanation seem reasonable?

On Dec 8, 12:52 pm, Marc Edwards  wrote:
> OK...adding the .pk=None did the trick, but why didn't I have to do
> this on the outer loop?
>
> On Dec 8, 11:52 am, Brian Schott  wrote:
>
>
>
>
>
>
>
> > I think if you set:
> > new_cmd_str.id = None
> > That will force a new PK.  Not sure why the CmdString constructor isn't 
> > clearing this..
>
> > Brian Schott
> > bfsch...@gmail.com
>
> > On Dec 8, 2011, at 11:47 AM, Marc Edwards wrote:
>
> > > I'm looping through some JSON code and generating new model instances
> > > that I am saving to my SQLiteDB.
>
> > > I have 3 nested "for" loops, like this:
>
> > >    for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
> > >        for eda_app in app_catalog['EDA_App']:
> > >            new_eda_app =
> > > EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_cat
> > >  egory=eda_app['product_category'])
> > >            new_eda_app.save()
> > >            for cmd_str_pair in eda_app['CmdStrings']['name']:
> > >                new_cmd_str = CmdString(name=cmd_str_pair['Text'],
> > > cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
> > >                new_cmd_str.save()
>
> > > My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
> > > respectively.
>
> > > When I loop through the second nested "for" for the CmdStrings,
> > > the .save() is writing to the same model instance, and at the end of
> > > the first nested "for" loop, I have 3 CmdString instances in my DB,
> > > NOT 3+4+4=11 CmdString instances.
>
> > > Since my DB has 3 EDA_Apps in the DB, I think that the code to
> > > instance a new model instance to save to the DB seems to be fine. It
> > > is the second nested "for" loop that is acting fishy.  I don't know if
> > > I am doing something wrong relative to the DB, because when I step
> > > through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
> > > taking on the next values from the JSON file.  This must be related to
> > > how I am using the DB.
>
> > > When I try using .save(force_insert=True) on the 2nd nested "for" loop
> > > save, I receive a Django DEBUG page message that the "PRIMARY KEY must
> > > be unique".
>
> > > Any thoughts or observations on my code style?
>
> > > Kind regards, Marc
>
> > > --
> > > 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 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread J. Marc Edwards
Brian:

I'm getting the same behavior with the new_cmd_str.id=None. 

I'm going to get a sandwich.  I'll think about this more over lunch.

-M

J. Marc Edwards
Lead Architect - Semiconductor Design Portals
Nimbis Services, Inc.
Skype: (919) 747-3775
Cell:  (919) 345-1021
Fax:   (919) 882-8602
marc.edwa...@nimbisservices.com
www.nimbisservices.com


On 12/08/2011 11:52 AM, Brian Schott wrote:
> I think if you set:
> new_cmd_str.id = None 
> That will force a new PK.  Not sure why the CmdString constructor isn't 
> clearing this..
>
> Brian Schott
> bfsch...@gmail.com
>
>
>
> On Dec 8, 2011, at 11:47 AM, Marc Edwards wrote:
>
>> I'm looping through some JSON code and generating new model instances
>> that I am saving to my SQLiteDB.
>>
>> I have 3 nested "for" loops, like this:
>>
>>for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
>>for eda_app in app_catalog['EDA_App']:
>>new_eda_app =
>> EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_category=eda_app['product_category'])
>>new_eda_app.save()
>>for cmd_str_pair in eda_app['CmdStrings']['name']:
>>new_cmd_str = CmdString(name=cmd_str_pair['Text'],
>> cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
>>new_cmd_str.save()
>>
>> My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
>> respectively.
>>
>> When I loop through the second nested "for" for the CmdStrings,
>> the .save() is writing to the same model instance, and at the end of
>> the first nested "for" loop, I have 3 CmdString instances in my DB,
>> NOT 3+4+4=11 CmdString instances.
>>
>> Since my DB has 3 EDA_Apps in the DB, I think that the code to
>> instance a new model instance to save to the DB seems to be fine. It
>> is the second nested "for" loop that is acting fishy.  I don't know if
>> I am doing something wrong relative to the DB, because when I step
>> through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
>> taking on the next values from the JSON file.  This must be related to
>> how I am using the DB.
>>
>> When I try using .save(force_insert=True) on the 2nd nested "for" loop
>> save, I receive a Django DEBUG page message that the "PRIMARY KEY must
>> be unique".
>>
>> Any thoughts or observations on my code style?
>>
>> Kind regards, Marc
>>
>> -- 
>> 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 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<>

Newbie question on forms using ChoiceField and "choices" field...

2011-12-15 Thread J. Marc Edwards
OK...I have the following model and form.

*class CmdString(models.Model):
   
name= models.CharField(max_length=50)
cmd = models.CharField(max_length=200)
eda_app = models.OneToOneField(EDA_App, primary_key=True)
   
def __unicode__(self):
return self.cmd  *  


*class EDA_AppSelectForm(forms.Form):
app_cmds = forms.ChoiceField(choices=CmdString.objects.all())*

When I execute in a Python shell the command *CmdString.objects.all() *I
have the following output from my database:

*[, ,
, ,
, ,
, , , , , , , , , , , , , , '...(remaining elements truncated)...']*

This is a Python list with each element of the list a dictionary
object.  This list is iterable, i.e.

*for cmd in CmdString.objects.all():
... print cmd*

will return:

*vcs -a -b -f $FILE1
vhdlan -c -d -f $FILE2
virsim -c -d -f $FILE2
virt1 -a -b -f $FILE1
virt2 -c -d -f $FILE2
virt3 -c -d -f $FILE2
virt4 -c -d -f $FILE2
quartz1 -c -d -f $FILE2
quartz2 -c -d -f $FILE2
quartz3 -a -b -f $FILE1
quartz4 -c -d -f $FILE2
vcs -a -b -f $FILE1
vhdlan -c -d -f $FILE2
virsim -c -d -f $FILE2
virt1 -a -b -f $FILE1
virt2 -c -d -f $FILE2
virt3 -c -d -f $FILE2
virt4 -c -d -f $FILE2
quartz1 -c -d -f $FILE2
quartz2 -c -d -f $FILE2
quartz3 -a -b -f $FILE1
quartz4 -c -d -f $FILE2*

Perfect...I'm happy with this output.

Now, I wanted to take a look at the output of the form to be rendered as
HTML.  I'm looking for the "select" tag with the options to be output
from the "choices" kwarg.

When I to take a look at an instance of this form with "as_p", I get the
following error:

*>>> samp2 = EDA_AppSelectForm()
>>> type(samp2)

*
*>>> samp2.as_p()
>>> Traceback (most recent call last):
  File "", line 1, in 
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/forms.py",
line 235, in as_p
errors_on_separate_row = True)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/forms.py",
line 180, in _html_output
'field': unicode(bf),
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/forms.py",
line 408, in __unicode__
return self.as_widget()
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/forms.py",
line 439, in as_widget
return widget.render(name, self.value(), attrs=attrs)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/widgets.py",
line 516, in render
options = self.render_options(choices, [value])
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/widgets.py",
line 533, in render_options
for option_value, option_label in chain(self.choices, choices):
TypeError: 'CmdString' object is not iterable

>>> print samp2.as_p()
>>> Traceback (most recent call last):
  File "", line 1, in 
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/forms.py",
line 235, in as_p
errors_on_separate_row = True)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/forms.py",
line 180, in _html_output
'field': unicode(bf),
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/forms.py",
line 408, in __unicode__
return self.as_widget()
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/forms.py",
line 439, in as_widget
return widget.render(name, self.value(), attrs=attrs)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/widgets.py",
line 516, in render
options = self.render_options(choices, [value])
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/forms/widgets.py",
line 533, in render_options
for option_value, option_label in chain(self.choices, choices):
TypeError: 'CmdString' object is not iterable*

What is happening here?  When I remove the "choices" kwarg in the
"app_cmds" form field, I can print out the HTML, and the "select" field
is there as expected, but I have no choices/options in the HTML. This is
why I was trying to use the "choices" attribute.

Now the documentation for the "choices" kwarg is pasted below, which
says that this should be an iterable of 2-tuples, but seems to indicate
it could be a list as well.  The documentation here seems unclear, i.e
an iterable of tuple of 2-tuples, I don't think it means this.

How can I achieve what I am looking for here?

> choices
> An iterable _/(e.g., a list or tuple) /_of 2-tuples to use as choices
> for this field. This argument accepts the
> same formats as the choices argument to a model field. See the model
> field reference documenta

Problem re-creating SQLite database with manage.py...

2011-12-16 Thread J. Marc Edwards
I'm trying to re-create my SQLite database from scratch.  I am now
receiving the following error message from:

*(foobarr)jmarcedwards@jmelinux:~/git/django-nimbis/projects/dev$ python
./manage.py syncdb
Syncing...
Traceback (most recent call last):
  File "./manage.py", line 11, in 
execute_manager(settings)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 438, in execute_manager
utility.execute()
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/core/management/base.py",
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/core/management/base.py",
line 220, in execute
output = self.handle(*args, **options)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/core/management/base.py",
line 351, in handle
return self.handle_noargs(**options)
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/management/commands/syncdb.py",
line 87, in handle_noargs
db.connection_init()
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/db/mysql.py",
line 38, in connection_init
cursor = self._get_connection().cursor()
  File
"/home/jmarcedwards/foobarr/local/lib/python2.7/site-packages/django/db/backends/dummy/base.py",
line 15, in complain
raise ImproperlyConfigured("You haven't set the database ENGINE
setting yet.")
django.core.exceptions.ImproperlyConfigured: You haven't set the
database ENGINE setting yet.
(foobarr)jmarcedwards@jmelinux:~/git/django-nimbis/projects/dev$ ls
celerybeat-schedule  fixtures __init__.pycmanage.py  
requirements.txt  settings.py   static   urls.pyc
env.sh   __init__.py  local_tests.py  manage.pyc 
run_server.sh settings.pyc  urls.py
(foobarr)jmarcedwards@jmelinux:~/git/django-nimbis/projects/dev$
*
sys.path.insert(0, PROJDIR)
sys.path.insert(0, APPSDIR)

# sqlite database for testing
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJDIR, 'db.sqlite'),
}
}

SOUTH_DATABASE_ADAPTERS = {
'default': "south.db.mysql"
}

I am working from within the directory where my manage.py and
settings.py are located.  It seems that perhaps my settings.py file is
not being picked up from the same directory.  I'm getting the same error
inside of my Eclipse Django PyDev environment.

Are there any more direct, manual process for invoking the syncdb with
the settings.py and generating my database?

Regards, Marc
-- 

J. Marc Edwards
Lead Architect - Semiconductor Design Portals
Nimbis Services, Inc.
Skype: (919) 747-3775
Cell:  (919) 345-1021
Fax:   (919) 882-8602
marc.edwa...@nimbisservices.com
www.nimbisservices.com

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<>

Can I escape or delimit the "{{ }}" template braces?

2011-12-19 Thread J. Marc Edwards
I'd like to write a paragraph on my page that describes the {{ }}
syntax, but the template interpreter is interpreting the braces.
-- 

J. Marc Edwards
Lead Architect - Semiconductor Design Portals
Nimbis Services, Inc.
Skype: (919) 747-3775
Cell:  (919) 345-1021
Fax:   (919) 882-8602
marc.edwa...@nimbisservices.com
www.nimbisservices.com

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<>