models

Django: Advice on designing a model with varying fields.

I'm looking for some advice/opinions on the best way to approach creating a sort-of-dynamic model in django. The structure needs to describe data for Products. There are about 60 different possible data points that could be relevant, with each Product choosing about 20 of those points (with much overlapping) depending on its ProductTyp...

loading doctrine models in zend framework scripts

i use zend framework 1.10 and i have a script under scripts library. i run this script from command line. how can i load all the models of doctrine and use them in my script. in the begining of the script i write /** * Doctrine CLI script */ define('APPLICATION_ENV', 'production'); define('APPLICATION_PATH', realpath(dirname(__FIL...

Programming Neural Networks with Python?

I'm a College student (Economics) and I want to program some monetary models using Neural Networks. I want those models to be able to predict future values of some variables using economic data, but I really don't know how to "model" the program itself. Is there any good Python module for that? I mean, a module for NN and a module for ec...

How to add a non database field to a database driven Django model, and set it via a QuerySet preserving its datatype?

I've got a Django model containing various database model fields. One of the manager's querysets retrieves various aggregations via some annotate calls. Some of those annotations are custom made and retrieve float values from the database. Those annotations are not part of the model's fields. However, when the queryset is created, thos...

Does anybody know where I can download libraries of 3D models purely in XAML?

I am looking for 3D models that are 100% XAML. ...

Doctrine relationships problem

I have two tables. A users table and a profile table. The profile table has a foreign key of users_id. The models for the tables are set up with one to one relationships. When I try and save some data I get this error: Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[23000]: Integrity constrai...

Django get a model's fields

Hi All, Given a Django model, I'm trying to list all of it's fields. I've seen some examples of doing this using the _meta model attribute, but doesn't the underscore in front of meta indicate that the _meta attribute is a private attribute and shouldn't be accessed directly? ... Because, for example, the layout of _meta could change...

Increasing the number of Models on Google App Engine affects performance?

I made a Google App Engine application as a class project in my university. Now I need to optimize it to use it commercially. Nowadays, the code is very slow. It has only few Models with many properties in each. Before rewriting the Models code, I need to know if my application will be faster if I increase the number of Models, i.e. inc...

Cakephp returns empty but sql query has results

I have been fighting with this code: function getNextActionFObyBalance($when) { $theQuery = $this->find('first', array( 'fields' => array( 'Contract.id', 'Contract.start_balance' ), 'conditions' => array( 'AND' => array( 'Status.next_action_by' => 'frontoffice', 'Status.status_type' => 'active', ...

Creation of dynamic model fields in django

This is a problem concerning django. I have a model say "Automobiles". This will have some basic fields like "Color","Vehicle Owner Name", "Vehicle Cost". I want to provide a form where the user can add extra fields depending on the automobile that he is adding. For example, if the user is adding a "Car", he will extra fields in the fo...

Linking two tables together using has_many AND has_one?

I sure this has been asked a million times already. I just not searching very well. I have the following setup: I have an Instructor who has many Events. Each event has only one Instructor (owner/creator). I want to add a separate linkage to allow other instructors to be associated but still preserve the original instructor (owner). I ha...

Can you include two models in one query in CakePHP?

I am building a book review application. In the Review model, I have book_id and several fields like author_rating and/or scary_rating. In the Book model, I have a search() function that I'd like to use to search for books with certain characteristics, like an author_rating of above 5, for example. What is the best way to accomplish t...

CakePHP: COUNT function and model joining help

Hi, I'm trying to join tables to get a count on a field but am having trouble figuring out how to do it. here are my tables: tags id INT tag VARCHAR project_tags id INT project_id INT tag_id INT projects id INT ... I want show in my view something like this: [tags.tag] x 23 [tags.tag] x 12 ... Now I'm no S...

Django newbie question regarding defining an object with subobjects from models for use in templates

I am somewhat new to Django and have searched for some simple examples of creating objects with subobjects in views so that in templates I can have nested for loops. Here is my models.py for this application... from django.db import models from django import forms class Market(models.Model): name = models.CharField('Market name'...

Update large CakePHP model, but *don't* touch certain fields?

Using CakePHP 1.3 I have a fairly large model in CakePHP, and I'd like to have some hidden elements on the form page to (manually) compare/validate against before saving, but when doing a saveAll() (with validation), I don't want these fields present (essentially to avoid them being updated). What's the proper way to handle this? Remo...

ASP.NET MVC: posting a certain object to the controller)

When I create a form to send data about new message: <% using (Html.BeginForm()) { %> <%= Html.TextAreaFor(m => m.Message.Text) %> <input type="submit" /> <% } %> I can't receive the message class in the controller: [HttpPost] public ActionResult NewMessage(Message message) // will not work, mes...

How to give 3 relations to same table in Cakephp

Hi i am new in cake php and can't solve the problem. The problem is I have a table like; id varchar(16) parent_id varchar(16) text text user_id bigint(20) is_deleted_by_user bit(1) is_deleted_by_us bit(1) who_deleted bigint(20) who_answ...

django models foreignkey beetwen apps

Hello, I have problems with making my models to work. Here is my appname.misc.models file from django.db import models class user(models.Model): login=models.CharField(max_length=20) email=models.EmailField(max_length=50) banned=models.BooleanField() key=models.CharField(max_length=15) rights=models.CharField(max_le...

CakePHP 1.3.4 $belongsTo problem incase of Relationship table

I have a table called user_relationship. which has two foreign keys refering back to the User table to map that they are friends. CREATE TABLE `user_relationships` ( `id` int(11) unsigned NOT NULL auto_increment, `status` varchar(255) default 'pending', `time` datetime default NULL, `user_id` int(11) unsigned NOT NULL, `frien...

possible bug in django models

models.py: class root(models.Model): uid_string = models.CharField(max_length=255, unique=True) class tree(models.Model): uid_string = models.ForeignKey(root, to_field='uid_string', db_column='uid_string') class shrub(models.Model): uid_string = models.ForeignKey(root, to_field='uid_string') obviously, the column ...