Top "Model" questions

Part of the MVC pattern, the Model manages the behaviour and data of the application.

Populating django field with pre_save()?

class TodoList(models.Model): title = models.CharField(maxlength=100) slug = models.SlugField(maxlength=100) def save(self): self.slug = title super(TodoList, …

python database django model triggers
Rails "validates_uniqueness_of" Case Sensitivity

Here is the model (I am using SQLLite3): class School < ActiveRecord::Base validates_uniqueness_of :name end For example, …

ruby-on-rails validation model
Magento - Passing data between a controller and a block

Really quick and simple question but I can't find a decent answer to this - What is the best way …

php variables magento model session-variables
How can I change a Django form field value before saving?

if request.method == 'POST': userf = UsersModelForm(request.POST) username = userf.data['username'] password = userf.data['password'] passwordrepeat = userf.data['passwordrepeat'] …

python django forms model save
All Levels of a Factor in a Model Matrix in R

I have a data.frame consisting of numeric and factor variables as seen below. testFrame <- data.frame(First=…

r matrix model indicator
Get checkbox values in controller mvc 4

I am trying to retrieve the checked checkbox value from a checkbox list without any success , below is the code …

asp.net-mvc asp.net-mvc-4 model controller checkboxlist
How can set two primary key fields for my models in Django

I have a model like this: class Hop(models.Model): migration = models.ForeignKey('Migration') host = models.ForeignKey(User, related_name=…

python django django-models model primary-key
Cast string to float is not supported in Linear Model

I keep getting this error in my linear model: Cast string to float is not supported Specifically, the error is …

python tensorflow model linearmodels
Using ActiveRecord, is there a way to get the old values of a record during after_update

Setup using a simple example: I've got 1 table (Totals) that holds the sum of the amount column of each record …

ruby-on-rails activerecord model callback
How does one add an attribute to a model?

In rails I generate a model with two strings and would like to add more. How would I go about …

ruby-on-rails attributes model attr