Questions tagged [models]

A model is an abstract representation of a real-life object or process. Models are a part of the popular MVC pattern, as well as a more general concept in the sciences for approximating behavior.

A model is one of the three components of Model-View-Controller (MVC) programming pattern that provides knowledge: data and how to work with this data, responding to requests by changing its state.

It can also refer to models in a more general scientific sense, denoting a representation (generally a simplification) of how a real-world process operates.

2397 questions
0
votes
2 answers

Django admin with multiple heritage

I have the following class class master(models.Model): topic = models.ManyToManyField('Topic') class child1(master): question = models.CharField(max_length=100, null=False) class child2(master): answer_display =…
remy_dev
  • 195
  • 1
  • 12
0
votes
2 answers

How can I set two Foreign Keys in a class? DJANGO ORM

I need to make a table 'Friend' with foreignkeys that store instances of the User class- two of them one for the friend and one for the user attribute. (Table is of relationships) How to do this? OnetoOneField doesn;t work. It gives me an error in…
V. Snow
  • 133
  • 1
  • 14
0
votes
1 answer

how to send parameters array data from models to custom library and access the array in codeigniter..?

i'm new in codeigniter. i have some problem for access arrays data in my custom library. my model
epm.007
  • 7
  • 7
0
votes
1 answer

Django Model Foreign Key filtering

I need to filter some Models in Django and return them trough REST, but I have some difficulties. I have 4 Models connected with Foreign key's like so: class Standort(models.Model): name = models.CharField(max_length=40) farbe =…
0
votes
1 answer

Rails build function with 2 Objects

I have a problem concerning the build method in rails 3. I want to create a Todo with foreignkeys of project and group. The associations look like Group has_many projects and todos Project has_many todos, belongs_to group Todo belongs_to 1 project…
Zeus
  • 746
  • 4
  • 18
0
votes
1 answer

Django, where should the code go? views or models

I have a bunch of REST views and a bunch of data transfers posted from templates that needs to be cleaned. I am wondering where to put all the sanitizing code and processing code should go: views.py or models.py ? Am I missing some secret tricks…
theMobDog
  • 1,251
  • 3
  • 13
  • 26
0
votes
0 answers

How to display pdf file on a template from upload from admin only

I want to serve PDF document on my website using the django admin only. I am totally lost this is what i have as my model class Examination(models.Model): examination_name = models.CharField(max_length=50) class Meta: …
0
votes
2 answers

ruby on rails - nested forms

I have a form that sets the attributes of a model, however, there is an attribute that I want to set through the code. That is, I want the user to set some attributes, but I want the program to set other attributes. Is there any way of doing…
AlexBrand
  • 11,971
  • 20
  • 87
  • 132
0
votes
0 answers

Fitting two models with different amplitudes

I am trying to fit two sweeps that take on a Fraunhofer distribution. Please help me to understand a snippet in my code to make it run better, because it changes the fitting, but I don't know why! This is the line I mean specifically: if…
Tyler Ram
  • 13
  • 5
0
votes
1 answer

Need to store more vehicles per single user_id in django api

I had customized the inbuilt user model by using abstract user . I made another model vehicle with a one to one relation with user model, which resembles vehicles of each user . But it is storing a single vehicle per user_id. I need it to store…
Rishabh Pandey
  • 209
  • 1
  • 4
  • 16
0
votes
1 answer

Doctrine generate models - problem with relation type

I am trying generate doctrine models from yaml schema I have schema like that: Product: columns: id: type: integer(5) primary: true unsigned: true autoincrement: true …
mrok
  • 2,680
  • 3
  • 27
  • 46
0
votes
1 answer

How to implement user-friends relationship in cakephp?

I am new to cakephp. I am working on my Social network project.I am having users and friends relationship concept. I am having problem in sending friend request and accepting ..... I am not understanding how to start on this concept... If anybody…
vk1985
  • 1
0
votes
1 answer

Simplest way to extend doctrine for MVC Models

Im developing my own framework that uses namespaces. Doctrine is already integrated into my auto loading system and im now at the stage where ill be creating the model system for my application Usually i would create a simple model like…
RobertPitt
  • 56,863
  • 21
  • 114
  • 161
0
votes
0 answers

django admin, displaying all instances of a model1 associated with model2 on model2's change page?

Consider these two models Keyword and Statement (model1 and model2 respectively): @python_2_unicode_compatible class Keyword(models.Model): word = models.CharField(max_length=200) statement = models.ManyToManyField(Statement) def…
Byron Smith
  • 587
  • 10
  • 32
0
votes
1 answer

django models Values error preventing me from creating a model with fields specified as parameters?e

I don't seem to understand this error or how to fix it. There's something I don't understand about django models. Consider what happens when I try to perform get_or_create on the Keyword model. Here's the model, alongside some code I write in…
Byron Smith
  • 587
  • 10
  • 32
1 2 3
99
100