Top "Model" questions

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

Email model validation with DataAnnotations and DataType

I have following model: public class FormularModel { [Required] public string Position { get; set; } [Required] [DataType(DataType.EmailAddress)] public string Email { …

c# asp.net-mvc validation email model
Yii model to array?

How can I convert the result of Trips::model()->findAll() to an array?

arrays model yii
Rails: Validating min and max length of a string but allowing it to be blank

I have a field that I would like to validate. I want the field to be able to be left …

ruby-on-rails ruby validation model
How to query database by id using SqlAlchemy?

I need to query a SQLAlchemy database by its id something similar to User.query.filter_by(username='peter') but …

python sql model sqlalchemy
ASP.NET MVC Model vs ViewModel

OK, I have been hearing discussion about "ViewModels" in regards to MS's ASP.NET MVC. Now, that is intended to …

asp.net-mvc asp.net-mvc-2 model viewmodel
Django required field in model form

I have a form where a couple of fields are coming out as required when I don't want them too. …

python django forms model widget
MVC Html.TextBoxFor MaxLength and Value

I am trying to setup a TextBox control in my project using Html.TextBoxFor. However, it only seems to have …

asp.net-mvc-2 model lambda maxlength html.textboxfor
ForeignKey does not allow null values

I am using the Django REST Framework 2.0. Here is my model class: class Mission(models.Model): assigned_to = models.ForeignKey(…

django-rest-framework model foreign-keys serialization
How to delete a model using php artisan?

Is there a command to safely delete a model in Laravel 5? To create a model we use php artisan make:…

php model laravel-5
Rspec doesn't see my model Class. uninitialized constant error

I'm writing tests on Rspec for my models in Ruby on Rails application. And I receive this error while starting …

ruby-on-rails testing model rspec