Django models

2008-12-22 Thread kev
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

Django models

2012-01-30 Thread St@n
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

django models

2014-05-31 Thread ngangsia akumbo
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

Django Models

2016-05-06 Thread Omar
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

Django Models

2016-05-26 Thread Ken Edem
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

django models

2007-05-28 Thread Lic. José M. Rodriguez Bacallao
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,

django models

2018-08-07 Thread Ramandeep Kaur
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

django models

2019-05-06 Thread Soumen Khatua
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

django models

2019-05-06 Thread 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 shipping/billing address doesn't exist default_ship

Re: Django models

2008-12-22 Thread Jason Sidabras
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

Re: Django models

2008-12-22 Thread kev
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

Re: Django models

2008-12-22 Thread bruno desthuilliers
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( >

Re: Django models

2008-12-22 Thread kev
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

Django Models + ManyToMany

2009-01-08 Thread rabbi
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

Isolating Django Models

2009-06-25 Thread Blaine Booher
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

django models/ sqlalchemy

2009-08-26 Thread ajay
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

i18n django models

2011-01-07 Thread Mo Mughrabi
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

Re: Django models

2012-01-30 Thread Michael Elkins
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

Re: Django models

2012-01-30 Thread Stanwin Siow
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

Re: Django models

2012-01-30 Thread Michael Elkins
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

Re: Django models

2012-01-30 Thread Stanwin Siow
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

Re: Django models

2012-01-30 Thread Stanwin Siow
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:

Re: Django models

2012-01-30 Thread Michael Elkins
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

Re: Django models

2012-01-30 Thread Stanwin Siow
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

Re: django models

2014-06-01 Thread Tom Lockhart
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

Re: django models

2014-06-02 Thread ngangsia akumbo
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

Re: django models

2014-06-02 Thread Andrew Farrell
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=

Re: django models

2014-06-04 Thread ngangsia akumbo
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

Django models choices

2016-03-21 Thread Amine Yaiche
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

Re: Django Models

2016-05-06 Thread Sergiy Khohlov
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 >

Re: Django Models

2016-05-27 Thread Derek
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

Re: Django Models

2016-05-27 Thread Ken Edem
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

Re: django models

2007-05-28 Thread Marc Fargas
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

Re: django models

2007-05-28 Thread Lic. José M. Rodriguez Bacallao
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

Re: django models

2007-05-28 Thread Kenneth Gonsalves
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

Django models question

2006-06-01 Thread Cornel Nitu
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 --~--

Re: django models

2018-08-07 Thread Christophe Pettus
> 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

Re: django models

2018-08-07 Thread Gerald Brown
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

Re: django models

2018-08-07 Thread Ramandeep Kaur
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

Re: django models

2018-08-08 Thread Gerald Brown
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

Re: django models

2018-08-08 Thread Balasriharsha Cheeday
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

Re: django models

2018-08-08 Thread Ramandeep Kaur
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

RE: django models

2018-08-08 Thread Matthew Pava
@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

Re: django models

2018-08-08 Thread Ramandeep Kaur
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

Re: django models

2018-08-08 Thread Mike Dewhirst
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:*

Re: django models

2018-08-09 Thread Ramandeep Kaur
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 >>

Re: django models

2018-08-09 Thread Kasper Laudrup
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

Re: django models

2018-08-09 Thread Ramandeep Kaur
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

Re: django models

2018-08-09 Thread Kasper Laudrup
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.

Re: django models

2018-08-09 Thread Mike Dewhirst
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

Re: django models

2018-08-09 Thread Mike Dewhirst
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

Re: django models

2018-08-10 Thread Kasper Laudrup
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

Re: django models

2018-08-10 Thread Ramandeep Kaur
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

Re: django models

2018-08-10 Thread Kasper Laudrup
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

Re: django models

2018-08-13 Thread Ramandeep Kaur
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

Re: django models

2018-08-14 Thread Andréas Kühne
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

Django Models Relationship

2017-09-12 Thread james lin
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 =

Re: django models

2019-05-06 Thread Skyisblue
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

Re: django models

2019-05-06 Thread Soumen Khatua
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

Re: django models

2019-05-07 Thread sachinbg sachin
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

Regarding Django models.

2020-06-18 Thread MANISH YADAV
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

Customise Django Models

2022-09-11 Thread Jishnu C K
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

Re: Django Models + ManyToMany

2009-01-08 Thread Karen Tracey
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

Re: Django Models + ManyToMany

2009-01-08 Thread rabbi
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

Re: Django Models + ManyToMany

2009-01-08 Thread Karen Tracey
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

Re: Isolating Django Models

2009-06-26 Thread Blaine Booher
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

Re: django models/ sqlalchemy

2009-08-26 Thread drakkan
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

Django models - newbie question

2008-06-07 Thread nikosk
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

Django models to SOAP

2010-08-24 Thread Alessandro Ronchi
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

Quotas for Django models

2010-05-08 Thread x13
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

Re: i18n django models

2011-01-07 Thread Marcos Moyano
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

Re: i18n django models

2011-01-08 Thread 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 php symphony, when executing the equi

Re: i18n django models

2011-01-08 Thread Alessandro Pasotti
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 >

Re: i18n django models

2011-01-08 Thread 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, Cheers, On Sat, Jan 8, 2011 at 4:23 P

Re: i18n django models

2011-01-08 Thread Alessandro Pasotti
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, > > >

Re: i18n django models

2011-01-08 Thread Mo J. Al-Mughrabi
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

Django models and inheritance

2011-03-11 Thread Mark J. Nenadov
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

django models noob help

2012-06-16 Thread ledzgio
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

Django models design question

2011-10-14 Thread omerd
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

Django Models SQL generated ?

2013-05-27 Thread Josueh
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

Re: Django models choices

2016-03-21 Thread Amandeep Singh
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

Re: Django models choices

2016-03-21 Thread Mike Dewhirst
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

Re: Django models question

2006-06-02 Thread Guillermo Fernandez Castellanos
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

Re: Django models question

2006-06-04 Thread [EMAIL PROTECTED]
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

Django Models, DRY, Scalability

2006-08-20 Thread bayerj
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

Help with Django Models

2017-12-13 Thread Udit Vashisht
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.

Cryptography in Django Models

2020-12-09 Thread Shahprogrammer
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

UML to Django models

2021-08-25 Thread DJANGO DEVELOPER
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

Django models for user

2020-05-09 Thread Irfan Khan
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. --

Re: Regarding Django models.

2020-06-18 Thread DOT. py
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

Re: Regarding Django models.

2020-06-18 Thread MANISH YADAV
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

Creating Django models dynamically

2019-12-29 Thread Meet Vasani
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

Django Models blank=False Problem

2009-02-19 Thread madhav
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

Re: Django models - newbie question

2008-06-07 Thread Sebastian Bauer
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') >

Re: Django models - newbie question

2008-06-07 Thread Sebastian Bauer
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

Re: Django models - newbie question

2008-06-07 Thread Alex Koshelev
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

Re: Quotas for Django models

2010-05-09 Thread Shawn Milochik
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

Re: Django models and inheritance

2011-03-11 Thread Michal Petrucha
> 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 >

Re: Django models and inheritance

2011-03-12 Thread Mark J. Nenadov
> 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

Time duration in django models

2011-08-09 Thread Mohamed Ghoneim
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   2   3   4   5   >