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
1 answer

Django two parameter filter query with foreign key

My Django models look like this: class User(models.Model): userid = models.CharField(max_length=26,unique=True) #some more fields that are currently not relevant class Followers(models.Model): user =…
robjeiter
  • 197
  • 1
  • 16
0
votes
2 answers

Angular 5 models httpClient type casting

I declare a model in ingredient.model.ts export class Ingredient { constructor(private name: string, public amount: number) {} getName() { return this.name } } In ingredients.service.ts, if I get them in this…
zangarmarsh
  • 319
  • 5
  • 18
0
votes
1 answer

Django model request array

I am new to python and Django. I haven't found anything in documentations so I have to write here. I have such problem. I have cars table where you can find it's make, model. year and so on. Usually i make request by just…
Yakov Kemer
  • 373
  • 3
  • 17
0
votes
1 answer

Retrieving ID to use in a query, Django

I have a simple question I guess: I am trying to query my data base in order to retrieve the number of team members linked to a specific team, linked to a specific project. team_member_count = Project.objects.get(id =…
Ben2pop
  • 746
  • 1
  • 10
  • 26
0
votes
1 answer

before insert and after delete

i am somehow lost again in my beginners project. I am adding records for flights which have a takeoff and a landing time. So everytime i am inserting a flight oder deleting it (to edit is another question) i would like to update the total airframe…
0
votes
2 answers

How to think about models and relationships in more complex Rails applications?

I've been learning Ruby on Rails for quite some time now and have built several toy applications. I've taken many classes/courses (i.e., Hartl, Code School, Udemy, etc.). Now I'm working on a pet project that is fairly complex - many models and…
0
votes
0 answers

Django.db.utils.DataError: value too long for type character varying (3)

Not sure why I'm getting this error as none of my fields are set to limit 3 except one, which I know will never exceed 3. I'm able to run python manage.py makemigrations without any issue, but once I migrate the error pops up. My model looks like…
garciaryan
  • 13
  • 4
0
votes
0 answers

models and I need only date from

Base model class EmployeeDetails(models.Model): employee_ID=models.IntegerField() user = models.ForeignKey(User, on_delete=models.CASCADE) #checkin = models.DateTimeField(default = timezone.now) #checkout = models.DateTimeField(default =…
0
votes
0 answers

How to return correct model after complex joins on a relationship in Laravel

Given the database & model structure: A suburb belongs to many custom areas suburbs: - id - name A custom belongs to many suburbs custom_areas: - id - name custom_area_suburbs: - custom_area_id - suburb_id A public holiday…
Anim8r
  • 191
  • 1
  • 9
0
votes
1 answer

Get data from 2 Model in Django python

class Product(models.Model): name = models.CharField(max_length=200) price = models.FloatField() avgrating = models.FloatField() def __str__(self): return self.name class Rating(models.Model): Product_id =…
0
votes
2 answers

using models in frontend? (vue vs ember)

In Laravel I am used to define my models up front and to perform all actions on them. However, it seems that most frontend frameworks just use whatever an API reponse provides and store the json data into simple arrays. The only framework that I…
Chris
  • 13,100
  • 23
  • 79
  • 162
0
votes
0 answers

I remigrated a join table in Rails and now the associations are no longer working

My join table wasn't working correctly so I tried to fix it by changing the syntax in the migrations. I have a building, organization, and OrganizationBuilding classes The original was class CreateOrganizationBuildings < ActiveRecord::Migration …
almusavi
  • 1
  • 2
0
votes
0 answers

Comparing nested models

I am trying to compare two nested models that have different number of participants so I keep getting an error message. Error in anova.lmlist(object, ...) : models were not all fitted to the same size of dataset In addition: Warning message:…
0
votes
1 answer

Deploying Matlab gui exe with Weka Models

My problem is that when i deploy my Program along with weka models. The resulting error is that it cant read the weka model file. Here is the structure of the Files ModelLoadmodel.m Contains The ff…
Albert Ruelan
  • 857
  • 7
  • 20
0
votes
0 answers

using __import__ on a module in a different directory python. django

I am attempting to import a model from another app in django. The following attempt fails: from venueadmin.models import VenuePermissions fails how: Python is not able to located VenuePermissions, i guess circular reference? from django.apps…
user6781560