I also want to point out the reason why I am trying to bring one model into 
another.

MadTrak/
         manage.py
         MadTrak/
                Artists/
                      manage.py
                      Artists/
                             initialize/
                                   models.py
                Fans/
                      manage.py
                      Fans/
                Venues/
                      manage.py
                      Venues/
                GeoDjango/
                      manage.py
                      GeoDjango/
                             discover/
                                   models.py

As you can see I have 5 projects. MadTrak, Artists, Fans, Venues, 
GeoDjango. The idea here is that the top level MadTrak project handles 
everything that has to do with the simple about pages etc. The Artists 
project has the artist database in it and same for Fans and Venues 
respectively. And Finally GeoDjango has discover with is my app to 
hopefully be requested by a Fan and pull data from the Artist database and 
return that to the user.

I have no idea to be honest if this thought process is the correct one 
because I'm not that familiar with databases and how my whole directory 
tree here would interact so the advice you might be able to give could be 
entirely priceless to my whole understand of how to build a website with 
Django.

Without the advice it could break my whole building process.

I believe this all makes sense. I have separated out the major parts. The 
major databases of content Artists, Fans, Venues into their own projects 
with their databases and GeoDjango with its spatial database. I just don't 
have the knowledge to be able to connect the dots between how I can 
ACTUALLY call upon the data in my Artists project database and perform 
operations on it within my GeoDjango project.

Thanks,

JJ

On Tuesday, July 24, 2012 11:48:06 AM UTC-4, JJ Zolper wrote:
>
> Hello fellow Django developers,
>
> So here is my model that interfaces with my Artists database:
>
>
>
> from django.db import models
>
> class Artist(models.Model):
>       name = models.CharField(max_length=30)
>       genre = models.CharField(max_length=30) 
>       city = models.CharField(max_length=30) 
>       state = models.CharField(max_length=30) 
>       country = models.CharField(max_length=30)
>       website = models.UrlField()
>
>       def __unicode__(self):
>             return self.name
>
>
>
> Okay now that you see my database backend interface here's where I'm going 
> next.
>
> I've been working with GeoDjango for some time now. I've created an app 
> within my GeoDjango project called "discover". What's my goal? Well, I want 
> this app to be able to return information to my users. This app will take 
> the given parameters such as "locationfrom" (the user of the website 
> inserts their city, state) and then that value is used to bring in the 
> artists in their area in relation to the variable "requesteddistance" 
> (which for example could be 25 mi) along with another variable "genre" (a 
> query on the artists). So the picture is the user might say I want to see 
> all the "Rock" artists "25 mi" from me in "Vienna, VA".
>
> Now that you can see my project here, here is my question.
>
> In my discover app in the models.py file I could use some help. Through 
> this discover app I want to be able to reference the Artists database. As 
> you can see from above the
> models.py file has the fields to establish an Artist and their 
> information. Thus, when a request comes in to the discover app I want to be 
> able to calculate the requested information and return that. Here's where 
> I'm stuck... 
>
> In my mind I feel that the appropriate way to do this is to basically 
> create some sort of ForeignKey in the models.py of discover to the 
> models.py of Artist? That way I don't have to have two databases of the 
> same data but can simply reference the Artist database from the discover 
> app.
>
> Another idea I had was instead of creating a "field" link between the two 
> to try to import the Artist class from the models.py to the models.py file 
> of the discover app? Then from my views.py file in discover I can process 
> the given information referenced and return the result.
>
> Any input is welcome. I am striving to use Django's DRY (Don't Repeat 
> Yourself) methodolgy and try to reference the Artist database and do the 
> actual processing in the discover application.
>
> Thanks a lot for your advice,
>
> JJ Zolper
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/CFzezsCyJQwJ.
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.

Reply via email to