Re: how to create table from model

2020-08-05 Thread Yemin Sajid
Can you share your settings.py file? I think the app that you have created
is not listed under the INSTALLED_APPS section there.

On Wed, Aug 5, 2020 at 5:46 PM atul anand  wrote:

> Hi All,
>
> I am new to Django. I want to create tables by using models.
> I have tried to follow this link:
> https://docs.djangoproject.com/en/3.0/topics/db/models/.
>
> models.py
> from django.db import models
>
>
> # Create your models here.
> class Person(models.Model):
> id = models.AutoField(primary_key=True)
> first_name = models.CharField(max_length=30)
> last_name = models.CharField(max_length=30)
> I have registered the app and provided connection details of the DB.
>
> But when I tried to run makemigrations and migrate, it's not identifying
> the changes.
> python manage.py makemigrations
> *No changes detected*
>
> python manage.py migrate
> *Operations to perform:*
> *  Apply all migrations: admin, auth, contenttypes, sessions*
> *Running migrations:*
> *  No migrations to apply.*
>
> *any help would be appriciated.*
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e8f15897-5729-4b51-9ab3-bec0c159dcfco%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFzgvyHPmCjpHZDfX0oZO8-hK-Rneet%3DOZQyUQTHU%3D6ZBiTvPw%40mail.gmail.com.


how to create table from model

2020-08-05 Thread atul anand
Hi All,

I am new to Django. I want to create tables by using models.
I have tried to follow this link: 
https://docs.djangoproject.com/en/3.0/topics/db/models/.

models.py
from django.db import models


# Create your models here.
class Person(models.Model):
id = models.AutoField(primary_key=True)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
I have registered the app and provided connection details of the DB.

But when I tried to run makemigrations and migrate, it's not identifying 
the changes.
python manage.py makemigrations
*No changes detected*

python manage.py migrate
*Operations to perform:*
*  Apply all migrations: admin, auth, contenttypes, sessions*
*Running migrations:*
*  No migrations to apply.*

*any help would be appriciated.*

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e8f15897-5729-4b51-9ab3-bec0c159dcfco%40googlegroups.com.


How to create "form" from "model" with 2 foreign keys?

2020-01-03 Thread strang
Context: I'm new to Django. I've just completed the tutorial on the Docs 
page. I'm trying to make a coffee ordering application. Basically a person 
has to enter his details and select coffee along with number of cups.
Now a person may select 2 or 3 of the same type of coffee, or he may select 
multiple coffee types.

I've attached my models.py file. How do i make a form for this mode?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/444aa5a1-5020-4970-8b7e-c5f2225a760c%40googlegroups.com.
'''
REFERENCE: https://stackoverflow.com/questions/53091688/modeling-product-orders-in-django
'''


from django.db import models
from django.utils import timezone
from django.core.validators import RegexValidator


import datetime


# Create your models here.
class Customer(models.Model):
name = models.CharField(max_length=50)

phone_regex = RegexValidator(regex='^\+?1?\d{9,15}$',  message="Phone number must be entered in the format: '+9'. Up to 15 digits allowed.")
phone_number = models.CharField(validators=[phone_regex], max_length=17, blank=False)

email = models.EmailField(max_length=254)
dob = models.DateField(blank=True)

def __str__(self):
return self.name


class Product(models.Model):
item_name = models.CharField(max_length=255)
price = models.PositiveIntegerField()

def __str__(self):
return self.item_name


class OrderDetail(models.Model):
order = models.ForeignKey(Customer, on_delete=models.CASCADE)
product = models.ForeignKey(Product, on_delete=models.CASCADE)
quantity = models.PositiveIntegerField(default=1)
order_date_time = models.DateTimeField()

def __str__(self):
return self.order.name


Re: How to create a django model for a resume/CV app

2016-11-21 Thread ludovic coues
I would be tempted to hook the admin site directly into the website.
Django's admin let you specify each form template so the look isn't an
issue. Putting a specific view from the admin at a specific url is a
bit more complex. Should be doable but maybe not easily or cleanly.

Short of doing that, django won't help you a lot. You can observe how
the admin is handling inline but it certainly involve a lot of
javascript that is specific to the admin.

2016-11-20 21:56 GMT+01:00 'ron' via Django users
:
> Thanks! I know it's been covered in the official django poll tutorial.
>
> But how do I let users to do that without django admin? I probably will have
> an URL like: example.com/cv/create and only logged in users will be able to
> create their cv.
> I am not sure how to set up the view so that users can create new cv.
>
> I know class based view. But in my cv app, each user can have one CV, each
> CV can have one or more precious job and each CV can have one or more
> education entries.
> So I can't actually use class based view here because a CV needs more than
> one class, right?
>
> My questions are:
> 1) Is this the right set up in terms of the relationship for a CV app?
> 2) How can I let users create a CV with multiple related objects without
> user django admin.
>
> This is my models.py. Is this the right way to set up the relationship of a
> CV??
>
>> class Resume(models.Model):
>> about = models.TextField(max_length=500)
>> applicant = models.ForeignKey(User)
>>
>>
>> class Education(models.Model):
>> resume = models.ForeignKey(Resume)
>> school = models.CharField(max_length=100)
>> course = models.CharField(max_length=100)
>> start_date = models.DateField(blank=True, null=True)
>> end_date = models.DateField(blank=True, null=True)
>>
>> class Job(models.Model):
>> resume = models.ForeignKey(Resume)
>> title = models.CharField(max_length=100)
>> company = models.CharField(max_length=100)
>> start_date = models.DateField(blank=True, null=True)
>> end_date = models.DateField(blank=True, null=True)
>
>
>
> On Sunday, 6 November 2016 22:05:16 UTC+1, ludovic coues wrote:
>>
>> If you are using the default django admin, you can use inline model
>> admins [1]. The django's tutorial covert this point with polls'
>> questions having many possible choice in part 7 [2]
>>
>> [1]
>> https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#inlinemodeladmin-objects
>> [2]
>> https://docs.djangoproject.com/en/1.10/intro/tutorial07/#adding-related-objects
>>
>> 2016-11-06 15:11 GMT+01:00 ronronald97 via Django users
>> :
>> > Hi,
>> >
>> > I am rather new to django and not sure how to set up the relationship
>> > for
>> > all the fields of a resume app.
>> >
>> > Let's say each user can have 1 or more resume. In each Resume, there is
>> > a
>> > introduction/about, 1 or more education entries and 1 or more previous
>> > job
>> > entries.
>> > Is this correct?
>> >
>> > class Resume(models.Model):
>> > about = models.TextField(max_length=500)
>> > applicant = models.ForeignKey(User)
>> >
>> >
>> > class Education(models.Model):
>> > school = models.CharField(max_length=100)
>> > course = models.CharField(max_length=100)
>> > Resume = models.ForeignKey(Resume)
>> > start_date = models.DateField(blank=True, null=True)
>> > end_date = models.DateField(blank=True, null=True)
>> >
>> > class Job(models.Model):
>> > title = models.CharField(max_length=100)
>> > company = models.CharField(max_length=100)
>> > Resume = models.ForeignKey(Resume)
>> > start_date = models.DateField(blank=True, null=True)
>> > end_date = models.DateField(blank=True, null=True)
>> >
>> > What should I do in the view or form to let user to add more education
>> > or
>> > job fields?
>> > Or I could only set it up certain amount of entries for each model, for
>> > example 3 eduction entries and 5 previous jobs.
>> > Is there anyway I can do that dynamically so I can just start with 1 for
>> > each model and let the user add more if they need to?
>> >
>> > Thanks
>> >
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/django-users/c23fc997-b723-4987-9be7-eb352f88814b%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>>
>> Cordialement, Coues Ludovic
>> +336 148 743 42
>>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and 

Re: How to create a django model for a resume/CV app

2016-11-20 Thread 'ron' via Django users
Thanks! I know it's been covered in the official django poll tutorial.

But how do I let users to do that without django admin? I probably will 
have an URL like: example.com/cv/create and only logged in users will be 
able to create their cv.
I am not sure how to set up the view so that users can create new cv.

I know class based view. But in my cv app, each user can have one CV, each 
CV can have one or more precious job and each CV can have one or more 
education entries.
So I can't actually use class based view here because a CV needs more than 
one class, right?

My questions are:
1) Is this the right set up in terms of the relationship for a CV app?
2) How can I let users create a CV with multiple related objects without 
user django admin.

This is my models.py. Is this the right way to set up the relationship of a 
CV??

> class Resume(models.Model): 
> about = models.TextField(max_length=500) 
> applicant = models.ForeignKey(User) 
> 
> 
> class Education(models.Model): 
> resume = models.ForeignKey(Resume) 
> school = models.CharField(max_length=100) 
> course = models.CharField(max_length=100) 
> start_date = models.DateField(blank=True, null=True) 
> end_date = models.DateField(blank=True, null=True) 
> 
> class Job(models.Model): 
> resume = models.ForeignKey(Resume) 
> title = models.CharField(max_length=100) 
> company = models.CharField(max_length=100) 
> start_date = models.DateField(blank=True, null=True) 
> end_date = models.DateField(blank=True, null=True) 



On Sunday, 6 November 2016 22:05:16 UTC+1, ludovic coues wrote:
>
> If you are using the default django admin, you can use inline model 
> admins [1]. The django's tutorial covert this point with polls' 
> questions having many possible choice in part 7 [2] 
>
> [1] 
> https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#inlinemodeladmin-objects
>  
> [2] 
> https://docs.djangoproject.com/en/1.10/intro/tutorial07/#adding-related-objects
>  
>
> 2016-11-06 15:11 GMT+01:00 ronronald97 via Django users 
> : 
> > Hi, 
> > 
> > I am rather new to django and not sure how to set up the relationship 
> for 
> > all the fields of a resume app. 
> > 
> > Let's say each user can have 1 or more resume. In each Resume, there is 
> a 
> > introduction/about, 1 or more education entries and 1 or more previous 
> job 
> > entries. 
> > Is this correct? 
> > 
> > class Resume(models.Model): 
> > about = models.TextField(max_length=500) 
> > applicant = models.ForeignKey(User) 
> > 
> > 
> > class Education(models.Model): 
> > school = models.CharField(max_length=100) 
> > course = models.CharField(max_length=100) 
> > Resume = models.ForeignKey(Resume) 
> > start_date = models.DateField(blank=True, null=True) 
> > end_date = models.DateField(blank=True, null=True) 
> > 
> > class Job(models.Model): 
> > title = models.CharField(max_length=100) 
> > company = models.CharField(max_length=100) 
> > Resume = models.ForeignKey(Resume) 
> > start_date = models.DateField(blank=True, null=True) 
> > end_date = models.DateField(blank=True, null=True) 
> > 
> > What should I do in the view or form to let user to add more education 
> or 
> > job fields? 
> > Or I could only set it up certain amount of entries for each model, for 
> > example 3 eduction entries and 5 previous jobs. 
> > Is there anyway I can do that dynamically so I can just start with 1 for 
> > each model and let the user add more if they need to? 
> > 
> > Thanks 
> > 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/c23fc997-b723-4987-9be7-eb352f88814b%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
>
> Cordialement, Coues Ludovic 
> +336 148 743 42 
>
>
 

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/12e86877-ea02-4a8c-b05f-874ef43746b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create a django model for a resume/CV app

2016-11-06 Thread ludovic coues
If you are using the default django admin, you can use inline model
admins [1]. The django's tutorial covert this point with polls'
questions having many possible choice in part 7 [2]

[1] 
https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#inlinemodeladmin-objects
[2] 
https://docs.djangoproject.com/en/1.10/intro/tutorial07/#adding-related-objects

2016-11-06 15:11 GMT+01:00 ronronald97 via Django users
:
> Hi,
>
> I am rather new to django and not sure how to set up the relationship for
> all the fields of a resume app.
>
> Let's say each user can have 1 or more resume. In each Resume, there is a
> introduction/about, 1 or more education entries and 1 or more previous job
> entries.
> Is this correct?
>
> class Resume(models.Model):
> about = models.TextField(max_length=500)
> applicant = models.ForeignKey(User)
>
>
> class Education(models.Model):
> school = models.CharField(max_length=100)
> course = models.CharField(max_length=100)
> Resume = models.ForeignKey(Resume)
> start_date = models.DateField(blank=True, null=True)
> end_date = models.DateField(blank=True, null=True)
>
> class Job(models.Model):
> title = models.CharField(max_length=100)
> company = models.CharField(max_length=100)
> Resume = models.ForeignKey(Resume)
> start_date = models.DateField(blank=True, null=True)
> end_date = models.DateField(blank=True, null=True)
>
> What should I do in the view or form to let user to add more education or
> job fields?
> Or I could only set it up certain amount of entries for each model, for
> example 3 eduction entries and 5 previous jobs.
> Is there anyway I can do that dynamically so I can just start with 1 for
> each model and let the user add more if they need to?
>
> Thanks
>
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c23fc997-b723-4987-9be7-eb352f88814b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTaP3P2d5syLtaR%2Bj%2BeGXs4PW%2BWBOUXcA4ws%2BQuozOonww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to create a django model for a resume/CV app

2016-11-06 Thread ronronald97 via Django users
Hi,

I am rather new to django and not sure how to set up the relationship for 
all the fields of a resume app.

Let's say each user can have 1 or more resume. In each Resume, there is a 
introduction/about, 1 or more education entries and 1 or more previous job 
entries.
Is this correct?

class Resume(models.Model):
about = models.TextField(max_length=500)
applicant = models.ForeignKey(User)


class Education(models.Model):
school = models.CharField(max_length=100)
course = models.CharField(max_length=100)
Resume = models.ForeignKey(Resume)
start_date = models.DateField(blank=True, null=True)
end_date = models.DateField(blank=True, null=True)

class Job(models.Model):
title = models.CharField(max_length=100)
company = models.CharField(max_length=100)
Resume = models.ForeignKey(Resume)
start_date = models.DateField(blank=True, null=True)
end_date = models.DateField(blank=True, null=True)

What should I do in the view or form to let user to add more education or 
job fields?
Or I could only set it up certain amount of entries for each model, for 
example 3 eduction entries and 5 previous jobs.
Is there anyway I can do that dynamically so I can just start with 1 for 
each model and let the user add more if they need to?

Thanks


-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c23fc997-b723-4987-9be7-eb352f88814b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: can any on help me how to create a sample model project.

2009-12-16 Thread Kenneth Gonsalves
On Wednesday 16 Dec 2009 1:53:10 pm Justin Steward wrote:
> Not sure on the name of the corresponding red hat package.
> 

yum search *mysql*

-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-16 Thread Justin Steward
On Wed, Dec 16, 2009 at 5:53 AM, chiranjeevi muttoju
 wrote:
> hi as i said that i had installed the mysql in other machine. when i
> installing the python-mysql connector using the command
> python setup.py build
>

At a wild guess, not knowing what you've got installed already, sounds
like you don't have the mysql client libraries installed.

In ubuntu that would be sudo apt-get install libmysqlclient15-dev

Not sure on the name of the corresponding red hat package.

~Justin

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread chiranjeevi muttoju
hi as i said that i had installed the mysql in other machine. when i
installing the python-mysql connector using the command
python setup.py build

it giving the fallowing error:
[r...@scci01 MySQL-python-1.2.3c1]# python setup.py build
sh: mysql_config: command not found
Traceback (most recent call last):
  File "setup.py", line 15, in 
metadata, options = get_config()
  File "/root/chiru/MySQL-python-1.2.3c1/setup_posix.py", line 43, in
get_config
libs = mysql_config("libs_r")
  File "/root/chiru/MySQL-python-1.2.3c1/setup_posix.py", line 24, in
mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found


what is the modifications to setup_posix.py file, plz help me..
thanku.

On Tue, Dec 15, 2009 at 8:31 PM, Simon Brunning wrote:

> 2009/12/15 chiranjeevi muttoju :
> > ImportError: No module named setuptools
>
> Seems pretty self-evident to me. Try installing setuptools first.
>
> --
> Cheers,
> Simon B.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
▒▒�...@g@d...@◄▒▒

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread Simon Brunning
2009/12/15 chiranjeevi muttoju :
> ImportError: No module named setuptools

Seems pretty self-evident to me. Try installing setuptools first.

-- 
Cheers,
Simon B.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread chiranjeevi muttoju
the content of that file is..
[options]
# embedded: link against the embedded server library
# threadsafe: use the threadsafe client
# static: link against a static library (probably required for embedded)

embedded = False
threadsafe = True
static = False

# The path to mysql_config.
# Only use this if mysql_config is not on your PATH, or you have some weird
# setup that requires it.
#mysql_config = /usr/local/bin/mysql_config

# The Windows registry key for MySQL.
# This has to be set for Windows builds to work.
# Only change this if you have a different version.
registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0


plz help me..

On Tue, Dec 15, 2009 at 8:08 PM, chiranjeevi muttoju
wrote:

>   $ tar xfz MySQL-python-1.2.1.tar.gz
>   $ cd MySQL-python-1.2.1
>   $ # edit site.cfg if necessary
>   $ python setup.py build
>   $ sudo python setup.py install # or su first
>
> this is the installation process specified.. I think the 3rd step is for
> mysql settings.. i instaled the my sql in other mechine of ip x.x.x.x. then
> how can i change that file..
>
> if i run 4th command directly its not working it gives the error..
>
>
> Traceback (most recent call last):
>   File "setup.py", line 5, in 
> from setuptools import setup, Extension
> ImportError: No module named setuptools
>
>
>
> On Tue, Dec 15, 2009 at 8:00 PM, Simon Brunning 
> wrote:
>
>> 2009/12/15 chiranjeevi muttoju :
>> > hey i installed django on one machine, and sql in another machine.. in
>> which
>> > mechine i need to install the sql connector.
>>
>> The Django machine.
>>
>> --
>> Cheers,
>> Simon B.
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>>
>
>
> --
> ▒▒�...@g@d...@◄▒▒
>



-- 
▒▒�...@g@d...@◄▒▒

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread chiranjeevi muttoju
  $ tar xfz MySQL-python-1.2.1.tar.gz
  $ cd MySQL-python-1.2.1
  $ # edit site.cfg if necessary
  $ python setup.py build
  $ sudo python setup.py install # or su first

this is the installation process specified.. I think the 3rd step is for
mysql settings.. i instaled the my sql in other mechine of ip x.x.x.x. then
how can i change that file..

if i run 4th command directly its not working it gives the error..

Traceback (most recent call last):
  File "setup.py", line 5, in 
from setuptools import setup, Extension
ImportError: No module named setuptools


On Tue, Dec 15, 2009 at 8:00 PM, Simon Brunning wrote:

> 2009/12/15 chiranjeevi muttoju :
> > hey i installed django on one machine, and sql in another machine.. in
> which
> > mechine i need to install the sql connector.
>
> The Django machine.
>
> --
> Cheers,
> Simon B.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
▒▒�...@g@d...@◄▒▒

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread Simon Brunning
2009/12/15 chiranjeevi muttoju :
> hey i installed django on one machine, and sql in another machine.. in which
> mechine i need to install the sql connector.

The Django machine.

-- 
Cheers,
Simon B.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread chiranjeevi muttoju
hey i installed django on one machine, and sql in another machine.. in which
mechine i need to install the sql connector.

On Tue, Dec 15, 2009 at 7:51 PM, Simon Brunning wrote:

> 2009/12/15 chiranjeevi muttoju :
> > i've downloaded the mysql connector "MySQL-python-1.2.3c1.tar.gz'
> > could u please tellme how to instal that in linux..
>
> If you untar it, you should find installation instructions in the README.
>
> --
> Cheers,
> Simon B.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
▒▒�...@g@d...@◄▒▒

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread Simon Brunning
2009/12/15 chiranjeevi muttoju :
> i've downloaded the mysql connector "MySQL-python-1.2.3c1.tar.gz'
> could u please tellme how to instal that in linux..

If you untar it, you should find installation instructions in the README.

-- 
Cheers,
Simon B.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread chiranjeevi muttoju
i've downloaded the mysql connector "MySQL-python-1.2.3c1.tar.gz'
could u please tellme how to instal that in linux..

On Tue, Dec 15, 2009 at 7:36 PM, Simon Brunning wrote:

> 2009/12/15 chiranjeevi muttoju :
> > i cont able to understand how to modify the settings for mysql..
> > when i run the cammand 'python manage.py shell'
> > it gives the error no modulr fing for No module named MySQLdb
>
> You've not installed the database module that Python needs to talk to
> MySql - see .
>
> --
> Cheers,
> Simon B.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
▒▒�...@g@d...@◄▒▒

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread Simon Brunning
2009/12/15 chiranjeevi muttoju :
> i cont able to understand how to modify the settings for mysql..
> when i run the cammand 'python manage.py shell'
> it gives the error no modulr fing for No module named MySQLdb

You've not installed the database module that Python needs to talk to
MySql - see .

-- 
Cheers,
Simon B.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread chiranjeevi muttoju
i cont able to understand how to modify the settings for mysql..
when i run the cammand 'python manage.py shell'
it gives the error no modulr fing for No module named MySQLdb

the actual error is::
---
[r...@scci01 book]# python manage.py shell
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File
"/usr/local/lib/python2.6/site-packages/django/core/management/__init__.py",
line 362, in execute_manager
utility.execute()
  File
"/usr/local/lib/python2.6/site-packages/django/core/management/__init__.py",
line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/usr/local/lib/python2.6/site-packages/django/core/management/base.py",
line 195, in run_from_argv
self.execute(*args, **options.__dict__)
  File
"/usr/local/lib/python2.6/site-packages/django/core/management/base.py",
line 222, in execute
output = self.handle(*args, **options)
  File
"/usr/local/lib/python2.6/site-packages/django/core/management/base.py",
line 351, in handle
return self.handle_noargs(**options)
  File
"/usr/local/lib/python2.6/site-packages/django/core/management/commands/shell.py",
line 17, in handle_noargs
from django.db.models.loading import get_models
  File "/usr/local/lib/python2.6/site-packages/django/db/__init__.py", line
41, in 
backend = load_backend(settings.DATABASE_ENGINE)
  File "/usr/local/lib/python2.6/site-packages/django/db/__init__.py", line
17, in load_backend
return import_module('.base', 'django.db.backends.%s' % backend_name)
  File "/usr/local/lib/python2.6/site-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
  File
"/usr/local/lib/python2.6/site-packages/django/db/backends/mysql/base.py",
line 13, in 
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module:
No module named MySQLdb


---

On Tue, Dec 15, 2009 at 7:19 PM, Simon Brunning wrote:

> 2009/12/15 'chiru'tha :
> > hey i've seen dat.. bt i cont able to create a new one.. i'm doing
> > some mistake while setting settings. If u createed a project.. plz
> > tell me the process in detail.. plz.
> > thanku..
>
> Sorry, but that *is* the process.
>
> Why don't you tell us what went wrong? Perhaps we can help.
>
> --
> Cheers,
> Simon B.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
▒▒�...@g@d...@◄▒▒

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread Simon Brunning
2009/12/15 'chiru'tha :
> hey i've seen dat.. bt i cont able to create a new one.. i'm doing
> some mistake while setting settings. If u createed a project.. plz
> tell me the process in detail.. plz.
> thanku..

Sorry, but that *is* the process.

Why don't you tell us what went wrong? Perhaps we can help.

-- 
Cheers,
Simon B.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread 'chiru'tha
hey i've seen dat.. bt i cont able to create a new one.. i'm doing
some mistake while setting settings. If u createed a project.. plz
tell me the process in detail.. plz.
thanku..

On Dec 15, 6:25 pm, Simon Brunning  wrote:
> 2009/12/15 'chiru'tha :
>
> > hi..
> > I'm new to Django, i need it in my project applications, can any one
> > guide me to create a new model project(using MySql database). plz give
> > the process in detail..
>
> http://lmgtfy.com/?q=django+tutorial
>
> --
> Cheers,
> Simon B.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: can any on help me how to create a sample model project.

2009-12-15 Thread Simon Brunning
2009/12/15 'chiru'tha :
> hi..
> I'm new to Django, i need it in my project applications, can any one
> guide me to create a new model project(using MySql database). plz give
> the process in detail..

http://lmgtfy.com/?q=django+tutorial

-- 
Cheers,
Simon B.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




can any on help me how to create a sample model project.

2009-12-15 Thread 'chiru'tha
hi..
I'm new to Django, i need it in my project applications, can any one
guide me to create a new model project(using MySql database). plz give
the process in detail..

OS-- read hat
DB:mysql5
python2.6
Django-1.1.1


thanku..

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: How to create such a model?

2009-03-09 Thread Alex Gaynor
On Mon, Mar 9, 2009 at 9:09 AM, uprising  wrote:

>
> Thanks for your fast reply..
> You mean unique_together=(node_a, node_b)?
> No, that's not what I meant.
>
> I want to make sure if someone has created
>  Edge(node_a=x, node_b=y).save()
> he can't add
>  Edge(node_a=y, node_b=x).save()
> because edge is a set of two distinct nodes.
>
> On Mar 9, 8:54 pm, Alex Gaynor  wrote:
> > On Mon, Mar 9, 2009 at 8:52 AM, uprising  wrote:
> >
> > > Just reminded of a problem by this post, how can I validate a unique
> > > pair of nodes like this:
> >
> > > class Edge(models.Model):
> > >node_a: models.ForeignKey(Node)
> > >node_b: models.ForeignKey(Node)
> >
> > > I mean if I already have {"node_a": 1, "node_b": 2}, I can't add
> > > {"node_a": 2, "node_b": 1}
> > > How to enforce this restriction efficiently?
> >
> > Are you looking to maintain cross field uniqueness, if so:
> http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together
> >
> > ALex
> >
> > --
> > "I disapprove of what you say, but I will defend to the death your right
> to
> > say it." --Voltaire
> > "The people's good is the highest law."--Cicero
> >
>
You'll need to write some custom validation code to handle that, there's
nothing in DJango(or at the DB level AFAIK) that can enforce that
automatically.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to create such a model?

2009-03-09 Thread uprising

Thanks for your fast reply..
You mean unique_together=(node_a, node_b)?
No, that's not what I meant.

I want to make sure if someone has created
  Edge(node_a=x, node_b=y).save()
he can't add
  Edge(node_a=y, node_b=x).save()
because edge is a set of two distinct nodes.

On Mar 9, 8:54 pm, Alex Gaynor  wrote:
> On Mon, Mar 9, 2009 at 8:52 AM, uprising  wrote:
>
> > Just reminded of a problem by this post, how can I validate a unique
> > pair of nodes like this:
>
> > class Edge(models.Model):
> >node_a: models.ForeignKey(Node)
> >node_b: models.ForeignKey(Node)
>
> > I mean if I already have {"node_a": 1, "node_b": 2}, I can't add
> > {"node_a": 2, "node_b": 1}
> > How to enforce this restriction efficiently?
>
> Are you looking to maintain cross field uniqueness, if 
> so:http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together
>
> ALex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to create such a model?

2009-03-09 Thread Alex Gaynor
On Mon, Mar 9, 2009 at 8:52 AM, uprising  wrote:

>
> Just reminded of a problem by this post, how can I validate a unique
> pair of nodes like this:
>
> class Edge(models.Model):
>node_a: models.ForeignKey(Node)
>node_b: models.ForeignKey(Node)
>
> I mean if I already have {"node_a": 1, "node_b": 2}, I can't add
> {"node_a": 2, "node_b": 1}
> How to enforce this restriction efficiently?
>
> >
>
Are you looking to maintain cross field uniqueness, if so:
http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together

ALex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to create such a model?

2009-03-09 Thread uprising

Just reminded of a problem by this post, how can I validate a unique
pair of nodes like this:

class Edge(models.Model):
node_a: models.ForeignKey(Node)
node_b: models.ForeignKey(Node)

I mean if I already have {"node_a": 1, "node_b": 2}, I can't add
{"node_a": 2, "node_b": 1}
How to enforce this restriction efficiently?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to create such a model?

2009-03-09 Thread Alex Gaynor
On Mon, Mar 9, 2009 at 7:17 AM, Reiner  wrote:

>
> Hi,
>
> have a look at the documentation of field options in models:
> http://docs.djangoproject.com/en/dev/ref/models/fields/#blank
>
> class Foo(models.Model):
>this_is_required = models.CharField(...)
>this_not = models.CharField(..., blank=True)
>
> Regards,
> Reiner
>
> On Mar 9, 8:37 am, khsing  wrote:
> > I want create a model that contain two field and there is one of two
> > field can not be blank.
> >
> > how to do it?
> >
> > thanks.
> >
> > --
> > A man live in jail and want to break.http://blog.khsing.net
> >
>
Are you saying there are 2 fields and one has to have a value, but it can be
either one(users decision)?  If so you'll need to make them both nullable
and just set the one you want, in terms of validation you'll have to write
some for whatever the data entry mechanism is, usually forms, either for
your views or the admin.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to create such a model?

2009-03-09 Thread Reiner

Hi,

have a look at the documentation of field options in models:
http://docs.djangoproject.com/en/dev/ref/models/fields/#blank

class Foo(models.Model):
this_is_required = models.CharField(...)
this_not = models.CharField(..., blank=True)

Regards,
Reiner

On Mar 9, 8:37 am, khsing  wrote:
> I want create a model that contain two field and there is one of two
> field can not be blank.
>
> how to do it?
>
> thanks.
>
> --
> A man live in jail and want to break.http://blog.khsing.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to create such a model?

2009-03-09 Thread khsing

I want create a model that contain two field and there is one of two
field can not be blank.

how to do it?

thanks.

-- 
A man live in jail and want to break.
http://blog.khsing.net

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---