Lets say I have this model
class Egg(models.Model):
file = FileField(upload_to='media')
img = ImageField(upload_to='media')
How to get an Egg instance if I only have the file URL string like 'http://example.com/media/spam.tar.gz'? Can I query by this URL??
...
Hi,
I have a simple "Log" model, that records the fact of calling controller's action.
Entries of this "log" record are supposed to be created once and never altered. Also, I will have many of these records in the database.
So, there is no need for "updated_at" column (don't need to waste the memory on HDD).
How can I tell to Rails t...
I have the following problem with CakePHP:
In my model, Deposit belongsTo Account, and Account belongsTo Customer.
When querying Deposits, I get the Account information, but not the Customer's, by default.
If I set Deposit->recursive to 2, I get the Customer information (and a whole lot more), but CakePHP esentially throws one SEL...
I've been reading http://pylonsbook.com/en/1.1/starting-the-simplesite-tutorial.html and following along with their SimpleSite tutorial but am having some issues with creating the Model.
The Model imports they use on the tutorial are:
"""The application's model objects"""
import sqlalchemy as sa
from sqlalchemy import orm
from simples...
Typically, Magento's models are "backed" by a MySQL database--this is where the data comes from, and is persisted to. How can I get the data from a standard PHP array? Is there some sample code available anywhere? (I'm especially interested in the "reading" aspect at the moment, but it would be useful to know how to "write" too.)
...
Hi folks!
I have a CodeIgniter/PHP Model and I want to insert some data into the database.
However, I have this set in my 'raw' SQL query:
ON DUPLICATE KEY UPDATE duplicate=duplicate+1
I am using CodeIgniter and am converting all my previous in-controller SQL queries to ActiveRecord. Is there any way to do this from within the Activ...
Hi,
I'm trying to store sections of a document in a Django app. The model looks like:
class Section(models.Model):
project = models.ForeignKey(Project)
parent_section = models.ForeignKey('Section', blank=True, null=True, related_name='child_set')
predecessor_section = models.ForeignKey('Section', blank=True, null=True, related_na...
I'm trying to move past the beginner stage of Rails and into the intermediate but I'm finding it hard to find more advanced examples to learn from.
For example, I've read that you need to be careful about "Nested Routes" and shouldn't go more than 2 deep. What happens in a situation like this?
Customer can place many Orders
Orders c...
Hi,
normally i load a partial view by doing
<% Html.RenderPartial("MyPartialView", Model); %>
But how can i assign the Model to the corresponding action, when i instead use jQuery to load this partial view?
$.ajax({
url: "/MyUrl/",
data: 'html',
success: function (data) { $('#MyPartialView').html(...
Clint Edmonson, Microsoft Architect Evangelist, posted a video series on Channel 9 about how to use the Visual Studio 2010 Ultimate visualization and modeling tools in your software development process. How helpful do you find these kinds of videos in learning how to use these tools?
Here are the video links:
Part 1: Brainstorming a...
I have the following create action:
def create
@order = Order.new(params[:order])
if params[:same_as_above] == "1"
@order.billing_address.name = @order.shipping_address.name
@order.billing_address.number = @order.shipping_address.number
@order.billing_address.street = @order.shipping_address.town
end
...
I've been reading the Pylons Book and, having got to the part about Models, realise it's out of date. So I then switched over to the official Pylons documentation for creating Models in Pylons 1.0 - http://pylonshq.com/docs/en/1.0/tutorials/quickwiki_tutorial/
I've followed what they've got and it's still failing.
./blog/model/init.py
...
Hi all,
in an existing project I have tried to introduce Core Data long after the project was created, so its model is already in place.
I have created the xcdatamodel and added my only class to it.
That class should act as a global storage for objects in my application.
The class properly implement NSManagedObject and I have verified i...
i have in my project a mainpage interited from uiviewcontroller. and any subpage is inherited from a subviewcontroller, that is an inherited uiviewcontroller, just with some overwritten behaviours and some new functions.
problem in that case is, that the class-model generated by xcode does not display that one inheritation between uivie...
Hi,
I created a enterprise system model from a class diagram and converted it php object oriented code.
What I have now is just an empty model, it's able to relate and the connections are handled. Now the next step is ahead. I have a database and have to put the object into the database.
Now there is a lack of experience on my side. I...
Hi all,
I'd like to run a script that does some evaluation of user-entered data after it is successfully created. I have a model representing the data, but how do I specify that the model class should execute function X after an instance is successfully created?
Part 2: would it be more appropriate to put the code I want to execute in ...
I have two models I want to connect with an m-to-m relationship, but I want the relationship to have some data of its own, such as a date due or a count or something like that...
Suppose I have Users, Groups, and some UsersInGroups object, where users and groups both have a has_many X, :through Y relationship. UsersInGroups belongs_to a...
I am recently inclined towards in Oracle jargon and the more I am looking into the more is attracting me.
I have recently come across the MODEL clause but to be honest I am not understanding the behaviour of this. Can any one with some examples please let me know about the same.
Thanks in advance
...
I would like to specify a default sort order in my model.
So that when I preform a find(:all, ...) without an :order parameter it defaults to the order specified in the model, but specifying an :order will override the default.
...
i got a godgiven list of xyz (the code says int, just an example) glued into a QList (to big to move anywhere). How can I create a Model View for that? I allready read the Qt doc which tells me, I have to reimplement data, index, parent, rowCount, columnCount functions. But the preprocessor/compiler cries for more reimplemented functions...