ok.
On Wednesday, April 15, 2015 at 3:39:26 PM UTC-5, Vijay Khemlani wrote:
>
> tblEntryObj seems to be an instance of your model, it is not a dictionary,
> so normally it wouldn't have a "keys" method.
>
> On Wed, Apr 15, 2015 at 5:32 PM, Henry Versemann > wrote:
>
>>
tblEntryObj seems to be an instance of your model, it is not a dictionary,
so normally it wouldn't have a "keys" method.
On Wed, Apr 15, 2015 at 5:32 PM, Henry Versemann
wrote:
> Vijay,
>
> I tried your method, and while it got me the table class that I wanted,
> for some
Vijay,
I tried your method, and while it got me the table class that I wanted, for
some reason when I try to get into the actual list of entries in the
desired table, I can't seem to get to either the keys or values of any of
the list objects.
So I'm not sure what's going on.
Here's some
Thanks for the help Stephen.
On Wednesday, April 15, 2015 at 11:53:09 AM UTC-5, Stephen Butler wrote:
>
> Or, if you know all the Model classes are in the same module that
> you've imported, it should be as easy as:
>
> from myapp import models
>
> model_class = getattr(models, tableName)
>
>
You can use get_model
from django.db.models.loading import get_model
YourModel = get_model('your_app', tableName)
On Wed, Apr 15, 2015 at 2:01 PM, Tim Chase
wrote:
> On 2015-04-15 09:45, Henry Versemann wrote:
> > My problem is since the logic won't know which
On 2015-04-15 09:45, Henry Versemann wrote:
> My problem is since the logic won't know which tables will be in
> the incoming list I need to try to reference the entries in each
> table using some kind of evaluated version of a variable containing
> the name of each table, as I iterate through the
Or, if you know all the Model classes are in the same module that
you've imported, it should be as easy as:
from myapp import models
model_class = getattr(models, tableName)
On Wed, Apr 15, 2015 at 11:50 AM, Stephen J. Butler
wrote:
> Classes (MyModel) are attributes
Classes (MyModel) are attributes of the module (myapp.models). No
reason to use eval. You can get the module from importlib and then the
class from using getattr() on the module.
http://stackoverflow.com/questions/10773348/get-python-class-object-from-string
On Wed, Apr 15, 2015 at 11:45 AM,
I have an incoming list of DB table names associated with my application. I
want to iterate through this list of table names getting all of the
entries for each table and then print some data from each tables' entry to
a file. I've tried to write this so I can use it for as many
app-associated
Hi Henry,
On 03/10/2015 07:37 PM, Henry Versemann wrote:
> So how does an expression like you suggested above (
> innerDict['+newinnrkey+'] = newinnrval ) work then?
> It seems like it wouldn't work without enclosing the expression
> with quotes or double-quotes, and even then it seems like it
On Wed, Mar 11, 2015 at 1:24 AM, Henry Versemann wrote:
> so its valid python code to write the expression
>
> innerDict['+newinnrkey+']
>
> without enclosing the parts outside of the plus-signs surrounding the
> "newinnrkey" variable within quotes or double quotes?
> I'm
Carl,
Thanks for the advice and information. I'm certainly going to try it.
Thanks again for the help.
Henry
On Wednesday, March 11, 2015 at 11:05:38 AM UTC-5, Carl Meyer wrote:
> Hi Henry,
>
> On 03/10/2015 07:37 PM, Henry Versemann wrote:
> > So how does an expression like you suggested
So how does an expression like you suggested above (
innerDict['+newinnrkey+'] = newinnrval ) work then?
It seems like it wouldn't work without enclosing the expression with quotes
or double-quotes, and even then it seems like it would only become some
kind of string instead of a statement
so its valid python code to write the expression
innerDict['+newinnrkey+']
without enclosing the parts outside of the plus-signs surrounding the
"newinnrkey" variable within quotes or double quotes?
I'm not sure I've ever heard or seen such python code before anywhere.
Can you explain or point
Hi Henry,
On 03/10/2015 03:25 PM, Henry Versemann wrote:
> I have a new dictionary that I want to build, using data from another
> dictionary. I have a view which is receiving a single key/value pair
> from the original dictionary. Then in the view I've defined the new
> dictionary like this:
>
eval() operates on an expression, not a statement. Assignment makes it a
statement.
Why wouldn't you just say:
innerDict['+newinnrkey+'] = newinnrval
On Tue, Mar 10, 2015 at 5:25 PM, Henry Versemann
wrote:
> I have a new dictionary that I want to build, using data
I have a new dictionary that I want to build, using data from another
dictionary. I have a view which is receiving a single key/value pair
from the original dictionary. Then in the view I've defined the new
dictionary like this:
innerDict = {}
Now I want to make this as dynamic as possible
17 matches
Mail list logo