models Questions

3

Solved

I am fairly new to Ruby on Rails, and I clearly have an active record association problem, but I can't solve it on my own. Given the three model classes with their associations: # application_for...
Wil asked 23/11, 2009 at 5:9

2

Solved

I have the following model classes: class Category(models.Model): category = models.CharField('category', max_length=200, blank=False) class Book(models.Model): title = models.CharField('title'...
Woald asked 31/5, 2012 at 11:33

2

I have the following column in SQLAlchemy: name = Column(String(32), nullable=False) I want that if no value is passed onto an insertion, it should enter a default value of either completely bla...
Virgilvirgilia asked 22/3, 2018 at 10:16

6

Solved

I tried to use UpperCase in all my CharField, in all my Django Model. Today I have some code in my save method: def save(self, *args, **kwargs): for field_name in ['razao_social', 'nome_fantasi...
Clotildecloture asked 21/10, 2013 at 15:32

6

Solved

I know I can require a field by adding validates_presence_of :field to the model. However, how do I require at least one field to be mandatory, while not requiring any particular field? thanks in ...
Demineralize asked 13/5, 2010 at 0:2

7

Solved

I have a PostgreSQL database for my Rails application. In the schema named 'public' the main Rails models tables are stored etc. I have created a 'discogs' schema which will have tables with names ...

3

Solved

I have a question in Django on how you can compare dates to solve some solutions. For example I have a datefield in my models.py Like below. class Invoice(models.Model): payment_date = models.Dat...
Robet asked 5/1, 2011 at 16:3

3

Solved

I was wondering if anybody knew of a way to do something like the following: rails generate model Foo name:string, validates: {:name, uniqueness: true} That is, whilst declaring a model generato...

5

Solved

This problem randomly started appearing for me. I know that Django generates its own ids but a lot my code has been using custom AutoFields which HAS been working. I added a new class today and tri...
Rivet asked 24/7, 2015 at 1:57

4

Solved

Is it possible to override values inside a Model? I am getting 'MyModel' object does not support item assignment. my_model = MyModel.objects.get(id=1) print my_model.title if my_model.is_changed:...
Fisticuffs asked 12/9, 2013 at 8:42

4

Solved

Hi here's the specific line that I added in models.py billingMonth2 = models.DateTimeField() This is what happened in makemigrations, I figured I added a non nullable field so I tried to define a...
Jabiru asked 9/6, 2016 at 14:39

12

Solved

When running: import spacy nlp = spacy.load('en') the following is printed: Warning: no model found for 'en' Only loading the 'en' tokenizer. /site-packages/spacy/data is empty with the ex...
Unchancy asked 17/4, 2017 at 20:56

3

Solved

I have to move my UI page from a .cshtml file to an .aspx file. Now I'm having a couple of compiling errors. First is that 'ViewBag' does not exist in the current context. Can I not use it in .asp...
Tartaric asked 1/3, 2016 at 0:17

3

Solved

I belive that the answer to my problem is simple, but I can't find it anywhere. Here is my predicament. I have two models: Member and MemberDetail, which are in oneToOne relation like this: class ...
Electrojet asked 14/1, 2013 at 23:29

3

Solved

Is there anyway to use the Django shell to modify a field value? I can create, delete, and query models, but I don't know how to alter existing field values. class Game(models.Model): name = mod...
Pampa asked 2/10, 2015 at 2:18

3

Solved

Which of the two is a better and efficient option to check if an instance exists. There can only be one record returned at most. 1) Use the filter option and see if it exists: x = MyObject.object...
Binucleate asked 29/9, 2015 at 15:50

4

Solved

I have a Django application that reads data from a web API and puts it in a database. Is there a way to create a new object from a mode but prevent the duplicate exception if the object already exi...
Asterism asked 7/1, 2012 at 0:27

3

Solved

Apparently a form being loaded on my template is requiring a field that isn't being passed to it. Can anyone tell me what is causing this error? Error occurs during template rendering In templa...
Taper asked 14/9, 2016 at 21:20

3

Solved

I have 2 models, Courses and Videos, for example. And Courses has many Videos. // course.js 'use strict'; module.exports = (sequelize, DataTypes) => { const Course = sequelize.define('Course'...
Hanway asked 11/2, 2018 at 13:53

7

Solved

I have been working on an offline version of my Django web app and have frequently deleted model instances for a certain ModelX. I have done this from the admin page and have experienced no issues...
Trail asked 1/1, 2015 at 22:42

6

I want individual users to be able to upload their files into a single folder (so each user has their own root folder, where they can upload their own files), but I am not sure of the best way to g...
Lowtension asked 12/12, 2015 at 12:33

3

Ive been trying to create a django project that has users and those users can add titles of books they have created. But each time I enter a book title (not on the admin page) I get this error Can...
Mazard asked 10/5, 2012 at 13:59

3

Tensorflow API has provided few pre-trained models and allowed us to trained them with any dataset. I would like to know how to initialize and use multiple graphs in one tensorflow session. I wan...
Dempster asked 7/10, 2017 at 7:9

3

Solved

I have 2 Django models : class A(models.Model): uniq_name = models.CharField(max_length=30,primary_key=True) info1 = models.CharField(max_length=30) info2 = models.CharField(max_length=30) cl...
Tirrell asked 22/8, 2011 at 9:20

3

I've got a weird problem. I am building a Flask app with SQLAlchemy. I have a file with models, namely, models.py. And I have a User model there. If I open my "views.py" and insert a string impo...
Parabolize asked 30/9, 2014 at 17:50

© 2022 - 2025 — McMap. All rights reserved.