Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
A simple database project
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Zeynel  
View profile  
 More options Nov 8, 1:58 am
From: Zeynel <azeyn...@gmail.com>
Date: Sat, 7 Nov 2009 06:58:15 -0800 (PST)
Local: Sun, Nov 8 2009 1:58 am
Subject: A simple database project
Hello,

I am planning to build a demo prototype for a who-knows-who database
for the legal profession. Database will consist of lawyer name, school
and year graduated. Searching by lawyer name will return other lawyers
graduated from same law school the same year. Can I build this in
Django? How long would it take me to learn enough Django to build this
myself?

Thank you


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tomasz Zieliński  
View profile  
 More options Nov 8, 4:23 am
From: Tomasz Zieliński <tomasz.zielin...@pyconsultant.eu>
Date: Sat, 7 Nov 2009 09:23:46 -0800 (PST)
Local: Sun, Nov 8 2009 4:23 am
Subject: Re: A simple database project

On 7 Lis, 15:58, Zeynel <azeyn...@gmail.com> wrote:

> Hello,

> I am planning to build a demo prototype for a who-knows-who database
> for the legal profession. Database will consist of lawyer name, school
> and year graduated. Searching by lawyer name will return other lawyers
> graduated from same law school the same year. Can I build this in
> Django? How long would it take me to learn enough Django to build this
> myself?

Of course you can build this in Django, I think that going through
tutorial:

http://docs.djangoproject.com/en/dev/intro/tutorial01/

is enough to build it in no longer that a few days (learning
included),
even for pre-intermediate programmer.

--
Tomasz Zieliński
http://pyconsultant.eu


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zeynel  
View profile  
 More options Nov 8, 6:29 am
From: Zeynel <azeyn...@gmail.com>
Date: Sat, 7 Nov 2009 11:29:59 -0800 (PST)
Local: Sun, Nov 8 2009 6:29 am
Subject: Re: A simple database project
Thanks. I started to study.

On Nov 7, 12:23 pm, Tomasz Zieliński


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zeynel  
View profile  
 More options Nov 11, 11:21 am
From: Zeynel <azeyn...@gmail.com>
Date: Tue, 10 Nov 2009 16:21:00 -0800 (PST)
Subject: Re: A simple database project
Hi Tomasz,

I was able to build the admin page and put a search box there:

class LawyerAdmin(admin.ModelAdmin):
    fieldsets = [
        ('Name',   {'fields': ['last', 'first', 'initial']}),
        ('School', {'fields': ['school', 'year_graduated']}),
    ]
    list_display = ('first', 'initial', 'last', 'school',
'year_graduated')
    list_filter = ['year_graduated']
    search_fields = ['last', 'first']

This search box searches only first and last names. But what i want is
a search box that finds all lawyers who went to same school. My
database now contains:

        Tom     T.      Lawyer3 Columbia School of Law  2003
        Bob             Lawyer2 NYU     2000
        John    I       Lawyer1 NYU     2000

So Lawyer1 and Lawyer2 graduated from NYU in 2000.

So I want to enter in the search box "Lawyer1" and in the result page
I want to see "Lawyer1 knows Lawyer2"

How do I do this?

Thank you so much.

On Nov 7, 12:23 pm, Tomasz Zieliński


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kenneth Gonsalves  
View profile  
 More options Nov 11, 11:35 am
From: Kenneth Gonsalves <law...@au-kbc.org>
Date: Wed, 11 Nov 2009 06:05:28 +0530
Local: Wed, Nov 11 2009 11:35 am
Subject: Re: A simple database project
On Wednesday 11 Nov 2009 5:51:00 am Zeynel wrote:
> So I want to enter in the search box "Lawyer1" and in the result page
> I want to see "Lawyer1 knows Lawyer2"

if your school is a foreign key (I think it is) you need a related name to
search for that. Check out ModelAdmin.search_fields in the docs. Not sure that
this is what you are looking for though.
--
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zeynel  
View profile  
 More options Nov 12, 12:03 am
From: Zeynel <azeyn...@gmail.com>
Date: Wed, 11 Nov 2009 05:03:54 -0800 (PST)
Local: Thurs, Nov 12 2009 12:03 am
Subject: Re: A simple database project

In this document http://docs.djangoproject.com/en/dev/ref/contrib/admin/
 ModelAdmin.search_fields is explained:

"You can also perform a related lookup on a ForeignKey with the lookup
API "follow" notation.

search_fields = ['foreign_key__related_fieldname']"

I tried

search_fields = ['school__lawyer']

but I get an error message when I did a search for last name of
lawyer:

Related Field has invalid lookup: icontains

When I try

search_fields = ['school__last']

I get the error message

Cannot resolve keyword 'last' into field. Choices are: id, lawyer,
school

Maybe I don't understand what "related_fieldname" is.

What is it?

This is my model:

class School(models.Model):
    school = models.CharField(max_length=200)
    def __unicode__(self):
        return self.school

class Lawyer(models.Model):
    first = models.CharField(max_length=20)
    initial = models.CharField(blank=True, max_length=2)
    last = models.CharField(max_length=20)
    year_graduated = models.IntegerField('Year graduated')
    school = models.CharField(max_length=200)
    school = models.ForeignKey(School)
    def __unicode__(self):
        return self.first

Thank you

On Nov 10, 7:35 pm, Kenneth Gonsalves <law...@au-kbc.org> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pjrharley@gmail.com  
View profile  
 More options Nov 12, 5:01 am
From: "pjrhar...@gmail.com" <pjrhar...@gmail.com>
Date: Wed, 11 Nov 2009 10:01:32 -0800 (PST)
Local: Thurs, Nov 12 2009 5:01 am
Subject: Re: A simple database project

> I tried

> search_fields = ['school__lawyer']

> but I get an error message when I did a search for last name of
> lawyer:

> Related Field has invalid lookup: icontains

You need something like:

search_fields = ['school__lawyer_last']

to specify which field on the related 'lawyer' instance you want to
search. You can add others like:

search_fields = ['school__lawyer_last', 'school__lawyer_first']

Peter


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zeynel  
View profile  
 More options Nov 12, 7:57 am
From: Zeynel <azeyn...@gmail.com>
Date: Wed, 11 Nov 2009 12:57:46 -0800 (PST)
Local: Thurs, Nov 12 2009 7:57 am
Subject: Re: A simple database project
Ok, I tried

search_fields = ['school__lawyer_first']

and I get this error

Cannot resolve keyword 'lawyer_first' into field. Choices are: id,
lawyer, school

In the variations that I tried only

search_fields = ['school__school']

worked.

I followed the tutorial and arranged lawyer names as a list, so that
when I search for school, I see which lawyers went to that school and
their year of graduation. Then I have the filter by year, and when I
apply that filter, I see all the lawyers who graduated from same
school same year. This is the result that I want, but obviously not a
very elegant solution.

Thank you.

On Nov 11, 1:01 pm, "pjrhar...@gmail.com" <pjrhar...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google