Re: Theory: Models/Apps

2009-08-14 Thread Vadivel Kumar
Thanks Guys ...

On Fri, Aug 14, 2009 at 1:45 PM, TiNo <tin...@gmail.com> wrote:

>
>
> On Fri, Aug 14, 2009 at 09:12, Jani Tiainen <rede...@gmail.com> wrote:
>
>>
>> Vadivel Kumar kirjoitti:
>> > I have recently started on Django .. going awesome .. I know, this
>> > question might have popped out several times before, but since Google
>> > does not yield me any results, I am writing this post. However, do point
>> > out resources if any in this mailing list.
>> >
>> > 1. What is the fundamental difference of APP versus PROJECT in Django
>> > terminology. For instance, is it right to say, POSTS is an APP and BLOG
>> > is a PROJECT or ORDERS is an APP and ORDER_MANAGEMENT is a PROJECT ..
>> >
>> > 2. Particularly, I don't like the idea of using a single models.py for
>> > many entities, I would rather to keep separate files for each of entity
>> > .. in a scenario like a huge team is working on a project, this approach
>> > will create unnecessary noise. Any answers?
>>
>
> Also keep in mind that models are just Python classes. So to split up your
> models in different files, you just set up a directory like this:
>
> project
> | - app
>   | - models (dir)
> | - __init__.py
> | - post.py
> | - comment.py
>   | - urls.py
>   | - ...
> | - anotherapp..
>
> Then you can import your models as: from app.models.post import Post
> or you can import them in you __init__ file and import them as normal
> # __init__.py
> from post import Post
> from comment import Comment
>
> # somewhere else:
> from app.models import Post, Comment
>
> Or use a decent versioning system...
>
> Tino
>
>>
>>
>> http://docs.djangoproject.com/en/dev/intro/tutorial01/#id3
>>
>> There is answers to both your questions.
>
>
>> --
>> Jani Tiainen
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Theory: Models/Apps

2009-08-13 Thread Vadivel Kumar
I have recently started on Django .. going awesome .. I know, this question
might have popped out several times before, but since Google does not yield
me any results, I am writing this post. However, do point out resources if
any in this mailing list.

1. What is the fundamental difference of APP versus PROJECT in Django
terminology. For instance, is it right to say, POSTS is an APP and BLOG is a
PROJECT or ORDERS is an APP and ORDER_MANAGEMENT is a PROJECT ..

2. Particularly, I don't like the idea of using a single models.py for many
entities, I would rather to keep separate files for each of entity .. in a
scenario like a huge team is working on a project, this approach will create
unnecessary noise. Any answers?

I sincerely appreciate your answers.

--~--~-~--~~~---~--~~
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: Many to Many field Assignment

2008-08-31 Thread Vadivel Kumar
i see that there exists a handy way -- *icontains* does exactly what iam
looking at

On Sun, Aug 31, 2008 at 9:35 PM, Vadivel Kumar <[EMAIL PROTECTED]> wrote:

>  Thanks Michael,
>
> I solved the problem - i had a silly mistake in the way how i handled  to
> check the existing tag. But, now the problem is when i check the given tag
> text against the database, i do it as like below,
>
>newTag = request.POST['tag']
>existingTag = Tags.objects.filter(TagName__exact=newTag)
>
> Now, I wanted to check it more perfectly, I want to check with
> case-insensitve etc., I am not seeing any appropriate django method to do
> this, may be i should check the documentation.
>
> Thanks for your quick help.
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Many to Many field Assignment

2008-08-31 Thread Vadivel Kumar
Thanks Michael,

I solved the problem - i had a silly mistake in the way how i handled  to
check the existing tag. But, now the problem is when i check the given tag
text against the database, i do it as like below,

   newTag = request.POST['tag']
   existingTag = Tags.objects.filter(TagName__exact=newTag)

Now, I wanted to check it more perfectly, I want to check with
case-insensitve etc., I am not seeing any appropriate django method to do
this, may be i should check the documentation.

Thanks for your quick help.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Many to Many field Assignment

2008-08-31 Thread Vadivel Kumar
I know this might sound very newbie .. its true

How can i assign an exising record of the child table to an parent record.
For example I have two models,

class User (models.Model):
 ... all other fields ...
Tags  = models.ManyToManyField(Tag)

 class Tag (models.Mode):
 .. all fields ..

The problem i am facing is whenever i create a new user and add an existing
tag object to User.Tags.add() method it creates a new record in Tag table
instead i need to just map the record with the new user.

I know am missing a paramount thing .. what is that ?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---