Hello,
Im reading a django book and it adds friends to user authentication
system by making:
(was .96)
class Friendship(models.Model):
from_friend = models.ForeignKey(
User, related_name='friend_set'
)
to_friend = models.ForeignKey(
User, related_name='to_friend_set'
)
def __st
Hello,
How do i ask django to query for a table that is already created in
the database but not part of the models.py?
the models.py is used to described the database and to create tables
with that models.py. However i already have my tables created prior to
creating the django app.
How then do
please i need some legit answer please
we have in the models forexaple
class Book():
name = InputTextField
Autho =
Please are there not more parmaters that can hel you to better define your
model. Are there no library for models?
--
You received this message because you are subscribed to t
Gretting, I have in my DataBase (Directorios) two row, Departamento and
Telefonos with the method Directorios.objects.all() I can get all objects in
my DB but I need just get all Departamento in a variable, I don't know how
get it separated.
--
Este mensaje le ha llegado mediante el servicio de
I am new to Django Python and I need bit of help
Can someone please help me with how I should structure my models, since
this is a very important part of the project I am trying to develop, I had
been teaching myself and not yet good at this stuff. I want to develop a
web project for match
Hi every one, first of all, sorry about my english, it's not so good but I'm
still learning. Well, I'm new to django and right now I come from zope (2/3)
and plone. I find django very exciting but I got a little problem, how can I
specify a Generalization/Especialization relation in django, I mean,
My question is that how to delete models in django?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this gr
Hi Folks,
How this underline code works?
models.py
class Address(models.Model):
first_name = models.CharField(max_length=256, blank=True)
last_name = models.CharField(max_length=256, blank=True)
company_name = models.CharField(max_length=256, blank=True)
street_address_1 = model
Hi Folks,
I didn't understand this code please help me to understand this code.
class AddressQueryset(models.QuerySet):
def annotate_default(self, user):
# Set default shipping/billing address pk to None
# if default shipping/billing address doesn't exist
default_ship
The way I was thinking of doing it was to have two foreignkeys named
friend1 and friend2 then when you do your list you could run
(something like)
friends = Friendship.objects.get(friend1__exact=user)
and
friends2 = Friendship.objects.get(friend2__exact=user)
Then you have a complete instance of
I see what you are saying but there are few drawbacks:
1) 2 queries instead of one.
2) When you combine into friends_all or something, you need to keep
track of which was friend vs which is user.
I was thinking more on the lines of this:
Each User has a UserProfile which i defined. In UserProfile
On 22 déc, 17:10, kev wrote:
> Hello,
> Im reading a django book and it adds friends to user authentication
> system by making:
>
> (was .96)
>
> class Friendship(models.Model):
> from_friend = models.ForeignKey(
> User, related_name='friend_set'
> )
> to_friend = models.ForeignKey(
>
Alright thanks a lot.
On Dec 22, 3:06 pm, bruno desthuilliers
wrote:
> On 22 déc, 17:10, kev wrote:
>
>
>
> > Hello,
> > Im reading a django book and it adds friends to user authentication
> > system by making:
>
> > (was .96)
>
> > class Friendship(models.Model):
> > from_friend = models.For
Hi,
I have a question that is probably very simple to answer.
class Example(models.Model):
value = models.CharField(max_length=200)
related_examples = models.ManyToMany
('self',related_name='related_example_set')
If I define a ManyToMany relationship like the one above and I want to
acce
Hey everyone,
I was wondering the best way to isolate django models so they can be used
in other python applications. I have seen the django extensions, which are
very helpful. But a 'job' is still coupled to the django environment.
Ideally I'd like to do this:
* Write so
HI,
I have used sqlalchemy for database model creation instead django
default ORM.
Now i need to use fixture to load the initial data as i run test
cases.
This is error message "DeserializationError: Invalid model
identifier:"
The models are not defined in models.py file as i am us
Hello,
in my design there are some models where I need to store certain fields in
different languages. I was wondering if anyone has done it before? I saw
some django modules that help do model translations but some of them did not
work properly.
Any best practices out there? below is my code
*m
On Mon, Jan 30, 2012 at 04:13:50AM -0800, St@n wrote:
How do i ask django to query for a table that is already created in
the database but not part of the models.py?
the models.py is used to described the database and to create tables
with that models.py. However i already have my tables created
hi michael,
Thanks for the tip. It is a huge step in my progress.
However what does this error say?
ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.
Best Regards,
Stanwin Siow
On Jan 30, 2012, at 8:37 PM, Michael Elkins wrote:
> O
On Mon, Jan 30, 2012 at 09:26:10PM +0800, Stanwin Siow wrote:
However what does this error say?
ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.
If you have a manage.py for your project, you can just run
"manage.py inspectdb" and it
Thank you so much.
This information is very useful. It work like a charm for me.
Thank you once again mike. Cheers
Best Regards,
Stanwin Siow
On Jan 30, 2012, at 9:35 PM, Michael Elkins wrote:
> On Mon, Jan 30, 2012 at 09:26:10PM +0800, Stanwin Siow wrote:
>> However what does this error sa
sorry to bother you again michael
but once my terminal creates the model classes do i have to copy it into my
app's model.py?
I wanted to be sure.
Best Regards,
Stanwin Siow
On Jan 30, 2012, at 9:35 PM, Michael Elkins wrote:
> On Mon, Jan 30, 2012 at 09:26:10PM +0800, Stanwin Siow wrote:
On Mon, Jan 30, 2012 at 09:53:18PM +0800, Stanwin Siow wrote:
but once my terminal creates the model classes do i have to copy it into my
app's model.py?
yes, you will need to copy the output to your models.py. you may
need to edit it to put the models in order so that dependencies
like for
ok got it. I read the document and it was good stuff.
Just got confused with copying pasting into my models.py. Thanks alot once
again.
:)
Best Regards,
Stanwin Siow
On Jan 30, 2012, at 10:02 PM, Michael Elkins wrote:
> On Mon, Jan 30, 2012 at 09:53:18PM +0800, Stanwin Siow wrote:
>> but o
On 2014-05-31, at 4:41 AM, ngangsia akumbo wrote:
> please i need some legit answer please
Please give one or two specific examples of functionality you need. There are
parameters for fields which can help specialize some behaviours without needing
a new model. And there are hooks to allow sp
On Sunday, June 1, 2014 7:42:13 PM UTC+1, Thomas wrote:
>
>
> On 2014-05-31, at 4:41 AM, ngangsia akumbo > wrote:
>
> please i need some legit answer please
>
>
> Please give one or two specific examples of functionality you need. There
> are parameters for fields which can help specialize some
Hi Mr. Akumbo,
The options for Model Fields that come with django in the django.db library
and are listed and explained here:
https://docs.djangoproject.com/en/dev/ref/models/fields/#model-field-types
Each corresponds to a different type of data. For example
name = models.CharField(max_length=
Thanks for this reply , am not using anybody's code. I am still studying
django and was wondering where those fields where from. Thanks for the
clarification. With time i will write my own field since am from Cameroon.
On Tuesday, June 3, 2014 2:16:37 AM UTC+1, Andrew Farrell wrote:
>
> Hi Mr. A
Hi everyone,
Given a field in a model that uses choices:
CHOICES = (
(0, "choice_0"),
(1, "choice_1")
)
foo = models.IntegerField(choices=CHOICES)
If i put a value other than 0 or 1, django will accept it. Is that possible
that we instruct Django to accept only values that are mention
simplest way is using filter() against all()
Take a look at
https://docs.djangoproject.com/en/1.9/ref/models/querysets/
Many thanks,
Serge
+380 636150445
skype: skhohlov
On Fri, May 6, 2016 at 5:27 PM, Omar wrote:
> Gretting, I have in my DataBase (Directorios) two row, Departamento and
>
There a number of designs for similar situations online; a quick Google
showed me:
* http://www.databasedev.co.uk/student_courses_data_model.html
* http://databaseanswers.org/data_models/
And I am sure there are more...
If this is your first project. I would not be too fussed about making it
Wow, Derek what a great link. Thanks very much.
Ken
On Friday, May 27, 2016 at 4:47:56 PM UTC+2, Derek wrote:
>
> There a number of designs for similar situations online; a quick Google
> showed me:
>
> * http://www.databasedev.co.uk/student_courses_data_model.html
> * http://databaseanswers.org
Hi Jos�,
As the documentation says, the best alternative right now is to set a
ForeignKey from one of the models to the other, on which you should
place the ForeignKey really depends on every specific case, normaly it
should go to the one that "cannot live with the other" (hence, the
dependent one
So, if I add a ForeignKey field to my model it simply add a
"related_model_id" column to my table, let me ask something, how django
enforce that when I add a repeated value to that field it will an error, I
mean, a foreign key value that does not exist in the original table in a one
to many relatio
On 28-May-07, at 11:24 PM, Lic. José M. Rodriguez Bacallao wrote:
> So, if I add a ForeignKey field to my model it simply add a
> "related_model_id" column to my table, let me ask something, how
> django enforce that when I add a repeated value to that field it
> will an error, I mean, a f
Hi,
My application have three main models: Restaurant, Hotel, Theather. The
fourth model is Reservation. I don't figure out to link the Reservation
with the others, because everyone needs a reservation. :)
PS. I don't want to duplicate the attributes/methods from the
Reservation.
Thanks
--~--
> On Aug 7, 2018, at 10:14, Ramandeep Kaur wrote:
>
> My question is that how to delete models in django?
Do you need to delete a model *class*, or a model *instance*?
--
-- Christophe Pettus
x...@thebuild.com
--
You received this message because you are subscribed to the Google Groups
Just delete the code in models.py and run ./manage.py makemigrations and
./manage.py migrate.
On Wednesday, 08 August, 2018 01:14 AM, Ramandeep Kaur wrote:
My question is that how to delete models in django?
--
You received this message because you are subscribed to the Google
Groups "Django
when i run this ./manage.py makemigrations it gives some error. Don't know
what to do.
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py",
line 353, in execute_from_co
The last line of the error message tells you what to do. Create a
Secret Key in your settings.py file because it says it is now empty.
On Wednesday, 08 August, 2018 02:43 PM, Ramandeep Kaur wrote:
when i run this ./manage.py makemigrations it gives some error. Don't
know what to do.
Traceba
You must have removed the secret key in settings.py file, try re-adding
that secret key, then it should work just fine
On Tuesday, August 7, 2018 at 10:17:00 AM UTC-7, Ramandeep Kaur wrote:
>
> My question is that how to delete models in django?
>
--
You received this message because you are su
I am new at Django so I don't know how to create secret key. please explain
me.
On Wed, Aug 8, 2018, 1:20 PM Gerald Brown wrote:
> The last line of the error message tells you what to do. Create a Secret
> Key in your settings.py file because it says it is now empty.
>
> On Wednesday, 08 August
@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of Ramandeep Kaur
Sent: Wednesday, August 8, 2018 8:50 AM
To: django-users@googlegroups.com
Subject: Re: django models
I am new at Django so I don't know how to create secret key. please explain me.
On Wed, Aug 8, 2018, 1:20 PM Gerald
m [mailto:django-users@
> googlegroups.com] *On Behalf Of *Ramandeep Kaur
> *Sent:* Wednesday, August 8, 2018 8:50 AM
> *To:* django-users@googlegroups.com
> *Subject:* Re: django models
>
>
>
> I am new at Django so I don't know how to create secret key. please
> expla
oject.com/en/dev/ref/settings/#secret-key>
*From:*django-users@googlegroups.com
<mailto:django-users@googlegroups.com>
[mailto:django-users@googlegroups.com
<mailto:django-users@googlegroups.com>] *On Behalf Of
*Ramandeep Kaur
*Sent:*
t; i set the secret key but its again giving me the same errror.
>>> django.core.exceptions.ImproperlyConfigured: The SECRET_KEY
>>> setting must not be empty.
>>>
>>
>> Try running the migrations command with the settings option so
>>
Hi Ramandeep,
On 08/09/2018 09:25 AM, Ramandeep Kaur wrote:
when i run my manage.py server its giving me invalid syntax error.
File "C:\Users\Dell\vms2\vms2\settings\base.py", line 18
from .base import *pip install django-generate-secret-key
^
SyntaxError: invalid
import os
import sys
from django.core.exceptions import ImproperlyConfigured
from .base import *pip install django-generate-secret-key
def get_env_variable(var_name):
try:
return os.environ[var_name]
except KeyError:
error_msg = "Set the %s environment variable" % var_name
raise ImproperlyConfig
Hi Ramandeep,
On 08/09/2018 09:57 AM, Ramandeep Kaur wrote:
hi kasper,this is my settings.py
What you have added to your settings.py doesn't make any sense. It is
not valid Python code as your Python interpreter correctly tells you. I
have no idea what you tried to achieve by writing that.
o:django-users@googlegroups.com>
<mailto:django-users@googlegroups.com
<mailto:django-users@googlegroups.com>>
[mailto:django-users@googlegroups.com
<mailto:django-users@googlegroups.com>
<mailto
sers@googlegroups.com
<mailto:django-users@googlegroups.com>>
[mailto:django-users@googlegroups.com
<mailto:django-users@googlegroups.com>
<mailto:django-users@googlegroups.com
<mailto:django-users@g
Hi Ramandeep,
On 08/10/2018 07:36 AM, Ramandeep Kaur wrote:
> strange thing is that it indicates the error in line 395 which is in
> the end where i dont write any code.
It looks like your error is not closing the call to url() here:
url('^api/v1/calls/beneficiary/(?P\w+)/$',
# BeneficiaryCall
thanks i got my mistake but now again i am getting an error.
my urls.py:
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
from rest_framework_nested import routers
from rest_auth.views import LogoutView
from locat
Hi Ramandeep,
The problem is pretty much the same as before: Mismatched parentheses, but I'll
leave to you to figure out where. It's pretty easy to spot.
Did you find an editor that helps you syntax check python code?
It'll make your life a lot easier.
Kind regards,
Kasper Laudrup
On August
hi guys, i need your help
when i run makemigrations command, i got error:
django.db.migrations.exceptions.NodeNotFoundError: Migration
task_types.0004_tasktype_training_kit dependencies reference nonexistent
parent node (u'training_kits', u'0003_auto_20160914_0722')
On Fri, Aug 10, 2018 at 8:21 P
Hi,
The error is pretty self explanatory.
There is a missing migration file:
(u'training_kits', u'0003_auto_20160914_0722')
So check your training_kits app for a migration that is called
0003_auto_20160914_0722.py.
This migration is a dependency for the migration:
0004_tasktype_training_kit.py
Hi,
I have the following models:
class UserPost(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL,
on_delete=models.CASCADE)
post = models.ForeignKey(Post, on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)
class User(AbstractUser):
MALE =
Soumen,
The function looks to compare two Address objects. The as_data() call is
custom made. I saw it documented in your other post. It removes the Primary
Key and User from the Address object. I presume this is so they can compare
the hash of one address to the hash of another.
Regards,
Joe
On
Yes,You are right as_data is custom made function inside the same
class,here is the code:
def as_data(self):
"""Return the address as a dict suitable for passing as
kwargs.Result does not contain the primary key or an associated user."""
data = model_to_dict(self,exclude=['id','u
On Tue, May 7, 2019, 12:35 PM Soumen Khatua Hi Folks,
>
> I didn't understand this code please help me to understand this code.
>
> class AddressQueryset(models.QuerySet):
> def annotate_default(self, user):
> # Set default shipping/billing address pk to None
> # if default sh
hello community members,
I am a student and interested in Django. can you please help me.
I am designing a project in Django. For that, I have my database schema
which consists of the composite primary key and composite foreign key. But
Django does not support any type of composite key.
I have tr
Hi,
Some blogs I have written,
hope someone find it useful :)
https://jishnuck.medium.com/customizing-django-models-to-facilitate-user-restricted-data-768fe8206f82
<https://jishnuck.medium.com/customizing-django-models-to-facilitate-user-restricted-data-768fe8206f82>
Jishnu C K
j
On Thu, Jan 8, 2009 at 12:06 PM, rabbi wrote:
>
> Hi,
> I have a question that is probably very simple to answer.
>
> class Example(models.Model):
>value = models.CharField(max_length=200)
>related_examples = models.ManyToMany
> ('self',related_name='related_example_set')
>
> If I define
Thanks Karen,
I actually deleted the thread soon after posting it as I came across
what you have written above.
Somehow you still managed to reply to a deleted thread though...?
Impressive
On Jan 9, 1:04 am, "Karen Tracey" wrote:
> On Thu, Jan 8, 2009 at 12:06 PM, rabbi wrote:
>
> > Hi,
> > I h
On Thu, Jan 8, 2009 at 7:08 PM, rabbi wrote:
>
> Thanks Karen,
> I actually deleted the thread soon after posting it as I came across
> what you have written above.
> Somehow you still managed to reply to a deleted thread though...?
> Impressive
>
I don't use the Google groups interface to read
ng the best way to isolate django models so they can be used
> in other python applications. I have seen the django extensions, which are
> very helpful. But a 'job' is still coupled to the django environment.
> Ideally I'd like to do this:
>
> * Write some function
You can:
1) redefine your sa models in django models.py
2) use sqlalchemy-migrate for database migration and initial data
population, I never used json for initial data with migrate
drakkan
On 26 Ago, 17:29, ajay wrote:
> HI,
> I have used sqlalchemy for database model creation instead dja
Hi all
Does anyone know how to do something like this :
class Game(models.Model):
team1 = models.ForeignKey(Teams, related_name=u'team_home')
team2 = models.ForeignKey(Teams , related_name=u'team_away')
round = models.ForeignKey(Round)
game_date = models.DateField()
def __uni
I need to expose my models to a soap view. Is there any way to avoid
rewriting a second time my model like that:
http://djangosnippets.org/snippets/1283/
and get a magic conversion of my models?
A CharField to string, an IntegerField to Integer, a Datetime to Datetime
and so on...
--
Alessandr
Hi!
I'm starting using Django and I have a little problem, may be someone
can help me. Thanks in advance.
My problem:
1. I have 2 models: Places and Photos.
2. There is a ManyToMany relation between Places and Photos through a
custom model 'PlacePhotos'
Class Photo(models.Model):
...
Class P
I've worked on/with this app
https://github.com/Anue/django-polyglot/
Hope it helps.
Rgds,
Marcos
On Fri, Jan 7, 2011 at 12:20 PM, Mo Mughrabi wrote:
> Hello,
>
> in my design there are some models where I need to store certain fields in
> different languages. I was wondering if anyone has done
This is not exactly what I need.
this library is not done as per the common best practices for i18nlizing
data.
All you have to do is declare an object (field) as an i18n field and the
engine takes care of the rest. This example you can see in java struct and
php symphony, when executing the equi
2011/1/8 Mo Mughrabi
> This is not exactly what I need.
>
> this library is not done as per the common best practices for i18nlizing
> data.
>
> All you have to do is declare an object (field) as an i18n field and the
> engine takes care of the rest. This example you can see in java struct and
>
Transmeta is much nicer and much simpler. I just installed it and I already
like the way it is designed,
I just ran into a small problem with the ./manage.py sync_transmeta_db not
working. Any idea how it can be solved?
Am just getting an unknown command,
Cheers,
On Sat, Jan 8, 2011 at 4:23 P
2011/1/8 Mo Mughrabi
> Transmeta is much nicer and much simpler. I just installed it and I already
> like the way it is designed,
>
> I just ran into a small problem with the ./manage.py sync_transmeta_db not
> working. Any idea how it can be solved?
>
> Am just getting an unknown command,
>
>
>
Yes, I did that part,
How can I navigate transmeta source for that function? I used python
setup.py install,
Sent from my iPhone
On Jan 9, 2011, at 1:12 AM, Alessandro Pasotti wrote:
2011/1/8 Mo Mughrabi
> Transmeta is much nicer and much simpler. I just installed it and I already
> like t
Hello folks,
I'm a long time Python developer that is new to Django. I have a few
questions about the role of inheritance in the models for an app.
As I build my models, I'm finding at least somewhat of a need to start
doing some inheritance, and if not a need--at least a design-related
desire t
Hi all, I am a noob and I am trying to set up a django project. I need some
help to model everything.
Essentially I am building up a soccer player's catalog. What I have is a
generic player that own informations like name, surname, nationality, age
and so on. Furthermore every player has also i
Hello everybody,
I am writing my first web application with Django.
I want to create a web of registration for many subjects.
However, each subject require different set of details to be supplied
so I don't know which models should I have in the database.
Currently I have two models:
Registration
how can I generate SQL from one specific model ?
example:
"User.getSchemeSQLGenerated()" -> is equals -> $ python manage.py sql
User
exists?
thank you!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and
The choices don't enforce any default validation. But if you are populating
the data from a http call then use ModelForm they show the invalid_choice
error message on entering value other than defined choices
On Mon, Mar 21, 2016 at 1:59 PM, Amine Yaiche wrote:
> Hi everyone,
>
> Given a field i
On 21/03/2016 7:29 PM, Amine Yaiche wrote:
Hi everyone,
Given a field in a model that uses choices:
|
CHOICES =(
  (0,"choice_0"),
  (1,"choice_1")
)
foo =models.IntegerField(choices=CHOICES)
|
If i put a value other than 0 or 1, django will accept it. Is that
possible that we instruct
I'm a beginner, but I would do like this:
class Reservation(models.Model):
properties=model.CharField(maxlength=7,primary_key=True)
class Restaurant(models.Model):
name=models.CharField(maxlength=30,primary_key=True)
reservations=models.ForeignKey(Reservation)
class Theater(models.M
As soon as you need additional reservation-related behaviour (is this
timeslot still available?, etc.), this will break the OP's requirement
for no duplication. You'd need that code in all classes.
The OP's problem is a classic example for model inheritance
(Reservation would relate to the common
Hello django users,
A few weeks ago I started developing an eLearning-application and chose
Django as a framework. There are several reasons that made me use
django, although I checked out Turbogears, Cherrypy and webpy. (By the
way: What made me use django was the admin interface)
Important: Dj
I have an outside python function which reads a csv from web and fetch
certain data in forms of tuple. So that i can use that tuple in my python
models for choices in one of the fields. Till now i am running the function
independently and copying the returned tuple to my models.py for choices.
Hi Everybody,
I have just created a package for bi-directional cryptography in Django
Models.
It has following features:-
1. *Supports data **retrieval*
2. *Supports custom query*
3. *Supports Q() queries*
4. *Supports Ordering data through python functions*
5. *Supports Sorting
Currently, I am working on an inventory management system and I have got
some UML diagrams and want to convert those uml diagrams into django
models. So can anyone guide me on how to convert those UML diagrams into
django models?
an example is below of uml diagram
--
You received this message
i am working on a LMS project, so if a tutor signed up and he can upload
his tutorials from his account.
And when rendering to template each user should have their list of
tutorials. as well as he will upload new tutorials.
How to design it dynamically. Please guide me.
Thank you in advance.
--
Use SQL Alchemy ORM , Django ORM has foreign key policy , if u can solve it
using that it's on u ..
On Fri, Jun 19, 2020, 01:23 MANISH YADAV wrote:
> hello community members,
> I am a student and interested in Django. can you please help me.
> I am designing a project in Django. For that, I have
But if I use SQL Alchemy, can I use django admin panel. Because need that.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups
Is there any way to create model for the database using form input from the
end user ?
Scenario: There is authority for the particular company. Authority wants to
create HTML form schema according to company which he's affiliated with.
There are many Authorities with diffrent companies they're
I have a model something like this:
class CandidateEmailMessage(models.Model):
from_email = models.EmailField(max_length=100)
to_email = models.EmailField(max_length=100)
body = models.TextField()
objects = CandidateEmailMessageManager()
As the django documentation says blank=Fals
try this:
return Teams.objects.get(self.team1).name
nikosk pisze:
> Hi all
>
> Does anyone know how to do something like this :
>
> class Game(models.Model):
> team1 = models.ForeignKey(Teams, related_name=u'team_home')
> team2 = models.ForeignKey(Teams , related_name=u'team_away')
>
ups i think
return Teams.objects.get(self.team1_id).name
will be better :)
Sebastian Bauer pisze:
> try this:
>
> return Teams.objects.get(self.team1).name
>
>
> nikosk pisze:
>
>> Hi all
>>
>> Does anyone know how to do something like this :
>>
>> class Game(models.Model):
>> team1 = mo
Hmm..
def __unicode__( self ):
return "%s" % self.team1 # if Teams model has its own __unicode__
method
On Jun 7, 5:34 pm, nikosk <[EMAIL PROTECTED]> wrote:
> Hi all
>
> Does anyone know how to do something like this :
>
> class Game(models.Model):
> team1 = models.ForeignKey(Teams, relat
See the notes about "commit = False" and its effects on many-to-many tables.
http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/#the-save-method
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email
> If I have my abstract super classes inherit models.Model, things
> technically can work. However, I arrive with a rather overly complex
> SQL design generated from them (like needless tables for abstract
> super classes).
>
> On the other hand, if I have my abstract super classes NOT inherit
>
> When you define an abstract model, you have to define the ``abstract''
> property inside its
> Meta.http://docs.djangoproject.com/en/1.2/ref/models/options/#abstracthttp://docs.djangoproject.com/en/1.2/topics/db/models/#abstract-base-...
>
> That way your abstract class can inherit models.Model
Hey guys,
I am just wondering if there is a time duration field in django models.
what I want to do is a field that takes a time duration in days, hours,
mins, seconds and store it into the database.
--
Mohamed Sayed Ghoneim
--
You received this message because you are subscribed to the
1 - 100 of 437 matches
Mail list logo