Given two assemblies:
project.web
project.lib
The project.web assembly references project.lib which contains some business logic. A simple class from project.lib:
public class Person
{
public string Name;
}
In project.web.Controllers:
Using project.lib.models;
public class PersonController : Controller
{
Person perso...
I was bitten by this recently, and it'd be useful to know precisely what's happening to make this happen, so others avoid this mistake.
I have a model User, with a schema like so:
create_table "users", :force => true do |t|
t.string "user_name"
t.string "first_name"
t.string "last_name"
t.string "email"
t.st...
I think the best way to ask this question is with some code... can I do this? (edit: ANSWER: no)
class MyModel(models.Model):
foo = models.CharField(max_length = 20)
bar = models.CharField(max_length = 20)
def get_foo(self):
if self.bar:
return self.bar
...
I have a mysql database table called UserDegree, when i try to import back to PHP using Doctrine it generates a model name Userdegree, is there a way to solve this?
i really can't find any good doctrine documentation.
thanks!
...
Currently, I have a 6-model ruby on rails application, that I added authlogic to.
The overall setup is
User :has_many categories, topics,messages
Categories has_many topics,
Topics has_many messages
(With and the corresponding opposite belongs_to links).
When I try to access current_user.categories.find(2), no results are returned i...
Due to my little confidence with Django and my sheer horror at the thought of seriously messing up my beautiful project, I shall ask for proper advice/instructions here.
The database that my Django project is sitting on top of has been changed (a few field types have been changed) and my models are now out-of-sync. Funnily enough, my Dj...
After I've generated the interface/implementation files for entities of a model file in XCode, I've not found a way to keep any custom code (validation methods, etc...) I've added to those generated files, given the scenario where I've added an attribute to a model entity and need to re-generate the interface/implementation files. Does ...
Hi
I am trying to create a model for Article site. I want to link each article with 3-5 related articles, so what I am thinking of is creating code this way:
class Article (models.Model):
# Tiny url
url = models.CharField(max_length = 30, unique=True)
is_published = models.BooleanField()
author = models.CharField(max_le...
Hi!
I am building an article site using django.
I've added many to many relation between my articles this way:
class Article (models.Model):
# Tiny url
url = models.CharField(max_length = 30, unique=True)
is_published = models.BooleanField()
author = models.CharField(max_length = 150)
title = models.CharField(max_le...
Say I have four pair-wise M2M related models: A, B, C, D. I have created an intermediary model ABCD to establish relationships between them. If there are many duplicate column pairs in the database, is it
a normal practice to normalize the intermediary model into multiple models?
What I am concerned about are:
1. Breaking down ABCD wil...
I'm getting started on a new MVC project where there are some peculiar rules and a little bit of strangeness, and it has me puzzled. Specifically, I have access to a database containing all of my data, but it has to be handled entirely through an external web service. Don't ask me why, I don't understand the reasons. That's just how it i...
Obviously MVC promotes separation of concerns.
One thing we are struggling with is proper separation of Model from the datasource, with IDs being the main sticking point.
The interfaces that define our model call for an ID of type X
Currently the datasource is SQL server.. but what if it is an xml file for some reason and our ID is of...
Consider the following Django models:
class Host(models.Model):
# This is the hostname only
name = models.CharField(max_length=255)
class Url(models.Model):
# The complete url
url = models.CharField(max_length=255, db_index=True, unique=True)
# A foreign key identifying the host of this url
# (e.g. for http://w...
I have two models in different apps: modelA and modelB. They have a one-to-one relationship. Is there a way django can automatically create and save ModelB when modelA is saved?
class ModelA(models.Model):
name = models.CharField(max_length=30)
class ModelB(models.Model):
thing = models.OneToOneField(ModelA, primary_key=True)...
I'm having a strange problem with Zend. I have an application that works great on localhost, and can access it from outside using my IP address as well. When I move it to our staging server, it fails to load any of the classes. I am using autoloading with a modular structure. All the models are in the Default module, then the models ...
I have a User model with the usual attributes such as email and hashed_password etc. I want to write a validation that checks for the presence of an email address but only when
1) there isn't one stored in the database for this object (i.e. this is a new user signing up)
2) the user is trying to update their email address.
My current...
I'm trying to fetch all expired objects for a model in my Django application.
The model looks like this:
MyModel(models.Model):
owner = models.ForeignKey(User)
last_check = models.DateTimeField(blank=True, null=True)
interval = models.IntegerField(default=1800)
I need to fetch all matching objects where last_check is earl...
Hi,
I'd like to retrieve automatically, in a loop, the names of the models located in a specific Django app inside my project. Does someone know how to do that ?
Best Regards
Guillaume
...
I'm using Django (specifically django-admin) to be the admin panel for a site that uses PHP for client-facing features. I've been messing around making the admin look exactly the way I want and so far so good. However, I've run into a few problems that I need solving.
Here's the models that I'm working with:
class Permissions(models.Mo...
I have a model
class ServiceRequest < ActiveRecord::Base
has_many :services
accepts_nested_attributes_for :services
...
end
and the child
class Service < ActiveRecord::Base
belongs_to :service_category, :foreign_key => "wsi_web_serv_cats_uid_fk"
belongs_to :service_type, :foreign_key => "wsi_web_serv_types_uid_fk"
belon...