Re: DB Router default issue
Has anyone experienced this same thing? Anyone have a lot of experience working with multiple databases using a router? It's just a little unclear how I'm supposed to better control it. On Friday, July 10, 2020 at 12:03:46 PM UTC-4, JJ Zolper wrote: > > Hello, I am trying to prevent models in my api app from migrating into the > default database but I'm confused about the router. It seems every time I run > migrate even with the router it continues to migrate. > > > > #apps.py > > from django.apps import AppConfig > > class ApiConfig(AppConfig): > name = 'api' > label = 'api' > > > > #settings.py > > DATABASE_ROUTERS = ['myproject.dev_db_router.APIRouter',] > > > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.sqlite3', > 'NAME': os.path.join(BASE_DIR, 'default.sqlite3'), > }, > 'mydb': { > 'ENGINE': 'django.db.backends.sqlite3', > 'NAME': os.path.join(BASE_DIR, 'mydb.sqlite3'), > }, > } > > > > #dev_db_router.py > > class APIRouter: > """ > A router to control all database operations on models in the > api application. > """ > route_app_labels = {'api',} > > def db_for_read(self, model, **hints): > """ > Attempts to read api models go to mydb. > """ > if model._meta.app_label in self.route_app_labels: > return 'mydb' > return False > > def db_for_write(self, model, **hints): > """ > Attempts to write api models goes to mydb. > """ > if model._meta.app_label in self.route_app_labels: > return 'mydb' > return False > > def allow_migrate(self, db, app_label, model_name=None, **hints): > """ > Make sure the api app only appears in the > 'mydb' database. > """ > if app_label in self.route_app_labels: > return db == 'mydb' > return False > > > I've tried: > > python manage.py migrate --database=default > > python manage.py migrate > > > etc and every time it says: > > Applying api.0001_initial...* OK* > > > Even though I told it False if it does not meet the case of db == 'mydb'. I > can specify 'mydb' and it says it works: > > python manage.py migrate --database=mydb > > but my concern is it always migrates into default even when I'm trying to > tell it not to. In the future there will be models I do want to migrate into > default, but not these in the api app. Based on the documentation I'm doing > everything correctly. > > What am I not understanding? > > Thank you. > > Best, > > JJ > > -- 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/1c50646c-6fbe-4d47-84f1-1250e4c515a1o%40googlegroups.com.
DB Router default issue
Hello, I am trying to prevent models in my api app from migrating into the default database but I'm confused about the router. It seems every time I run migrate even with the router it continues to migrate. #apps.py from django.apps import AppConfig class ApiConfig(AppConfig): name = 'api' label = 'api' #settings.py DATABASE_ROUTERS = ['myproject.dev_db_router.APIRouter',] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'default.sqlite3'), }, 'mydb': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'mydb.sqlite3'), }, } #dev_db_router.py class APIRouter: """ A router to control all database operations on models in the api application. """ route_app_labels = {'api',} def db_for_read(self, model, **hints): """ Attempts to read api models go to mydb. """ if model._meta.app_label in self.route_app_labels: return 'mydb' return False def db_for_write(self, model, **hints): """ Attempts to write api models goes to mydb. """ if model._meta.app_label in self.route_app_labels: return 'mydb' return False def allow_migrate(self, db, app_label, model_name=None, **hints): """ Make sure the api app only appears in the 'mydb' database. """ if app_label in self.route_app_labels: return db == 'mydb' return False I've tried: python manage.py migrate --database=default python manage.py migrate etc and every time it says: Applying api.0001_initial...* OK* Even though I told it False if it does not meet the case of db == 'mydb'. I can specify 'mydb' and it says it works: python manage.py migrate --database=mydb but my concern is it always migrates into default even when I'm trying to tell it not to. In the future there will be models I do want to migrate into default, but not these in the api app. Based on the documentation I'm doing everything correctly. What am I not understanding? Thank you. Best, JJ -- 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/f1303148-a53b-46ef-a907-6771d493ab7ao%40googlegroups.com.
Re: Django ContentTypes required?
Dan, Thank you so much. I was able to get it figured out after I smoothed out an issue with the database. My assumption is something with the database was causing it to throw this confusing and unrelated error. I changed the settings files around too but really did not change or remove anything that would have made a difference. Or should have. The app was not included, etc. Best, JJ On Monday, July 6, 2020 at 8:26:26 PM UTC-4, Dan Madere wrote: > > I agree that it should work. Django uses ContentType in the admin and user > authentication, but you mention that you have removed these from > INSTALLED_APPS, so I don't get it. I'd try clearing .PYC files first. Then > maybe a sanity check.. double check what settings file you're actually > using, and if INSTALLED_APPS contains what you expect. > > Dan > > On Monday, July 6, 2020 at 2:33:19 PM UTC-4 jzt...@gmail.com wrote: > >> Hello, >> >> I am not using any of the ContentType relations, etc right now in my >> Django 2.12 Python 3.6 application, am I able to run the application >> without having django.contrib.contenttypes in the INSTALLED_APPS? Is there >> a piece I am not understanding that Django uses it for in the background? >> >> I thought I had it working with it removed but I am getting: >> >> Model class django.contrib.contenttypes.models.ContentType doesn't >> declare an explicit app_label and isn't in an application in INSTALLED_APPS. >> >> I have nothing in the INSTALLED_APPS except my apps and: >> >> 'django.contrib.staticfiles', >> 'rest_framework', >> >> Was trying an attempt where I avoided migrating contenttypes into a >> legacy database. >> >> Best, >> >> JJ >> > -- 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/8ecd8179-ce83-4af7-82b2-dd97eda70a07o%40googlegroups.com.
DB Router default issue
Hello, I am trying to prevent models in my api app from migrating into the default database but I'm confused about the router. It seems every time I run migrate even with the router it continues to migrate. #apps.py from django.apps import AppConfig class ApiConfig(AppConfig): name = 'api' label = 'api' #settings.py DATABASE_ROUTERS = ['myproject.dev_db_router.APIRouter',] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'default.sqlite3'), }, 'mydb': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'mydb.sqlite3'), }, } #dev_db_router.py class APIRouter: """ A router to control all database operations on models in the api application. """ route_app_labels = {'api',} def db_for_read(self, model, **hints): """ Attempts to read api models go to mydb. """ if model._meta.app_label in self.route_app_labels: return 'mydb' return False def db_for_write(self, model, **hints): """ Attempts to write api models goes to mydb. """ if model._meta.app_label in self.route_app_labels: return 'mydb' return False def allow_migrate(self, db, app_label, model_name=None, **hints): """ Make sure the api app only appears in the 'mydb' database. """ if app_label in self.route_app_labels: return db == 'mydb' return False I've tried: python manage.py migrate --database=default python manage.py migrate etc and every time it says: Applying api.0001_initial...* OK* Even though I told it False if it does not meet the case of db == 'mydb'. I can specify 'mydb' and it says it works: python manage.py migrate --database=mosaic but my concern is it always migrates into default even when I'm trying to tell it not to. In the future there will be models I do want to migrate into default, but not these in the api app. Based on the documentation I'm doing everything correctly. What am I not understanding? Thank you. Best, JJ -- 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/76d56bf9-a870-4a18-8689-6ec93bc50319o%40googlegroups.com.
Django ContentTypes required?
Hello, I am not using any of the ContentType relations, etc right now in my Django 2.12 Python 3.6 application, am I able to run the application without having django.contrib.contenttypes in the INSTALLED_APPS? Is there a piece I am not understanding that Django uses it for in the background? I thought I had it working with it removed but I am getting: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. I have nothing in the INSTALLED_APPS except my apps and: 'django.contrib.staticfiles', 'rest_framework', Was trying an attempt where I avoided migrating contenttypes into a legacy database. Best, JJ -- 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/5f21d61e-b2d1-41e9-8e07-b7a1821d68f9o%40googlegroups.com.
Re: More controls on createsuperuser
What if maybe after the command is run once it then is required to check a list of approved subsequent admins before allowing creation of an account? Some kind of list stored in the admin that is required to be populated following the first admin, or maybe 3 admins? On Sunday, April 28, 2019 at 11:24:57 PM UTC-4, JJ Zolper wrote: > > All, > > Curious what people think about more thought and control going into who > can run the createsuperuser method? > > For example say there's models that I don't want anyone to touch except > myself as a superuser. Is it not plausible that even if I make a Django > Group around that model that someone could still run createsuperuser and > give themselves the ability to have full control? > > Wouldn't it make sense if some random developer were to run > createsuperuser using django settings with any of the databases (as an > example) that it prevent them if say that email isn't on say an internal > list in the django admin of approved potential users? > > I see something like this being a good idea to prevent just anyone from > getting full control over the site without it being specifically provided. > > Maybe there's something I'm missing something but been reading about third > party options and more about what's there and I just feel there's a hole > when it comes to who can create a super user account. Obviously you could > have a script that you run to initialize who is a super user, what the > groups are etc, but then you're basically recording personal information > somewhere when that should only be typed in. > > Open to ideas and thoughts, mostly just curious what could be a good > answer. > > Best, > > JJ > -- 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/d6c2514a-e74f-4946-a1d8-7dbf57937096%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
More controls on createsuperuser
All, Curious what people think about more thought and control going into who can run the createsuperuser method? For example say there's models that I don't want anyone to touch except myself as a superuser. Is it not plausible that even if I make a Django Group around that model that someone could still run createsuperuser and give themselves the ability to have full control? Wouldn't it make sense if some random developer were to run createsuperuser using django settings with any of the databases (as an example) that it prevent them if say that email isn't on say an internal list in the django admin of approved potential users? I see something like this being a good idea to prevent just anyone from getting full control over the site without it being specifically provided. Maybe there's something I'm missing something but been reading about third party options and more about what's there and I just feel there's a hole when it comes to who can create a super user account. Obviously you could have a script that you run to initialize who is a super user, what the groups are etc, but then you're basically recording personal information somewhere when that should only be typed in. Open to ideas and thoughts, mostly just curious what could be a good answer. Best, JJ -- 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/f8e18aa2-becb-4c06-bc6b-397652332602%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django says a modification was made to Auth user when I didn't, and migration has a timestamp from the future. Help?
It's Jun 21 at 11:30 pm in my world fyi. On Thursday, June 21, 2018 at 11:34:50 PM UTC-4, JJ Zolper wrote: > > Hey everyone, > > So I did inherit this from someone else but I cannot phanthom how a change > to the django auth user would be maintained by git between developers. > > For some reason when I run makemigrations it thinks the django auth user > email field needs to be altered via migration? > > I'm so lost and I've tried resetting every scenario I could think of to > resolve this. Does anyone have any brilliant ideas? > > You'll see the timestamp on this post and here's the migration it thinks > it needs to make: > > # -*- coding: utf-8 -*- > > # Generated by Django 1.10.3 on 2018-06-22 03:29 > > from __future__ import unicode_literals > > > from django.db import migrations, models > > > > class Migration(migrations.Migration): > > > dependencies = [ > > ('auth', '0008_alter_user_username_max_length'), > > ] > > > operations = [ > > migrations.AlterField( > > model_name='user', > > name='email', > > field=models.EmailField(blank=True, max_length=254, > unique=True, verbose_name='email address'), > > ), > > ] > > > Yet I'll remove all of Django in python site packages and it still comes > back as something to migrate after it's been wiped clean. > > > Thanks for your help. I'm out of ideas. > > > Best, > > > JJ > -- 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/14059aeb-5d0d-411b-b339-455073ade64b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Django says a modification was made to Auth user when I didn't, and migration has a timestamp from the future. Help?
Hey everyone, So I did inherit this from someone else but I cannot phanthom how a change to the django auth user would be maintained by git between developers. For some reason when I run makemigrations it thinks the django auth user email field needs to be altered via migration? I'm so lost and I've tried resetting every scenario I could think of to resolve this. Does anyone have any brilliant ideas? You'll see the timestamp on this post and here's the migration it thinks it needs to make: # -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2018-06-22 03:29 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0008_alter_user_username_max_length'), ] operations = [ migrations.AlterField( model_name='user', name='email', field=models.EmailField(blank=True, max_length=254, unique=True, verbose_name='email address'), ), ] Yet I'll remove all of Django in python site packages and it still comes back as something to migrate after it's been wiped clean. Thanks for your help. I'm out of ideas. Best, JJ -- 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/17b4e9c6-5e94-43d9-8061-c41cbe8f6a67%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django custom auth_user_model error
I'm still a bit of a noob but I say you go back to default settings and create another model which has a OnetoOne relationship with the User model that way you can add additional fields about a user account & etc and not break things on the backend. from django.contrib.auth.models import User class Member(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) firstname = models.CharField(max_length=32,default="",verbose_name="First name") On Friday, May 13, 2016 at 10:14:21 AM UTC+10, Dave N wrote: > > I've been trying to customize a django auth_user_model, and it has led me > to the latest error/issue, which can be found here: > http://stackoverflow.com/questions/37197771/django-attributeerror-usermanager-object-has-no-attribute-create-superuser > > Please help get me out of Django config hell, so I can continue coding my > project.. > -- 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/cdad478f-e22e-4a5b-bcbd-737157db9b82%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Running a live Django site
All, In an effort to continue to push the Django community towards a point where we provide our developers with more information on how to run a live Django site, I would like to again share the High Performance Django Videos Kickstarter: https://www.kickstarter.com/projects/1704706557/high-performance-django-videos If you are able to become a backer please do. We need to continue to push Django towards being the ultimate web developer platform. Thanks, JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a0bc083e-d4e7-462a-bd08-54a416343f5c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
High Performance Django Videos Kickstarter
I was one of the original backers for the book and now the Lincoln Loop guys are doing some High Performance Django Videos. For anyone that can help us push this Kickstarter over the top that would be greatly appreciated. https://www.kickstarter.com/projects/1704706557/high-performance-django-videos/description Here are some details per the Kickstarter: We will produce a series of screencasts giving viewers an "over-the-shoulder" look at how we build out a deployment system using the best practices described in the book. We'll start from scratch and work our way up to a high performance site running in the cloud. Topics Covered Virtual machines with Vagrant and VirtualBox Configuration management with Salt Salt organization and best practices Django project organization and deployment Starting and managing services Configuring uWSGI, Postgres, Nginx, Varnish, Redis, etc. Using encryption to protect secrets in Salt Infrastructure automation with Terraform and Salt Cloud (using Digital Ocean and Amazon Web Services as examples) Basic service orchestration/discovery Load balancing with Nginx, Varnish, and Amazon's ELB Simple versioning and rollback strategy General Linux configuration and server hardening Thanks to all, JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c052405d-da00-43b6-9ab0-6e2a33dd2166%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Okay so has nothing to do with programming, and everything to do with the future of Humanity
I do want to append to my remarks that I am very appreciative of some of the new documentation under performance, optimization, etc. I just think if say we could bring in some big guns that have dealt with big time websites in the wild that would be super dynamic for our community. People who know first hand what to do with subjects such as load balancing, sharding, server crashes, scaling, monitoring, and every other fun thing one must deal with out in the wild. Thanks to all. <3 JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/49d1ed20-6901-4c47-8405-4115810175c2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Okay so has nothing to do with programming, and everything to do with the future of Humanity
Brandon, I think we may be talking about different aspects of running a website. Using a CMS is another topic in relation to what I was aiming for. I'm referring to the skills involved in managing the server infrastructure of a live website, not managing the content of a live website. I'm talking about things like Amazon Web Services, load balancing, caching, and so on. I got railed big time before because I suggest the community leverage the skills of: https://highperformancedjango.com/. Okay sure I get it the guy's at Lincoln Loop wrote the book and they are best friends with the Django community, but I don't think that should stop the community from either writing out own interpretation of what it takes to be the sys admin of a live website at the technology level. We need to begin working together to create consensus and sharing knowledge. We need to begin learning from each other in the public eye. If we want Django to be the best it can be we need to have a real discussion about how we can go about writing docs on the tools and skills needed for running a live Django website. I don't care how the Django higher ups want to do it but I think it's something we need to at least get the ball rolling on. I know it's more work but it's something we can just keep iterating on as a community slowly but surely. Brandon, the only part I see being relevant to what this thread is about is running a server for a game. For client vs server side you would use AJAX / Javascript on the client and Django on the server side. The scores thing is something you will have to do some research on first. Learn the basics before you try to run. JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d605b9bd-be4e-456d-8610-df444b26fbd0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Okay so has nothing to do with programming, and everything to do with the future of Humanity
I just want to put it out there that even if I have received a lot of negative vibes from the posts I have made, my only intention is that I aim to bring about a positive future for Django but also those who want to change the world with their website applications. Maybe some of the posts I have made aren't considered politically correct, but the only reason I made them is because I want to see Django make a major positive impact on the world. For example I think we need to make it extremely more seamless for people with a passion for innovating in the web space to get their deployed and live websites to the level of being the best they can be. That is why I made a post about trying to excite raise the level of effort invested into documentation about optimizing deployment. I think there needs to be more guidance and a community based effort at consolidating information in relation to running a live website. Whether it's the database, the Django views, the template language, the entire picture. We need to list the tools that make running a Django website more seamless instead of leaving that to a guessing game. We need to set guidelines that help people get their website running in the real world and in this way we can iterate over what are the best practices to achieve each and every person's goals. Thanks for reading and your understanding. In signing off it must be noted everything I have done has been in my view of the best interest of Django no matter what it has seemed to some. Thanks again, JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/366103aa-04ee-4719-af3b-98fb7eb994b9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Render Django Form with Ajax Response
For anyone who is curious how to make this work in the future (I always appreciate people sharing) I got lucky this time. There were absolutely no signals to what the issues is so I started guessing. It ended up being that because of the nature of the comment form being rendered with ajax it did not have access to the js files that are loaded into your general HTTP request html so by adding the js files it needed directly into the forms.html file for django comments I was able to have the comments form not fail its ajax request and the comment was successfully posted. Sometimes it pays to be lucky because I was scouring the internet for any tips at all and there was honestly really nothing that helped. Sometimes people had issues with the id of the submission button but for me it was something about how the js files were loaded into the template that was used to make the form. Now it has what it needs if it is ever rendered with ajax and not your normal flow. Really glad it panned out and I got lucky on this one. -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7aa59d5f-8138-4053-b79f-8ecd0aa30a09%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Render Django Form with Ajax Response
So like expected i made the post form work by only rendering it once and then using hidden fields to make the form work for my 3 feeds so posted would be created properly but i am still not sure if conceptually i understand why when the comment form is rendered with ajax for a that it doesnt work. Maybe someone has an idea. I refactored django comments to work with ajax but we will see. -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/35138364-1e8c-4b04-8467-cd673906b1e4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Render Django Form with Ajax Response
I'm almost positive there is some way to achieve this though. For example, in a facebook group for example when you scroll it loads a new set of posts and those posts are loaded with ajax and those posts have a comment form that was again obviously rendered with ajax. My situation is the same situation. On an ajax response I render the new posts and the comment form under it however it does not work. And I know it works on a regular HTTP GET with an ajax request so what changes that I don't see between returing this form with ajax that uses the same infastructure? I have no idea I thought and assumed that the same code would execute the same way no matter how the form got there to begin with, it stumps me. I am willing to share any code if necessary but to me that isnt necessary as this is a high level issue. Now if I need to use something like the django stream framework or pagination or something feel free to tell me I'm doing it wrong because I have exhausted all my ideas. But even if i rendered the stream with those structures off hand I would still think I would have the same issue because well there would be a comment form rendered via ajax. Honestly come to think of it it doesnt matter that I have 3 streams rendered with ajax because again facebook groups when scrolling load the new items with ajax so again that means the comment form was loaded with that. Im aiming for that same functionality in some respects. -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/072b2d35-264f-4397-9378-c9bdd44f719b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Question on Template placement in file system
Generally speaking my impression is most people next to their settings.py file have a "templates" folder. This folder of templates is for templates used across the site. If you are talking app specific then a "templates" folder inside that app is reasonable enough. So for generic templates here it is: myproject/ myproject/ settings.py wsgi.py urls.py static/ templates/ and so on and then for app it is: myproject/ myproject/ myapp/ models.py views.py templates/ settings.py wsgi.py urls.py static/ templates/ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c05c4505-e0e3-4159-9187-ff9323261896%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Render Django Form with Ajax Response
So what I'm trying to build is pretty complicated and I would like to see if this is even achievable. What I'm building has multiple feeds but on the same view. So on the initial GET request it loads the default feed and then say the user wants to load another one of the feeds of posts with comments they can click that name and it uses ajax to load the new posts and comments on the bottom. Which obviously must render the comment form so that if someone wanted to add another comment they could. The issue whenever I render the posts and comments underneath them in this fashion the backend that creates comments does not see the Ajax request I am expecting it to. Basically, when it is a regular GET and it returns say the default stream of posts and comments everything is just dandy. But when I render the post form, post stream, and comments under those, the forms that worked just a minute ago do no work having been returned from a render to string call on a template that is dumped via an .html() call in a ajax response. Is this simply not achievable on the web? Or am I just ignorant to a solution to design this? Before my intention was to have 3 different views and urls and that could have probably worked given what I feel I know now but to me this solution I am working on is what I want. It is very nice to me to have one page for my app that has 3 feeds under that umbrella. It's just to make it all work and the page not refresh that requires ajax to load the relevant streams requested and that all works but so far I simply cannot make the form submit properly. The form shows up based on the template that is rendered but it is a no go when it comes to form submission it appears. Thanks for your insights. JJ Zolper -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d730b3b7-766f-4735-ba12-e082c09d4df8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Any interest in a multi email field in django?
Lachlan, Oh I absolutely understand. Don't get me wrong I prefer Django to be as lightweight as possible, and leave out things that aren't really that necessary. I'm with you. I have also seen some ideas that I have turn into something people like and wish to pursue (rare but it has happened) so I just say what the heck sometimes when I think there could be others that actually assemble and push for inclusion of a concept. Also, agreed. I have mostly been doing gritty dev work and not optimizing as much so I understand how useful the django debug toolbar is now but again it isn't a part of native django for sure. Thanks for the tip on the urlfield, generally my implementations can be rough because django has a feature I am unaware of at the time of its inception or I just quickly jot something up with the attention to go back and clean up (probably not the best approach but that's how i think. When I have an idea i just go and come back later and refine. But you're totally right I should follow suit in terms of what django does on the athleteurl field. Thanks for the continued input, I've enjoyed the discussion. JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/97c83eb1-fe68-42f0-896e-1a7f54a4190f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Any interest in a multi email field in django?
Carl, Thanks so much for your help, this suggestion will help a lot. I actually wasn't really aware that this was even possible until now. Would explain why I wasn't sure if it could be done. Thanks again, JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f7a8513c-c1fc-46af-a7a4-12096bfa3c27%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Any interest in a multi email field in django?
Carl, I went ahead and tried your implementation suggestion and I am at a point now that I am not sure what to do next: # Athlete Email class AthleteEmail(models.Model): athlete = models.ForeignKey(Athlete) email = models.EmailField(unique=True) verified = models.BooleanField(default=False) This way basically any athlete which is the "profile" user extension wants to add an email they can in this way as this email object is FK'ed to their profile. Also, then once they verify an email the boolean there is flipped to true. The next step to me at least is to then build a form from a modelform of the above and then render this in a view so the form: class AthleteProfileEmailUpdateForm(ModelForm): athleteemail = forms.EmailField(label=(u'Athlete Email Address:')) class Meta: model = AthleteEmail exclude = ('athlete', 'verified',) fields = ['email',] At this point I'm not sure though, let me try to explain. For example on my profile module: # Athlete User class Athlete(models.Model): athleteuser = models.OneToOneField(User) athleteavatar = models.ImageField("Profile Pic", upload_to="images/", blank=True, null=True, default='images/default/no-img.jpg') athletebirthday = models.DateField(blank=True, null=True) athleteurl = models.CharField(max_length=30, unique=True, blank=True) # Must limit to a-z && A-Z && and 0-9 chars, validators=[validate_slug] athletelanguage = models.CharField(max_length=15, blank=True) athletecommunities = models.ManyToManyField('communities.Community', blank=True, null=True) athletecolleges = models.ManyToManyField('colleges.College', blank=True, null=True) athletetwitterscreenname = models.CharField(max_length=30, blank=True) isVerified = models.BooleanField(default=False) User.profile = property(lambda u: Athlete.objects.get_or_create(athleteuser=u)[0]) You can see this line: User.profile = property(lambda u: Athlete.objects.get_or_create(athleteuser=u)[0]) then the form: # Athlete Update Profile Form class AthleteProfileUpdateForm(ModelForm): athleteavatar = forms.ImageField(label=(u'Athlete Avatar:')) athletebirthday = forms.CharField(label=(u'Athlete Birthday:')) athleteurl = forms.CharField(label=(u'Athlete Url:')) #athletecommunities = forms.MultipleChoiceField(label=(u'Athlete Communities:'), widget=forms.CheckboxSelectMultiple, required=False, choices=ATHLETECOMMUNITIESCHOICES) class Meta: model = Athlete exclude = ('athleteuser',) fields = ['athleteavatar', 'athletebirthday', 'athleteurl', 'athletecommunities'] which then allows me in a view to: athleteprofile = AthleteProfileUpdateForm(instance = profile) thereby displaying a form with the already submitted contents in the form. However, I'm not sure how to do this with my current situation. I would assume a similar approach so basically collecting all the email objects and more specifically the email fields within that object that relates to the current or logged in user profile and then for looping over those items in a form. To me that would be the way that then I could dynamically show them all emails they have and allow them to edit them. I believe if I could implement this I could figure out how to do the rest that I need. Do you have any ideas? Thanks so much! JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/46257514-13d8-4a7e-ad34-2595d102fe7d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Any interest in a multi email field in django?
Lachlan, Thanks for your input. I apologize if from my OP that it wasn't clear but I am already creating a Profile or "extending the user model". # Athlete User class Athlete(models.Model): athleteuser = models.OneToOneField(User) athleteavatar = models.ImageField("Profile Pic", upload_to="images/", blank=True, null=True, default='images/default/no-img.jpg') athletebirthday = models.DateField(blank=True, null=True) athleteurl = models.CharField(max_length=30, unique=True, blank=True) # Must limit to a-z && A-Z && and 0-9 chars, validators=[validate_slug] athletelanguage = models.CharField(max_length=15, blank=True) athletecommunities = models.ManyToManyField('communities.Community', blank=True, null=True) athletecolleges = models.ManyToManyField('colleges.College', blank=True, null=True) athletetwitterscreenname = models.CharField(max_length=30, blank=True) isVerified = models.BooleanField(default=False) User.profile = property(lambda u: Athlete.objects.get_or_create(athleteuser=u)[0]) Certainly because Django is so flexible a multi email field doesn't have to be native but I was more just getting a feel for any interest that others might have in having this capability available. To me it is a very standard use case, and again to me off the top of my head my opinion is that something that solves this use case could be a standard feature that is shipped, that's really all this is about. For the time being I am trying basically your route and am doing things as an extension of what already exists. Thanks a lot, JJ On Monday, December 1, 2014 8:05:41 PM UTC-5, Lachlan Musicman wrote: > > You don't really need it native in Django because the User Model is > easily extensible - giving you or others the opportunity to extend it > as you see fit and to release it the world as fle has. > > See here: > > > https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#extending-the-existing-user-model > > > > cheers > L. > > On 2 December 2014 at 11:58, JJ Zolper <jzt...@gmail.com > > wrote: > > Hey everyone, > > > > I'm just curious if anyone around the community has an interest in > > discussing the possibility of adding a "MultiEmailField" to Django? > > > > Here is what I found when roaming the internet: > > > > https://github.com/fle/django-multi-email-field > > > > Basically, the reason I care is because on my website I'm building the > > ability to manage multiple e-mails on the user's profile. So on sites of > the > > caliber of facebook, google, twitter, and so on allow a person to have > > multiple e-mails listed. Then for example select which one they want to > be > > their "primary" e-mail. My thoughts would be then which ever one my user > > selects I would copy that selection from the "multiple email field > > management view" to the django.auth.user "email" field. So basically > > whatever they pick on my management for multiple emails set that to the > > default email field on a Django user. That way for my code that uses the > > django auth user email field for login handling (with the password) it > can > > verify if it shall allow that user to login. Again, this primary email > is > > the center of the entire users interaction in terms of authentication > and I > > am aiming to show them say a check mark next to which one they have > chosen. > > The rest of the e-mail addresses could serve other purposes. For sites > like > > facebook, google, etc they could be recovery email addresses, but for me > I > > would check the extensions. So for what I'm doing I would check within > the > > list of emails the user has if say it has the "vt.edu" extension if > they > > were trying to join a college community and so on. > > > > So I think by now I've explained my reasoning behind wanting some sort > of > > multiple email field. I would use it to set which email is the primary > as > > well as allow them to add multiple emails to then verify their > identities > > but also use some for recovery of an account for example. > > > > Does anyone agree with me that they would like to see this functionality > > native in Django? > > > > Thanks for your time, > > > > JJ Zolper > > > > -- > > 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
Any interest in a multi email field in django?
Hey everyone, I'm just curious if anyone around the community has an interest in discussing the possibility of adding a "MultiEmailField" to Django? Here is what I found when roaming the internet: https://github.com/fle/django-multi-email-field Basically, the reason I care is because on my website I'm building the ability to manage multiple e-mails on the user's profile. So on sites of the caliber of facebook, google, twitter, and so on allow a person to have multiple e-mails listed. Then for example select which one they want to be their "primary" e-mail. My thoughts would be then which ever one my user selects I would copy that selection from the "multiple email field management view" to the django.auth.user "email" field. So basically whatever they pick on my management for multiple emails set that to the default email field on a Django user. That way for my code that uses the django auth user email field for login handling (with the password) it can verify if it shall allow that user to login. Again, this primary email is the center of the entire users interaction in terms of authentication and I am aiming to show them say a check mark next to which one they have chosen. The rest of the e-mail addresses could serve other purposes. For sites like facebook, google, etc they could be recovery email addresses, but for me I would check the extensions. So for what I'm doing I would check within the list of emails the user has if say it has the "vt.edu" extension if they were trying to join a college community and so on. So I think by now I've explained my reasoning behind wanting some sort of multiple email field. I would use it to set which email is the primary as well as allow them to add multiple emails to then verify their identities but also use some for recovery of an account for example. Does anyone agree with me that they would like to see this functionality native in Django? Thanks for your time, JJ Zolper -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c206b3ed-c434-456d-b978-b7fe67c8d0bd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Using login_required decorator
The best way to require login to certain url and view hooks is the: @login_required decorator. Let me show you how I have it setup: My "Profile" view is the profile a user sees once they are logged in to then have the ability to edit their information so obviously this needs to have the login required decorator because they shouldn't be able to get to this point unless they are logged in or are authenticated but here it is: @login_required def Profile(request): contextdata = {} if request.user.groups.filter(name='Athletes').exists(): return render_to_response('profile.html', contextdata, context_instance = RequestContext(request)) else: contextdata = {'Error': 'Error'} return render_to_response('profile.html', contextdata, context_instance = RequestContext(request)) And in the template "profile.html" I then link to /profile/edit/ where a user edits their information but this is the sort of "home" page for their profile after they are logged in. I used similar logic and a similar approach to what you were doing before but then I upgraded to this approach so I recommend you do the same. Here is the documentation as supplemental information: https://docs.djangoproject.com/en/1.7/topics/auth/default/#the-login-required-decorator Make sure to set the LOGIN_URL in your settings so django knows where to send people when they try to access a restricted page when they are not logged in: https://docs.djangoproject.com/en/1.7/ref/settings/#std:setting-LOGIN_URL Once you review all this you will have a much cleaner and more concise implementation across your site. Cheers, JJ On Monday, December 1, 2014 6:59:00 PM UTC-5, Rootz wrote: > > I have a small project but I am trying to restrict access on some of the > django app urls to login users only. The problem is that when I hit a page > that requires login users I expected that they(users) are redirected to the > login page however that is not the case of what happens instead they are > redirected to an example url link like this '/login?next=/detail/1/' with > an error message as stated "TypeError at /login/ object() takes no > parameters" > > The django project url > > > (r'^detail/(?P\d{1,10})/$',login_required(views.DetailViewMember.as_view)), > > url(r'^login/$',views.members_login,name='login'), > > The Login View Function > > def members_login(request): > > if request.method == 'POST': > password = request.POST['password'] > username = request.POST['username'] > user = authenticate(username=username,password=password) > > if user is not None: > if user.is_active: > login(request,user) > return redirect('members:index') > else: > #inactive users required to re-register > return > redirect('members:index')#render(request,'members/login',dict(loginErr=True)) > else: > #no account required to register to create one > return redirect('members:index') > > else: > #test if login is a regular get request then redirect > return redirect('members:index') > > Can you explain to me why is it the I am getting this error? > > Thank you > -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/90f90d6c-e1a6-4893-97db-e2e6d5f48a7d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: migrate and runserver commands hang, there is no traceback, no clue yet why (1.7.1)
So I believe I have solved my issue. It has to do with the inexperience I still have with migrations and how certain aspects are approached. I was not aware of this issue until now: https://docs.djangoproject.com/en/1.7/ref/models/fields/#foreignkey Warning It is not recommended to have a ForeignKey from an app without migrations to an app with migrations. See thedependencies documentation <https://docs.djangoproject.com/en/1.7/topics/migrations/#unmigrated-dependencies> for more details. and thus: https://docs.djangoproject.com/en/1.7/topics/migrations/#unmigrated-dependencies So basically as it was shown I made migrations for my user app athletes with the model being Athlete, and so when I tried to establish the migrations for all my apps with migrate I was basically presenting this dependency issue. I should have left athlete unmigrated and create migrations for all my other apps. It is the nature of the FK and I didn't catch onto it. There is no output as was stated before, which I'm not sure if that is possible in the code but if so I think it could be nice to tell people what is going on if at all possible. Tell them that if they have some apps with a FK to a model in another app that that other app cannot have migrations. I still have a lot to learn with migrations, but for the time being things are operational again. As time goes on, more and more third-party apps will get migrations, but in the meantime you can either give them migrations yourself (using MIGRATION_MODULES <https://docs.djangoproject.com/en/1.7/ref/settings/#std:setting-MIGRATION_MODULES> to store those modules outside of the app’s own module if you wish), or keep the app with your user model unmigrated. Maybe in the future I won't have to even think about this if improvements are made to this situation. I might follow option 1 with giving it migrations outside the app's own module, but for the time being my quick fix is leaving my athlete app unmigrated, whereas everything else is. JJ On Saturday, October 25, 2014 5:15:04 PM UTC-4, Carl Meyer wrote: > > Hi JJ, > > One thing that can cause hangs when running migrations is having another > process (say a ‘manage.py shell’) with a connection to the same database > sitting open, possibly with a transaction in progress that is holding locks > on the tables the migrations need to touch. Any possibility that’s what > happened here? > > Carl > > On Oct 25, 2014, at 2:23 PM, JJ Zolper <jzt...@gmail.com > > wrote: > > I really wish I could give some useful information in the terms of a > traceback so others may have an idea what is happening to me but I'm > completely serious when I say I don't even get a traceback right now. Here > is the break down of what I did to give an idea of how I ended up at this > point, hopefully. I will continue to try to iterate upon this discussion as > well through observations to try to work on my own or with others to get > down to the cause of the issue. > > First with a clean and empty database I ran the migrate command and > everything went fine. There were no issues as it ran through: > > (zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py migrate > > *Operations to perform:* > > * Synchronize unmigrated apps: *colleges, ads, debug_toolbar, comments, > communities, main, athletes, ad_manager > > * Apply all migrations: *admin, contenttypes, sites, auth, sessions > > *Synchronizing apps without migrations:* > > Creating tables... > > Creating table athletes_athlete_athletecolleges > > Creating table athletes_athlete_athletecommunities > > Creating table athletes_athlete > > Creating table athletes_registrationprofile > > Creating table colleges_college > > Creating table colleges_collegeevent_attendees > > Creating table colleges_collegeevent > > Creating table communities_community > > Creating table communities_country > > Creating table communities_city > > Creating table communities_communitypost_city > > Creating table communities_communitypost_country > > Creating table communities_communitypost > > Creating table comments > > Creating table comment_flags > > Creating table main_teammember > > Creating table ads_partner > > Creating table ads_ad > > Creating table ad_manager_target > > Creating table ad_manager_adgroup > > Creating table ad_manager_ad > > Creating table ad_manager_pagetype > > Creating table ad_manager_adtype > > Creating table ad_manager_tagtype > > Installing custom SQL... > > Installing indexes... > > *Running migrations:* > > Applying contenttypes.0001_initial.
Re: migrate and runserver commands hang, there is no traceback, no clue yet why (1.7.1)
Carl, Thanks for responding and giving your input. I just made sure there were no other terminals with any sort of connection open. At times I have pgAdmin III open but that is currently closed and I ran migrate and same thing it hangs. The only other terminals I have are one terminal sitting after the server is closed down for my other project and another that has a live email server open in python. jjs-macbook-pro:~ JJZ$ python -m smtpd -n -c DebuggingServer localhost:1025 which I don't think would cause an issue and just to check I used control c to close it down and tried to migrate but again it hangs there. As you can see so far I'm in a pretty big bind, I wish I had any sort of lead on this issue. Feel free to ask me for any other code etc or do any sort of method or operation to hopefully shed more light on this. Thanks a lot, JJ On Saturday, October 25, 2014 5:15:04 PM UTC-4, Carl Meyer wrote: > > Hi JJ, > > One thing that can cause hangs when running migrations is having another > process (say a ‘manage.py shell’) with a connection to the same database > sitting open, possibly with a transaction in progress that is holding locks > on the tables the migrations need to touch. Any possibility that’s what > happened here? > > Carl > > On Oct 25, 2014, at 2:23 PM, JJ Zolper <jzt...@gmail.com > > wrote: > > I really wish I could give some useful information in the terms of a > traceback so others may have an idea what is happening to me but I'm > completely serious when I say I don't even get a traceback right now. Here > is the break down of what I did to give an idea of how I ended up at this > point, hopefully. I will continue to try to iterate upon this discussion as > well through observations to try to work on my own or with others to get > down to the cause of the issue. > > First with a clean and empty database I ran the migrate command and > everything went fine. There were no issues as it ran through: > > (zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py migrate > > *Operations to perform:* > > * Synchronize unmigrated apps: *colleges, ads, debug_toolbar, comments, > communities, main, athletes, ad_manager > > * Apply all migrations: *admin, contenttypes, sites, auth, sessions > > *Synchronizing apps without migrations:* > > Creating tables... > > Creating table athletes_athlete_athletecolleges > > Creating table athletes_athlete_athletecommunities > > Creating table athletes_athlete > > Creating table athletes_registrationprofile > > Creating table colleges_college > > Creating table colleges_collegeevent_attendees > > Creating table colleges_collegeevent > > Creating table communities_community > > Creating table communities_country > > Creating table communities_city > > Creating table communities_communitypost_city > > Creating table communities_communitypost_country > > Creating table communities_communitypost > > Creating table comments > > Creating table comment_flags > > Creating table main_teammember > > Creating table ads_partner > > Creating table ads_ad > > Creating table ad_manager_target > > Creating table ad_manager_adgroup > > Creating table ad_manager_ad > > Creating table ad_manager_pagetype > > Creating table ad_manager_adtype > > Creating table ad_manager_tagtype > > Installing custom SQL... > > Installing indexes... > > *Running migrations:* > > Applying contenttypes.0001_initial...* OK* > > Applying auth.0001_initial...* OK* > > Applying admin.0001_initial...* OK* > > Applying sessions.0001_initial...* OK* > > Applying sites.0001_initial...* OK* > > > Next up I called to create a super user and that went fine as well: > > (zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py > createsuperuser > > Username (leave blank to use 'jjz'): > > Email address: > > Password: > > Password (again): > > Superuser created successfully. > > > Then I ran the makemigrations command for the respective apps and their > models that I wanted to have: > > (zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py > makemigrations colleges > > *Migrations for 'colleges':* > > *0001_initial.py*: > > - Create model College > > - Create model CollegeEvent > > (zcosystem)jjs-macbook-pro:athletesunited JJZ$ python manage.py > makemigrations ads > > *Migrations for 'ads':* > > *0001_initial.py*: > > - Create model Ad > > - Create model Partner > >
migrate and runserver commands hang, there is no traceback, no clue yet why (1.7.1)
els. Here is one of those models (because it has the user FK): # College Event class CollegeEvent(models.Model): collegeid = models.CharField(max_length=30) user = models.ForeignKey('athletes.Athlete', verbose_name=_('user'), blank=True, null=True, related_name="%(class)s_events") creatorname = models.CharField(max_length=30) creatorurl = models.CharField(max_length=30) ispublished = models.BooleanField(default=False) name = models.CharField(max_length=30) description = models.TextField() startdate = models.CharField(max_length=30) enddate = models.CharField(max_length=30) attendees = models.ManyToManyField(settings.AUTH_USER_MODEL, null=True, blank=True) objects = models.Manager() ceobjects = CollegeEventManager() def __unicode__(self): return self.name def get_creator_full_name(self): return self.user.first_name + " " + self.user.last_name The key line being: user = models.ForeignKey('athletes.Athlete', verbose_name=_('user'), blank=True, null=True, related_name="%(class)s_events") I thought maybe it couldn't migrate this because of the FK to Athlete, even though I used this declaration before my understanding is it includes that model in the FK. I tried importing the the athlete model from the database above this definition but there was still no output or change in the issue. What I'm saying is before this line is the way it is above I had a foreignkey to settings.AUTH_USER_MODEL. But the funny thing is I actually had that definition commented out in my settings.py. The reason being I thought I needed to go that route originally with my Athlete django users but then realized I would just use a one to one field to a django user. Thus why I changed it to 'athletes.Athlete'. # Athlete User class Athlete(models.Model): athleteuser = models.OneToOneField(User) athleteavatar = models.ImageField("Profile Pic", upload_to="images/", blank=True, null=True, default='images/None/no-img.jpeg') athletebirthday = models.DateField() athleteurl = models.CharField(max_length=30, unique=True) # Must limit to a-z && A-Z && and 0-9 chars, validators=[validate_slug] athletecommunities = models.ManyToManyField('communities.Community') athletecolleges = models.ManyToManyField('colleges.College') I wish I could give more information but I simply can't think of anything else right now that could be relevant. It's funny because I saw this: - Modified migrations dependency algorithm to avoid possible infinite recursion. on the new release notes: https://docs.djangoproject.com/en/1.7/releases/1.7.1/ and it honestly seems to sound exactly like that. It seems like some sort of infinite recursion or something similar it can't get out of it. It can't identify the issue it gets thrown through and so it sits there endlessly. And yes again I am using 1.7.1, I just updated the other day. Thanks a lot, JJ Zolper -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dd5c0b56-44fd-436f-b957-ad2cbfcd63a4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
We can do this!
Hey everybody, I really feel I could learn a lot from the experiences of developers working on high profile Django sites as I am working hard to begin that journey as well. And that is why I would love to have this project funded to 15k: https://www.kickstarter.com/projects/1704706557/high-performance-django "The next goal is at $15k and will help us include exclusive interviews with developers of high-profile Django sites as part of the package. We've already lined one up with an early Pinterest engineer and have calls out to a few others." I've commited funds to every single Django project I have come across and I think we can do this! Take it easy everyone, JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/68bebcab-aea1-43f1-a189-86fc1a4362e6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
New feature suggestion, but probably late to the party.
Hello everyone, I apologize if this suggestion has already been brought up, shot down etc, but I would like to highlight a feature I think would be really cool to have in Django. For this feature, I think an all in one standard that is appropriate for all users of django websites that can quickly be switched on would be quite awesome. The feature is: django model translation To me at least the ability to quickly be able to turn on the functionality to have all user generated content within the django site seamlessly translated into any number of languages across the entire site would be amazing. Sure, we can translate seemingly static descriptors with django's internationalization/localization, but I think this course of action could be taken to the next level if django model translation was standardized and merged as yet another great django feature. >From my research I have seen that there are packages available sure, but as a community if we were able to unify on this subject and come up with a standardization of how to build the functionality into django, it would be quite powerful in my mind. Our web framework would have the power to instantly empower the developer's website to be open to any human on the planet with some quick adjustments. The way I see it, it takes django up a notch and even more competitive with our web development languages and approaches. Thanks for reading, and I'm looking forward to the arrival of my django 1.7 "now migrating" shirt. Cheers to all, JJ Zolper -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/427e1ccd-082d-4759-adf3-5f2c8fc8479e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Render User Selected Communities (as Checkboxes) in Multiple Choice Form
So I guess no one knows what to do? No one has ever dealt with the multiple choice field or multiple choice selections and the UX for it? On Tuesday, November 26, 2013 9:48:03 AM UTC-5, JJ Zolper wrote: > > > I know it's sort of a need by case basis but has anyone tried to do this > before? Has anyone tried to render the choices a user has selected > previously by rendering checked check boxes on a multiple choice field? > > Thanks, > > JJ > > -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d65f102f-e185-4a48-bd68-1204ea3f5dba%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Render User Selected Communities (as Checkboxes) in Multiple Choice Form
I know it's sort of a need by case basis but has anyone tried to do this before? Has anyone tried to render the choices a user has selected previously by rendering checked check boxes on a multiple choice field? Thanks, JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/22b61278-869d-40b0-90f7-74b0cf7d384a%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Render User Selected Communities (as Checkboxes) in Multiple Choice Form
<https://lh4.googleusercontent.com/-ptmCr77cQSM/UpLdp8n25lI/AAU/6jlKqpKh6xs/s1600/notshowingcommunities.png> <https://lh6.googleusercontent.com/-jB1ZKlyj_nQ/UpLdrkmVNmI/AAc/9vB-kCQeG4A/s1600/notshowingcommunities2.png> <https://lh6.googleusercontent.com/-gtI-eaBolhc/UpLdm7GcUOI/AAM/TRLzmzDMFjY/s1600/showingcommunities.png> I was so focused on posting the code I forgot to attach the pictures, now I'm putting them in. On Monday, November 25, 2013 12:13:57 AM UTC-5, JJ Zolper wrote: > > Hello, > > Hopefully it becomes clear as well from my code but, here is what is going > on. There is an Athlete registration form which has a long list of choices > or communities in the form of a multiple choices that the user can select > to then become a part of the communities they select. Then what I'm trying > to do is in my EditProfile view basically render this long list of multiple > choices again but obviously it would make sense to show the user what ones > they have selected/are already in, be able to deselect from this group to > remove themselves from the ones they selected on registration, or to select > new ones to then be added to those communities. > > My EditProfile view: > > # AU Athlete Edit Profile > > def EditProfile(request): > > if request.user.is_authenticated(): > > contexterror = {} > > context = {} > > contexterror = {'Error': 'Error'} > > # Since it is the generic view know we know if the user in the > request is a specific group this way > > if request.user.groups.filter(name='Athletes').exists(): > > # Since it is the generic view know we know if the user in > the request is in 'Athletes' / member of of the 'Athletes' Group > > if request.method == 'POST': > > userprofile = UserProfileUpdateForm(request.POST, > instance=request.user) > > athleteprofile = AthleteProfileUpdateForm(request.POST, > instance=request.user.profile) > > # Need to make it so it checks the forms properly and > saves the info if its correct > > if userprofile.is_valid() and athleteprofile.is_valid(): > > # Do something with the user selected athlete groups > below > > athletegroupsids = request.POST.getlist( > 'athletecommunities') > > # Iterate though all the athlete group names and > collect the objects which we can use to add the request.user to those > athlete groups > > for athletegroupLOWERCASEname in athletegroupsids: > > # Filter through all the communities and take the > check box selection id which is lowercase and compare it to the > communityurl which is the lowercase name > > AthleteCommunities = Community.objects.get(url = > athletegroupLOWERCASEname) > > # Check to make sure we have one athlete > community that we want to add the athlete to > > # Get the name of the athlete community > > AthleteCommunityName = AthleteCommunities.name > > # By taking the desired athlete community name > and filtering down the Athlete Group name be then add the user to the group > > AddAthleteToGroup = > Group.objects.get(name=AthleteCommunityName) > > > AddAthleteToGroup.user_set.add(request.user.athlete.athleteuser) > > # Now the user has been added to all the groups they > selected and notifications will go when a post is made in each respective > group > > # Save the two forms to the database > > userprofile.save() and athleteprofile.save() > > return HttpResponseRedirect('/profile/') > > else: > > user = request.user > > profile = user.profile > > userprofile = UserProfileUpdateForm(instance = user) > > athleteprofile = AthleteProfileUpdateForm(instance = > profile) > > context = {'AthleteProfileUpdateForm': athleteprofile, > 'UserProfileUpdateForm': userprofile} > > return render_to_response('editprofile.html', context, > context_instance = RequestContext(request)) > > return render_to_response('editprofile.html', contexterror, > context_instance = RequestContext(request)) > > return HttpResponseRedirect('/login/') > > > > My forms.py: > > > from django import forms > > from django.forms im
Render User Selected Communities (as Checkboxes) in Multiple Choice Form
=forms.CheckboxSelectMultiple, required=False, choices=ATHLETECOMMUNITIESCHOICES) class Meta: model = Athlete exclude = ('athleteuser',) fields = ['athletebirthday', 'athleteurl', 'athletecommunities', 'athletecolleges',] def selected_athlete_communities(self): return [athletecommunities[0] for athletecommunities inATHLETECOMMUNITIESCHOICES] My model for the athlete: from django.contrib.auth.models import User # Athlete User class Athlete(models.Model): athleteuser = models.OneToOneField(User) athletebirthday = models.DateField() athleteurl = models.CharField(max_length=30) # Must limit to a-z && A-Z && and 0-9 chars athletecommunities = models.ManyToManyField('communities.Community') athletecolleges = models.ManyToManyField('colleges.College') User.profile = property(lambda u: Athlete.objects.get_or_create(athleteuser=u)[0]) def __unicode__(self): return self.athleteuser.first_name + " " + self.athleteuser.last_name The relevant parts of my template for editprofile, just simply showing the form is all: {% csrf_token %} {% for field in AthleteProfileUpdateForm %} {{ field.label }} {{ field }} {{ field.error }} {% endfor %} As you can see from the pictures, when I do athleteprofile = AthleteProfileUpdateForm(instance = profile) in my view in the picture named "showingcommunities" you can see there is this little box that has greyed out some community names. This is great and occurs when this line "athletecommunities = forms.MultipleChoiceField(label=(u'Athlete Communities:'), widget=forms.CheckboxSelectMultiple, required=False, choices=ATHLETECOMMUNITIESCHOICES)" is commented out in my update athlete profile form. I was really optimistic when I saw this as I could see that indeed I was rendering which communities the user is actually in. However, when I add this following line back to my forms "athletecommunities = forms.MultipleChoiceField(label=(u'Athlete Communities:'), widget=forms.CheckboxSelectMultiple, required=False, choices=ATHLETECOMMUNITIESCHOICES)" you would see the second picture "notshowingcommunities" because basically there are the checkboxes but the ones the user is actually in are not rendering. What I mean is the checkboxes that correspond to what communities the user selected do not show up as checked. They all show up as empty. I have used a BooleanField before as a flag and it does hold its value, I can see the checked box in i.e. an edit form if on creation of that object the user checks the box. I would really hate to have to make about 20 boolean fields for an athlete to correspond to my communities. Not to mention every time I want to add a community I would have to add more fields on the model, when I'd prefer to just add to my ATHLETECOMMUNITIESCHOICES the new communities. I've been trying a lot but I really can't seem to find a resource that helps me simply just render what options were selected on this multiplechoicefield, I tried modelmultiplechoicefield as well. Thanks for helping, also if you have a better and nicer form concept I can try please let me know. Even though these checkboxes could work I'm not super satisfied with how this looks, I'd have to think up more ideas probably because I don't usually build websites that require an interface with a large relationship such as my athlete being in multiple communities and selecting and deselecting. JJ -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e82ced3f-c971-44c7-9317-a7afa9ac0b8c%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django 1.5 Feature Suggestion
I didn't want to clutter up the ticket that much so I thought we could discuss through here. Do you think the following package: https://github.com/Liberationtech/django-libtech-emailuser Could be used to merge in a solution to the django core for this? It sounds like when this package was created it was fairly simple to "rename" the necessary parts so that it would operate as desired. Maybe this package could be reviewed, and moved into the contrib app like you said? Thanks, JJ On Monday, July 29, 2013 9:07:43 PM UTC-4, Russell Keith-Magee wrote: > > > On Tue, Jul 30, 2013 at 8:37 AM, JJ Zolper <codin...@gmail.com > > wrote: > >> Russell Keith-Magee, >> >> Are you the one who is doing "Getting Started With Django" ? Sorry for >> getting off topic but just was curious. If so I donated money to that >> project and I am glad you are doing it. >> > > Sorry, that's not me. You're thinking of Kenneth Love (@kennethlove on > twitter). > > >> Yes, that's what it seems to be called by other Django devs, "Email >> address as username." I prefer more to think of it as just "Email" with the >> same exact login handlign as "Username." That's my goal with this post is >> keep pushing until the point is reached where we can just call it "Email" >> login. I also think it is such a common case that it should be within >> Django's core. It is obvious from the large number of posts online about >> replacing the username with an email. >> > > A lot of those posts will be from pre-1.5 days; having the ability to > easily use an email address as a username was one of the primary > motivations behind introducing swappable users as a new feature. It was > always possible; in Django 1.5, it's a lot easier; the next step is to make > it trivial by having a custom user model for that purpose available in the > box. > > If you have heard Jacob discussing it before, that would be wonderful! It >> would be awesome if the Django guys accepted this into Django all together. >> Given it must be considered with the release of Django 1.5 they did give a >> lot more support to people like me trying to have the email as the username >> through things like: >> >> class CustomUser(AbstractBaseUser, PermissionsMixin): >> >> email = models.EmailField(max_length=255, unique=True) >> >> >> objects = CustomUserManager() >> >> USERNAME_FIELD = 'email' >> >> >> So maybe Jacob and Adrian are already on top of this. >> > > Jacob and Adrian are only "on top of it" in the sense that Jacob has said > it's a good idea. I wouldn't hang around waiting for either of them to > commit such a patch -- they're both busy, and don't spend a lot of time > committing to Django itself these days. > > >> The only thing I have been trying to do is follow the suggestions of >> those posts I have found online. I could surely route some possible people >> I think might have already banged this out but I'm not sure I'm the best >> bet. However, I did go ahead and open a ticket: >> >> https://code.djangoproject.com/ticket/20824 >> >> Thanks again to all the Django developers for their hard work, >> > > Thanks for opening a ticket and driving the discussion. I've added some > comments to the ticket and marked it as accepted; next step is a patch :-) > > Yours, > Russ Magee %-) > > -- 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 http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Why can't a Model have the same name as a View?
Hello everyone, I've only been working with Python and Django for a couple of years now and whenever I can I like to learn more about certain rationalizations for certain decisions made within each of them. In Django we define a Python class with a name to represent our model (I think it's a python class at least) and then we write "def" for definition of a view function or python function. To me I view this as two separate types of structures and thus fairly often I give a model the same name as a view. It isn't until later that I realize that my app isn't working because of the fact that they have the same name. I'm here just wondering if anyone would be willing to explain how this comes about from how Python/Django treats this instance? Why does Django see a confliction between a class and a function with the same name? Aren't they entirely separate entities? I'm by all means okay with going in and changing the names of the view or model to something slightly different so everything works, I just would like to understand conceptually why it is an issue? Thanks a lot, JJ Zolper -- 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 http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django 1.5 Feature Suggestion
My apologies for not making this quickly accessible. I meant to stick the link in there but it didn't make it into my previous post. It's been a long day. Here it is: https://github.com/Liberationtech/django-libtech-emailuser JJ On Monday, July 29, 2013 9:07:43 PM UTC-4, Russell Keith-Magee wrote: > > > On Tue, Jul 30, 2013 at 8:37 AM, JJ Zolper <codin...@gmail.com > > wrote: > >> Russell Keith-Magee, >> >> Are you the one who is doing "Getting Started With Django" ? Sorry for >> getting off topic but just was curious. If so I donated money to that >> project and I am glad you are doing it. >> > > Sorry, that's not me. You're thinking of Kenneth Love (@kennethlove on > twitter). > > >> Yes, that's what it seems to be called by other Django devs, "Email >> address as username." I prefer more to think of it as just "Email" with the >> same exact login handlign as "Username." That's my goal with this post is >> keep pushing until the point is reached where we can just call it "Email" >> login. I also think it is such a common case that it should be within >> Django's core. It is obvious from the large number of posts online about >> replacing the username with an email. >> > > A lot of those posts will be from pre-1.5 days; having the ability to > easily use an email address as a username was one of the primary > motivations behind introducing swappable users as a new feature. It was > always possible; in Django 1.5, it's a lot easier; the next step is to make > it trivial by having a custom user model for that purpose available in the > box. > > If you have heard Jacob discussing it before, that would be wonderful! It >> would be awesome if the Django guys accepted this into Django all together. >> Given it must be considered with the release of Django 1.5 they did give a >> lot more support to people like me trying to have the email as the username >> through things like: >> >> class CustomUser(AbstractBaseUser, PermissionsMixin): >> >> email = models.EmailField(max_length=255, unique=True) >> >> >> objects = CustomUserManager() >> >> USERNAME_FIELD = 'email' >> >> >> So maybe Jacob and Adrian are already on top of this. >> > > Jacob and Adrian are only "on top of it" in the sense that Jacob has said > it's a good idea. I wouldn't hang around waiting for either of them to > commit such a patch -- they're both busy, and don't spend a lot of time > committing to Django itself these days. > > >> The only thing I have been trying to do is follow the suggestions of >> those posts I have found online. I could surely route some possible people >> I think might have already banged this out but I'm not sure I'm the best >> bet. However, I did go ahead and open a ticket: >> >> https://code.djangoproject.com/ticket/20824 >> >> Thanks again to all the Django developers for their hard work, >> > > Thanks for opening a ticket and driving the discussion. I've added some > comments to the ticket and marked it as accepted; next step is a patch :-) > > Yours, > Russ Magee %-) > > -- 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 http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django 1.5 Feature Suggestion
Russell Keith-Magee, This came to mind, before in my post I described a package I had come across that someone had made as their fix. In quoting his github: "There's a number apps out there for doing authentication with emailaddresses prior to Django 1.5. With the advent of Django 1.5 the Django core team has made it very easy to use any model for authentication simply by setting AUTH_USER_MODEL. Unfortunately it's not possible to create a EmailUser model by simply subclassing the User class in django.contrib.auth.models instead if you want a model that plays nicely with the rest of django.contrib.auth the simplest way is to copy all the code in django.contrib.auth.models.User and substitute username for emailaddress. You also need to edit some other minor stuff in forms.py and admin.py. This Django app does just that. I'm using it in production for a couple of client sites and it works fine." Rewriting code that exists never did anyone any good. It seems he just stripped out the previous auth and replaced it with the email address. I feel like it should at least be given a look because maybe his work can be reviewed, tweaked if needed, verified, and ultimately merged into Django? Thanks, JJ On Monday, July 29, 2013 9:07:43 PM UTC-4, Russell Keith-Magee wrote: > > > On Tue, Jul 30, 2013 at 8:37 AM, JJ Zolper <codin...@gmail.com > > wrote: > >> Russell Keith-Magee, >> >> Are you the one who is doing "Getting Started With Django" ? Sorry for >> getting off topic but just was curious. If so I donated money to that >> project and I am glad you are doing it. >> > > Sorry, that's not me. You're thinking of Kenneth Love (@kennethlove on > twitter). > > >> Yes, that's what it seems to be called by other Django devs, "Email >> address as username." I prefer more to think of it as just "Email" with the >> same exact login handlign as "Username." That's my goal with this post is >> keep pushing until the point is reached where we can just call it "Email" >> login. I also think it is such a common case that it should be within >> Django's core. It is obvious from the large number of posts online about >> replacing the username with an email. >> > > A lot of those posts will be from pre-1.5 days; having the ability to > easily use an email address as a username was one of the primary > motivations behind introducing swappable users as a new feature. It was > always possible; in Django 1.5, it's a lot easier; the next step is to make > it trivial by having a custom user model for that purpose available in the > box. > > If you have heard Jacob discussing it before, that would be wonderful! It >> would be awesome if the Django guys accepted this into Django all together. >> Given it must be considered with the release of Django 1.5 they did give a >> lot more support to people like me trying to have the email as the username >> through things like: >> >> class CustomUser(AbstractBaseUser, PermissionsMixin): >> >> email = models.EmailField(max_length=255, unique=True) >> >> >> objects = CustomUserManager() >> >> USERNAME_FIELD = 'email' >> >> >> So maybe Jacob and Adrian are already on top of this. >> > > Jacob and Adrian are only "on top of it" in the sense that Jacob has said > it's a good idea. I wouldn't hang around waiting for either of them to > commit such a patch -- they're both busy, and don't spend a lot of time > committing to Django itself these days. > > >> The only thing I have been trying to do is follow the suggestions of >> those posts I have found online. I could surely route some possible people >> I think might have already banged this out but I'm not sure I'm the best >> bet. However, I did go ahead and open a ticket: >> >> https://code.djangoproject.com/ticket/20824 >> >> Thanks again to all the Django developers for their hard work, >> > > Thanks for opening a ticket and driving the discussion. I've added some > comments to the ticket and marked it as accepted; next step is a patch :-) > > Yours, > Russ Magee %-) > > -- 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 http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django 1.5 Feature Suggestion
Oh that's right it was Kenneth, not sure why I thought it was you. That's a good point about 1.5. That's sort of where I was going. I agree that everything is headed in the right direction. And I'm sure they are busy. I can only imagine. No problem on opening the ticket and getting it started and yes I see your comments thanks for that. And yes now it's time for the patch. I will begin working on it. I will see what I can do. If anyone is willing to help don't hesitate to send them my way. I can be e-mailed at: jjzol...@madtrak.com. I haven't developed for the Django internals before so I'm completely new to all of this and I haven't been programming in Python or Django for a significant amount of time but I feel like I can make this happen. Hopefully others will be wanting to help along the way and I'm sure your coordinating support will be critical if you are able to help. JJ On Monday, July 29, 2013 9:07:43 PM UTC-4, Russell Keith-Magee wrote: > > > On Tue, Jul 30, 2013 at 8:37 AM, JJ Zolper <codin...@gmail.com > > wrote: > >> Russell Keith-Magee, >> >> Are you the one who is doing "Getting Started With Django" ? Sorry for >> getting off topic but just was curious. If so I donated money to that >> project and I am glad you are doing it. >> > > Sorry, that's not me. You're thinking of Kenneth Love (@kennethlove on > twitter). > > >> Yes, that's what it seems to be called by other Django devs, "Email >> address as username." I prefer more to think of it as just "Email" with the >> same exact login handlign as "Username." That's my goal with this post is >> keep pushing until the point is reached where we can just call it "Email" >> login. I also think it is such a common case that it should be within >> Django's core. It is obvious from the large number of posts online about >> replacing the username with an email. >> > > A lot of those posts will be from pre-1.5 days; having the ability to > easily use an email address as a username was one of the primary > motivations behind introducing swappable users as a new feature. It was > always possible; in Django 1.5, it's a lot easier; the next step is to make > it trivial by having a custom user model for that purpose available in the > box. > > If you have heard Jacob discussing it before, that would be wonderful! It >> would be awesome if the Django guys accepted this into Django all together. >> Given it must be considered with the release of Django 1.5 they did give a >> lot more support to people like me trying to have the email as the username >> through things like: >> >> class CustomUser(AbstractBaseUser, PermissionsMixin): >> >> email = models.EmailField(max_length=255, unique=True) >> >> >> objects = CustomUserManager() >> >> USERNAME_FIELD = 'email' >> >> >> So maybe Jacob and Adrian are already on top of this. >> > > Jacob and Adrian are only "on top of it" in the sense that Jacob has said > it's a good idea. I wouldn't hang around waiting for either of them to > commit such a patch -- they're both busy, and don't spend a lot of time > committing to Django itself these days. > > >> The only thing I have been trying to do is follow the suggestions of >> those posts I have found online. I could surely route some possible people >> I think might have already banged this out but I'm not sure I'm the best >> bet. However, I did go ahead and open a ticket: >> >> https://code.djangoproject.com/ticket/20824 >> >> Thanks again to all the Django developers for their hard work, >> > > Thanks for opening a ticket and driving the discussion. I've added some > comments to the ticket and marked it as accepted; next step is a patch :-) > > Yours, > Russ Magee %-) > > -- 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 http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django 1.5 Feature Suggestion
Russell Keith-Magee, Are you the one who is doing "Getting Started With Django" ? Sorry for getting off topic but just was curious. If so I donated money to that project and I am glad you are doing it. Yes, that's what it seems to be called by other Django devs, "Email address as username." I prefer more to think of it as just "Email" with the same exact login handlign as "Username." That's my goal with this post is keep pushing until the point is reached where we can just call it "Email" login. I also think it is such a common case that it should be within Django's core. It is obvious from the large number of posts online about replacing the username with an email. If you have heard Jacob discussing it before, that would be wonderful! It would be awesome if the Django guys accepted this into Django all together. Given it must be considered with the release of Django 1.5 they did give a lot more support to people like me trying to have the email as the username through things like: class CustomUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(max_length=255, unique=True) objects = CustomUserManager() USERNAME_FIELD = 'email' So maybe Jacob and Adrian are already on top of this. The only thing I have been trying to do is follow the suggestions of those posts I have found online. I could surely route some possible people I think might have already banged this out but I'm not sure I'm the best bet. However, I did go ahead and open a ticket: https://code.djangoproject.com/ticket/20824 Thanks again to all the Django developers for their hard work, JJ On Friday, July 26, 2013 9:21:04 PM UTC-4, Russell Keith-Magee wrote: > > > On Fri, Jul 26, 2013 at 10:43 PM, JJ Zolper <codin...@gmail.com > > wrote: > >> Hello everyone, >> >> So I want to say thanks to the Django guys for providing more support for >> those of us that want to use a user's email as the UID and login handler >> versus the previous method of handling based on the username. I and >> probably many others appreciate the effort given to the topic and that it >> was integrated into Django 1.5. >> >> Today I would like to request a continuing expansion about this concept. >> >> In referencing this link: >> >> >> https://geekwentfreak-raviteja.rhcloud.com/2012/12/custom-user-models-in-django-1-5/ >> >> I would like to request that if we want to make email the UID we don't >> have to do things such as: >> >> class MyUser(AbstractBaseUser, PermissionsMixin): >> >> is_staff = models.BooleanField('staff status', default=False, >> help_text='Designates whether the user can log into this admin ' >> 'site.') >> is_active = models.BooleanField('active', default=True, >> help_text='Designates whether this user should be treated as ' >> 'active. Unselect this instead of deleting >> accounts.') >> >> def get_full_name(self): >> full_name = '%s %s' % (self.first_name, self.last_name) >> return full_name.strip() >> >> def get_short_name(self): >> return self.first_name >> >> just to retain what could already be apart of Django. You guys know >> more about Django then I ever will and what the best way is to go about it >> but if we can eliminate additional code that is already in Django that >> would be wonderful. >> >> Now in referencing: >> >> >> http://stackoverflow.com/questions/16638414/set-email-as-username-in-django-1-5 >> >> Basically what I'm saying is, we shouldn't have to do what this fellow >> had to do: >> >> Unfortunately there's nothing within django.contrib.auth that you can >> simply subclass to get a model that has >> >>1. >> >>email address in place of user name and >>2. >> >>works nicely with other django.contrib.auth-stuff, like groups. >> >> The simplest approach is to copy models.py, admin.py and forms.py from >> django.contrib.auth, rip out user name all over the place and put in >> email address in it's place. I've done just that and I'm using it >> successfully in a couple of client projects. >> >> I've put it up on github and pypi so you can install it with >> >> pip install django-libtech-emailuser >> >> >> I thank you for your time and I appreciate your consideration for >> integrating this once and for all into Django. >> > > Hi JJ, > > That's a fair comment -- "Email
Help needed with Django Slug Url Caveat
Hello fellow Django developers, I would like to request your assistance on a caveat I ran into when doing slugs in the django url's. First off please let me lay out what I've been building: Here are the internals of my urls.py: (r'^artists/register/$', 'madtrak.userprofiles.views.ArtistRegistration' ), (r'^artists/login/$', 'madtrak.userprofiles.views.ArtistLoginRequest'), (r'^artists/logout/$', 'madtrak.userprofiles.views.ArtistLogoutRequest' ), (r'^artists/(?P[a-zA-Z0-9]+)/$', 'madtrak.userprofiles.views.ArtistProfile'), Here are some relevant views.py functions: # Artist Profile def ArtistProfile(request, artistreq): artist_object = Artist.objects.filter(artisturl = artistreq) return render_to_response('artistprofile.html', {'Artist': artist_object}, context_instance = RequestContext(request)) and # Artist Registration def ArtistRegistration(request): if request.user.is_authenticated(): return HttpResponseRedirect('/artists/profile') if request.method == 'POST': form = ArtistRegistrationForm(request.POST) if form.is_valid(): # If information entered is valid create the user # user = User.objects.create_user('john', 'len...@thebeatles.com', 'johnpassword') artistusername = form.cleaned_data['artistusername'] artistemail = form.cleaned_data['artistemail'] artistpassword = form.cleaned_data['artistpassword'] artistuser = User.objects.create_user(username=artistusername, email=artistemail, password=artistpassword) # Save new user to the database artistuser.save() artist = Artist(artistuser=artistuser, artistname=form.cleaned_data['artistname'], artistbirthday=form.cleaned_data['artistbirthday'], artisturl=form.cleaned_data['artisturl']) artist.save() return HttpResponseRedirect('/artists/profile/') else: return render_to_response('registerartist.html', {'form': form}, context_instance=RequestContext(request)) else: ''' user is not submitting the form, show the blank registration form ''' form = ArtistRegistrationForm() context = {'form': form} return render_to_response('registerartist.html', context, context_instance = RequestContext(request)) So, basically here is the caveat: If a user requests artists/register the site goes to hell. Why? well it's because as you might have guessed that request also fits the regex expression listed where I url config'd (r '^artists/(?P[a-zA-Z0-9]+)/$', 'madtrak.userprofiles.views.ArtistProfile'), and so the url config does not behave as I desired. Or if I requested likewise if you put artists/ [artistuser] it collides still with the rest of the url configs. So, my quick fix and was: (r'^artists/register/$', 'madtrak.userprofiles.views.ArtistRegistration' ), (r'^artists/login/$', 'madtrak.userprofiles.views.ArtistLoginRequest'), (r'^artists/logout/$', 'madtrak.userprofiles.views.ArtistLogoutRequest' ), (r'^artists/profile/(?P[a-zA-Z0-9]+)/$', 'madtrak.userprofiles.views.ArtistProfile'), which thereby says hey if I only see artists/profile/ and then the requested artists profile then I behave as desired and return that artists public profile. Which makes sure it is obviously not listening at just artists/ [anything else] Yet the thing is I REALLY want to be able to have it is I originally had it. I like how clean it is. I strongly desire the situation where I can host all the registration, login, logout, and any other systems that I desire following the artists/ but also want to be able to also cleanly host all artists usernames following the artists/ so that it properly querys the db and returns that artists profile. I was thinking maybe I could hack this out with python regex or something of the like but is there a way in django to hack this together? Thanks so much, JJ -- 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 http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django & Ember
First off I want to say thanks a lot to Doug and Toran, The wealth of information you provided is just astounding. I wish I understood the dynamics as much as you seem to have progressed too. Really for me at this point I don't have much JS experience but I am under the impression that it is very good for handling the data I would most likely place over a google map. Since the data will update and typically there won't be a refresh just an update (i assume ajax) i just feel a purely JS framework hooked up with Django might be a nice solution. @Toran currently the project is going to be texted based because I lost one developer and it's just me. At some point if we were to reach the point where we move to the map and adding the more complex features I think at that point it would be necessary to try things like you are doing with your team. At this point basically I want a user to select criteria and the querysets to be created in an effective and high performance way because there would be a lot of entries in the db. I have to work on a good way to select a random number of entries from the database and I'm not sure if like not refreshing the page and handling it with ajax of sorts is a good decision. Thanks, JJ On Saturday, June 1, 2013 9:30:23 PM UTC-4, Toran Billups wrote: > > My small software company has a team of 4 python devs and we started using > ember earlier this year (here are a few things we learned along the way) > > 1.) use a REST framework to transform your models into JSON over the wire > > ** We use the latest 2.x of django-rest-framework and it's been great > ** If you are into the bleeding edge stuff you could also use ember-data > (I have an adapter that works with both projects to reduce the $.ajax you > normally write to communicate with your server on the backend) > > https://github.com/toranb/ember-data-django-rest-adapter > > 2.) you will need a template precompiler that can crunch down your > handlebars templates > > ** We use django compressor to minify our JS and CoffeeScript so we just > added another module called django-ember-precompile > > https://npmjs.org/package/django-ember-precompile > > 3.) If you are a unit testing shop look into ember-testing with QUnit and > Karma > > ** The only down side is that Karma does not have a preprocessor built in > so write your own or wait for my pull request (assuming the core pulls it > in) > > A full example project showing a django app + django rest framework + the > compressor / handlebars stuff mentioned above > > https://github.com/toranb/complex-ember-data-example > > Also I'm up for a pairing session or discussion over email if you decide > to jump in and need some pointers to get started > > Toran > tor...@gmail.com > > On Saturday, June 1, 2013 12:34:01 AM UTC-5, JJ Zolper wrote: >> >> Hello, >> >> So I'm thinking about bundling together Django and Ember. The reason is >> my front end is going to be lots of data in realtime. Think like overlaying >> a map with information for an example. Lots of data needs to be handled on >> the front end. Things need to be extremely dynamic. >> >> I love Django and the interface with the database and all that. I'm >> thinking a powerful solution might be tagging Django and Ember together. >> Has anyone done this? Anyone have any advice? My questions really are (like >> the questions on my mind are) like lets say I query the database and get >> this resulting queryset or list in a variable. In Django you hand that list >> off to the template. Like I'm not sure how to hand things back and forth >> between Django and Ember. How I would hand the result from the query to >> Ember aka JS and then display that to the front end. >> >> Does this sound like a powerful solution for handling large amounts of >> data? Really any information would be wonderful, better than nothing for >> sure... >> >> I need high performance and power for processing quickly and giving the >> users a seamless experience and I'm wondering if this might be the ticket? >> >> Thanks so much, >> >> JJ Zolper >> > -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Django & Ember
Hello, So I'm thinking about bundling together Django and Ember. The reason is my front end is going to be lots of data in realtime. Think like overlaying a map with information for an example. Lots of data needs to be handled on the front end. Things need to be extremely dynamic. I love Django and the interface with the database and all that. I'm thinking a powerful solution might be tagging Django and Ember together. Has anyone done this? Anyone have any advice? My questions really are (like the questions on my mind are) like lets say I query the database and get this resulting queryset or list in a variable. In Django you hand that list off to the template. Like I'm not sure how to hand things back and forth between Django and Ember. How I would hand the result from the query to Ember aka JS and then display that to the front end. Does this sound like a powerful solution for handling large amounts of data? Really any information would be wonderful, better than nothing for sure... I need high performance and power for processing quickly and giving the users a seamless experience and I'm wondering if this might be the ticket? Thanks so much, JJ Zolper -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
2 Questions: Passing Filter Options to a View & Efficient QuerySet Evaluation
Hello, So my question is a 2 part question. The first part leads into the second part. So my first question goes like this. Say I'm on a webpage and I go through about 3 drop down selection filter menu's/options. I then hit submit. My question is how would I pass these arguments to the view that then would take those requested filter values and actually evaluate the database to return the correct objects from the database to a template? Initially, I thought maybe some sort of url generation/parsing/passing would be involved but I really don't know how to create a dynamic interchange here. I really don't think defining a set of standard querysets against in a view to go against a database is the best option. Like for example if I wanted to filter my database by 3 different criteria and each criteria had 4 filters that would be 3 x 4 possiblities and 12 unique view methods/queries I would have to write. Not good by any means. My second question spans off of the first question. So let's say now I have these criteria (Let's call it 3 specific criteria following the first paragraph's direction) and I want to go ahead and efficiently query the database given the populated queryset I have formed. How can I ensure these queries will be of the utmost efficiency? I need each query by each user on the site to have an extremely low footprint on the sites bandwith/resoures/etc. The reason being: Let's say I have 1,000,000 objects in the database. Say all the entries are geographically related. So maybe points in lat lon across the US. And say I'm filtering by distance off a location. That to me is a heck of a lot of queries that have to be done and surely how I write that has to be really efficient. Again on question 2 I would be chaining queries so: Chaining filters<https://docs.djangoproject.com/en/dev/topics/db/queries/#chaining-filters> The result of refining a QuerySet<https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet> is itself a QuerySet<https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet>, so it’s possible to chain refinements together. For example: >>> Entry.objects.filter(... headline__startswith='What'... ).exclude(... >>> pub_date__gte=datetime.date.today()... ).filter(... >>> pub_date__gte=datetime(2005, 1, 30)... ) and so one of those queries would indeed by geo related so of this nature: .objects.filter(point__distance_lte=(pnt, D(km=7))) and I then I would still break the query down by a few other criteria for example. So any advice on how to make my chained queries extremely efficient would be great! If I have no given enough information I would be more then happy to dive into more detail on each specific thing. The django community is the best in my opinion so I'm willing to go the extra mile and try to explain myself more for the chance for more great help! Thanks so much, JJ Zolper -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: GeometryField.geography = True Syntax Help GIS Model
Thanks for the reply. I actually already have PostgreSQL. So my question was pretty direct, or so I thought. I'll try and spell this out again. So if I want to create a column in my database with type "geography" is this the syntax: mpoly = models.MultiPolygonField(geography=true) I cannot find an single example where we specify that we want the geography type to be used instead of using geometries. All I need to know is if that is right? Is it a capitalized "true" so "TRUE" ? Thanks so much, JJ On Friday, November 2, 2012 10:15:40 PM UTC-4, Dump wrote: > > First of all, you have to create a geo database. Postgis (a PostgreSQL > extension) is the best choice. > > After that, you have to define some geography fields and import your data, > shape files (shp), etc. > > GeoDjango Tutorial provides all the steps to get it done. > > https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/ > > If you are not familiar with geo concepts, I recommend to take a look at > http://geodjango.org/presentations/ > > Hope that helps you > > > > > On Fri, Nov 2, 2012 at 11:30 PM, JJ Zolper <codin...@gmail.com > > wrote: > >> Wait so does anyone know how to do this? >> >> I posted this a long time ago. >> >> How do I define a geography field? I need a geography column so I can >> perform geographic queries on it and the documentation doesn't give me >> a definitive way on how to do it. >> >> Would it be like: >> >> city = models.CharField(max_length=**50, GeometryField.geography = true) >> >> ??? >> >> >> On Saturday, October 20, 2012 1:22:32 PM UTC-4, JJ Zolper wrote: >>> >>> Hello everyone, >>> >>> So I've decided for my GeoDjango application I want WGS84 along with a >>> geography database column, rather than geometry. >>> >>> I was reading here: >>> >>> https://docs.djangoproject.**com/en/1.4/ref/contrib/gis/** >>> model-api/#geography<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#geography> >>> >>> GeometryField.geography<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#django.contrib.gis.db.models.GeometryField.geography> >>> >>> >>> If set to True, this option will create a database column of type >>> geography, rather than geometry. Please refer to the geography >>> type<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#geography-type> >>> section >>> below for more details. >>> >>> >>> that to set up a new column as geography I had to >>> set GeometryField.geography = True. >>> >>> I am unsure of the syntax of how to do this? There was no example given. >>> Or where to properly place this line? >>> >>> Here is the model.py file I am working on. If you could tell me where to >>> fit this in that would be great? >>> >>> >>> from django.contrib.gis.db import models >>> >>> class Artist(models.Model): >>> name = models.CharField(max_length=**30) >>> genre = models.CharField(max_length=**30) >>> city = models.CharField(max_length=**60) >>> state = models.CharField(max_length=**30) >>> country = models.CharField(max_length=**50) >>> website = models.URLField() >>> objects = models.GeoManager() >>> >>> def __unicode__(self): >>>return self.name >>> >>> >>> >>> Thanks so much, >>> >>> JJ >>> >> -- >> 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/-/tWBJBDuXZzYJ. >> To post to this group, send email to django...@googlegroups.com >> . >> To unsubscribe from this group, send email to >> django-users...@googlegroups.com . >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > Christiano Anderson | http://christiano.me/ > http://twitter.com/dump > -- 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/-/y7KhH8Kl9h0J. 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: GeometryField.geography = True Syntax Help GIS Model
Wait so does anyone know how to do this? I posted this a long time ago. How do I define a geography field? I need a geography column so I can perform geographic queries on it and the documentation doesn't give me a definitive way on how to do it. Would it be like: city = models.CharField(max_length=50, GeometryField.geography = true) ??? On Saturday, October 20, 2012 1:22:32 PM UTC-4, JJ Zolper wrote: > > Hello everyone, > > So I've decided for my GeoDjango application I want WGS84 along with a > geography database column, rather than geometry. > > I was reading here: > > https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#geography > > GeometryField.geography<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#django.contrib.gis.db.models.GeometryField.geography> > > If set to True, this option will create a database column of type > geography, rather than geometry. Please refer to the geography > type<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#geography-type> > section > below for more details. > > > that to set up a new column as geography I had to > set GeometryField.geography = True. > > I am unsure of the syntax of how to do this? There was no example given. > Or where to properly place this line? > > Here is the model.py file I am working on. If you could tell me where to > fit this in that would be great? > > > from django.contrib.gis.db import models > > class Artist(models.Model): > name = models.CharField(max_length=30) > genre = models.CharField(max_length=30) > city = models.CharField(max_length=60) > state = models.CharField(max_length=30) > country = models.CharField(max_length=50) > website = models.URLField() > objects = models.GeoManager() > > def __unicode__(self): >return self.name > > > > Thanks so much, > > JJ > -- 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/-/tWBJBDuXZzYJ. 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.
Geometry vs Geography Data Type for PostGIS PostgreSQL database
Hello, So I've been researching the pros and cons for my application with regards to geometry or geography data types for my database. I was reading here: http://postgis.refractions.net/documentation/manual-1.5/ch04.html#PostGIS_GeographyVSGeometry I saw that: "The new GEOGRAPHY type allows you to store data in longitude/latitude coordinates, but at a cost: there are fewer functions defined on GEOGRAPHY than there are on GEOMETRY; those functions that are defined take more CPU time to execute. The type you choose should be conditioned on the expected working area of the application you are building. Will your data span the globe or a large continental area, or is it local to a state, county or municipality? - If your data is contained in a small area, you might find that choosing an appropriate projection and using GEOMETRY is the best solution, in terms of performance and functionality available. - If your data is global or covers a continental region, you may find that GEOGRAPHY allows you to build a system without having to worry about projection details. You store your data in longitude/latitude, and use the functions that have been defined on GEOGRAPHY. - If you don't understand projections, and you don't want to learn about them, and you're prepared to accept the limitations in functionality available in GEOGRAPHY, then it might be easier for you to use GEOGRAPHY than GEOMETRY. Simply load your data up as longitude/latitude and go from there." I have read this description but I still have a question about what sort of "data" we are talking about. Please let me explain. So my application will use used as a such: The user will put in a criteria for let's say 25 miles. Then the application will return to the user all the results within that range. Adding to this my website will withhold data from across the globe, meaning wherever you are in the world you can perform such a search of 25 miles from your location. Okay so back to the description it says: "The type you choose should be conditioned on the expected working area of the application you are building. Will your data span the globe or a large continental area, or is it local to a state, county or municipality?" This portion gives me the impression that I would need the geography type because my data will from be all around the world. Any person in any country could operate my geographic tool so my data will not only be from one small town in the US for example. However, again, my queries will only be relative to the users location. I don't have a need for extreme distance and math calculations from let's say the US to Canada or something. It is all fairly short distance calculations. So that gives me the impression that a geometry type would be sufficient. As you can see from my dilemma I'm not sure which option is the right one. If you could help me resolve my confusion I would really appreciate it. Thanks so much, 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/-/O81mWk74AocJ. 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.
GeometryField.geography = True Syntax Help GIS Model
Hello everyone, So I've decided for my GeoDjango application I want WGS84 along with a geography database column, rather than geometry. I was reading here: https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#geography GeometryField.geography<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#django.contrib.gis.db.models.GeometryField.geography> If set to True, this option will create a database column of type geography, rather than geometry. Please refer to the geography type<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/model-api/#geography-type> section below for more details. that to set up a new column as geography I had to set GeometryField.geography = True. I am unsure of the syntax of how to do this? There was no example given. Or where to properly place this line? Here is the model.py file I am working on. If you could tell me where to fit this in that would be great? from django.contrib.gis.db import models class Artist(models.Model): name = models.CharField(max_length=30) genre = models.CharField(max_length=30) city = models.CharField(max_length=60) state = models.CharField(max_length=30) country = models.CharField(max_length=50) website = models.URLField() objects = models.GeoManager() def __unicode__(self): return self.name Thanks so much, JJ -- 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/-/Sr6dFDSf5-MJ. 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: Help getting my GeoDjango setup.
That's good advice! I forgot all about the tickets for a minute there on webfaction. I have just sent one. I just want to do it correctly because basically this database is going to have to handle everything I do. Thanks for helping to try and move my data. I'm just not that worried about moving the data. JJ On Thursday, October 18, 2012 4:07:11 PM UTC-4, smcoll wrote: > > Last i checked, WebFaction will set up a database for you with the PostGIS > template if you submit a ticket to support. i bet they could also point to > you some documentation or a forum post about what you're trying to do as > well. > > -- 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/-/gkVrlGU97ZMJ. 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: Help getting my GeoDjango setup.
That's okay my website has not moved that far into the distance yet it's still pretty elementary so all the data in my database has been put there by me anyways. I can set up a new database. I see here: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#ref-gis-install that I should do: $ POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-2.0# Creating the template spatial database.$ createdb -E UTF8 template_postgis$ createlang -d template_postgis plpgsql # Adding PLPGSQL language support.# Allows non-superusers the ability to create from this template$ psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"# Loading the PostGIS SQL routines$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql$ psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql# Enabling users to alter spatial tables.$ psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"$ psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"$ psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;" to make a postgis spatial database template? Is that right? Then it says to do: hese commands may be placed in a shell script for later use; for convenience the following scripts are available: PostGIS versionBash shell script1.3create_template_postgis-1.3.sh<https://docs.djangoproject.com/en/dev/_downloads/create_template_postgis-1.3.sh> 1.4create_template_postgis-1.4.sh<https://docs.djangoproject.com/en/dev/_downloads/create_template_postgis-1.4.sh> 1.5create_template_postgis-1.5.sh<https://docs.djangoproject.com/en/dev/_downloads/create_template_postgis-1.5.sh> Debian/Ubuntucreate_template_postgis-debian.sh<https://docs.djangoproject.com/en/dev/_downloads/create_template_postgis-debian.sh> Afterwards, you may create a spatial database by simply specifying template_postgis as the template to use (via the -T option): $ createdb -T template_postgis So I guess once I run this bash script from SSH I then create a new database from an SSH terminal? I'm on Webfaction. ** Okay so I'm trying to parse through what you posted because at this point in time I'm going to just trash my old database and not preserve anything. Can you help me get GeoDjango set up from scratch? That's what I'm trying to do here. This is for moving my data only right: >From your current project, dump all your data to a json file: $ python manage.py dumpdata --all --natural > all.json The `natural` flag helps preserve some things like contenttypes and permissions. Then switch to your new postgis template in your settings file (along with the other necessary items you already mentioned, like changing your backend to postgis). Next: $ python manage.py syncdb $ python manage.py migrate # if using south $ python manage.py loaddata all.json You might run into an issue between syncdb and loaddata, because syncdb loads initial data into your tables for apps with a fixtures/initial_data.json file (auth, for example). If you can use the dev (1.5) code, use the --no-initial-data flag. Otherwise, you may need to run something like the following on your Postgres db before loaddata: =# delete from auth_group_permissions; delete from auth_permission; delete from django_admin_log; delete from django_content_type; If it is not only for that just let me know but that's what it seemed like. If I'm starting fresh I want a postgis database right? How do I then utilize GDAL, PROJ.4, and GEOS if my database gets set up as postgis? Thanks for sticking it out through all the questions. I'm really not sure how to do this and what's the best way. Thanks! JJ On Tuesday, October 16, 2012 10:57:58 AM UTC-4, smcoll wrote: > > You can add GIS support to your existing project, but as you suspected, > your current db will not be sufficient. Unless someone knows how to > convert an existing database, i believe you'll need to set up a new > database from the postgis template, and move all your data to it. That > process might look something like this: > > From your current project, dump all your data to a json file: > $ python manage.py dumpdata --all --natural > all.json > > The `natural` flag helps preserve some things like contenttypes and > permissions. > > Then switch to your new postgis template in your settings file (along with > the other necessary items you already mentioned, like changing your backend > to postgis). > > Next: > > $ python manage.py syncdb > $ python manage.py migrate # if using south > $ python manage.py loaddata all.json > > You might run into an issue between syncdb and loaddata, because syncdb > loads initial data into your tables for apps with a > fixtures/initial_data.json file (auth, for example). If you can use the > dev (1.5) cod
Help getting my GeoDjango setup.
Hello everyone, So I've installed GDAL, PostGIS, PROJ.4, and GEOS. I have Postgres set up too. What I need help on is the logistics of getting the GeoDjango portion of my website up and running. I already have my website code I'm just trying to add in GeoDjango so I can handle geographic operations on the website. So I've been reading here: https://docs.djangoproject.com/en/1.4/ref/contrib/gis/tutorial/#introduction I see: Create GeoDjango Project<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/tutorial/#create-geodjango-project> Use the django-admin.py script like normal to create a geodjango project: $ django-admin.py startproject geodjango With the project initialized, now create a world Django application within the geodjango project: $ cd geodjango$ python manage.py startapp world Configure settings.py<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/tutorial/#configure-settings-py> The geodjango project settings are stored in the geodjango/settings.py file. Edit the database connection settings appropriately: DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'geodjango', 'USER': 'geo', }} In addition, modify the INSTALLED_APPS<https://docs.djangoproject.com/en/1.4/ref/settings/#std:setting-INSTALLED_APPS> setting to include django.contrib.admin<https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#module-django.contrib.admin> , django.contrib.gis<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/#module-django.contrib.gis>, and world (our newly created application): INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.gis', 'world') My question is do I need to start a new project if I already have one project already? I already have my project "madtrak" which is the project that contains my entire website. Do I need a separate project just for GeoDjango? I thought that the start project command was only done once and for the website. Or do I need to run "django-admin.py startproject geodjango" ? If I find that I don't need to start a new project that would help a lot because then I would already have a settings.py file with my installed apps and an app that will have a model that connects up to the Geodjango database. One more thing on this topic I see: 'ENGINE': 'django.contrib.gis.db.backends.postgis', Even if I don't need an entire separate project do I need to add this backend to my current django project? That way I can handle all the Geodjango necessities? Because currently I have: 'ENGINE': 'django.db.backends.postgresql_psycopg2', and I would guess that is not sufficient. Any advice on handling my current settings file and interfacing that with the GeoDjango database would be great! Okay secondly I see this: Create a Spatial Database<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/tutorial/#create-a-spatial-database> Note MySQL and Oracle users can skip this section because spatial types are already built into the database. First, a spatial database needs to be created for our project. If using PostgreSQL and PostGIS, then the following commands will create the database from a spatial database template<https://docs.djangoproject.com/en/1.4/ref/contrib/gis/install/#spatialdb-template> : $ createdb -T template_postgis geodjango So it seems to me I need a new database because it will be a spatial database for GeoDjango? I would think my current database would not be sufficient because there is nothing special about it to hold the geometric data I will need to process with GeoDjango. So do I need to run this command and set up a new database and remove my old one? If I do this is the idea that I have those extra features that I need in my spatial database for GeoDjango and I then have the option on when to use that functionality within each django app I build? Any advice regarding the integration of GeoDjango into a current django project environment would be really useful! Thanks so much for your time. 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/-/RP4zIl1e4XoJ. 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: CSS not rendering on local server development
Off the top of my head I forget what kinks I ran into when trying to get CSS to load on my development server. I'll try and come up with things I remembered and let you know if I do. One thing in Chrome that I tend to have to do (probably why firefox is better in this case) is I have to clear my browsing data. That way the files propagate through to my browser. Here's how to do that: http://www.wikihow.com/Clear-Your-Browser's-Cache#Chrome_v10_.2B Did you run python manage.py collectstatic? and restart your local development server with python manage.py runserver? Cheers, JJ On Tuesday, October 2, 2012 11:23:11 PM UTC-4, Jim Wombles wrote: > > Greetings, > > I am at a loss as to why local server is unable to render the css and js > files. I have the static_dirs setting correct and the href link to the > files is correct, and the html file is rendering yet when I track what is > going on with Chrome Dev Tools it is unable to find the CSS and JS files > returning an Internal Server Error 500 > > Any idea what may be going on ? > > Thanks for any advice. > > Jim > Fanbouts.com > -- 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/-/_yzlMm95zPkJ. 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.
URL Hierarchy on a given page
Hello everyone, So I was reading this page to try to find a solution: https://docs.djangoproject.com/en/dev/topics/http/urls/ but I would like to hear any ideas. What I'm trying to do is basically give the relevant URL hierarchy for any page on my website. (That's the best I can put it into words). So to try and make my question more clear, some examples: If the visitor was here: http://www.madtrak.com/ <http://www.madtrak.com/about> it would say "Home" and that would be a link to the home page. now going deeper if the visitor was here: http://www.madtrak.com/about <http://www.madtrak.com/about/contributors> right above where it says: "Learn more about our contributors<http://www.madtrak.com/about/contributors> be" it would say "Home >> About" and both "Home" and "About" would be the relevant links to http://www.madtrak.com/ <http://www.madtrak.com/about> and http://www.madtrak.com/about respectively. and one last time: if the user was here: http://www.madtrak.com/about/contributors<http://www.madtrak.com/about/contributors/jjzolper> right above "*Contributors*" it would say "Home >> About >> Contributors" and as you might have guessed "Home", "About", and "Contributors" would be the relevant links to http://www.madtrak.com/ <http://www.madtrak.com/about> , http://www.madtrak.com/about, and http://www.madtrak.com/about/contributors respectively. I believe after having said this what I'm trying to do is more clear. So yeah, I wouldn't want to go page by page creating this for each page I want a generic sort of way to code and basically plant this in all the pages desired. It would then get the URL hierarchy above it (including the current page) and display that in a very quick and easy way to navigate through the website! Thanks so much for your time, 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/-/3nkQa5bqwZ4J. 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: Django on Bluehost
I hate to be that guy but... I was on Bluehost for a while but I just ended up deciding the benefits of switching to WebFaction far outweighed the benefits of staying on Bluehost as a Django user. If you're interested in joining WebFaction or hearing more about it feel free to send me an e-mail at jzth...@gmail.com and I can tell you more about it. If you feel that it suits what you want to do better I would be happy if you listed me as an affiliate! (Which I can explain if the time comes) See ya later. JJ On 09/24/2012 12:21 AM, Zach wrote: Hey everyone, I have recently been setting up a Django 1.4.1 project with python 2.7.2 and MySQL. I am using fcgi to deploy my project in this environment because mod_wsgi is not available through bluehost. After much frustration I have gotten my site up to display the "it works" page. Now for some strange reason I can not get it away from this page. I have set up the urls.py file for the main project along with adding my app into the Installed_Apps section of the settings.py file. My .htaccess file is the following *AddHandler fcgid-script .fcgi* *Options +SymLinksIfOwnerMatch* *RewriteEngine On* *RewriteBase /* *RewriteRule ^(media/.*)$ - [L]* *RewriteRule ^(adminmedia/.*)$ - [L]* *RewriteCond %{REQUEST_URI} !(mysite.fcgi)* *RewriteRule ^(.*)$ mysite.fcgi/$1 [L]* My mysite.fcgi is the following *#!/home1/propesn4/python27/bin/python* *import sys, os* *sys.path.insert(0, "/home1/propesn4/python27")* *os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings" * *sys.path.append("/home1/propesn4/project/")* *from django.core.servers.fastcgi import runfastcgi* *runfastcgi(method="threaded", daemonize="false")* * * When I make changes to my django project I preform a *touch mysite.fcgi* so that the fcgi agent knows there has been changes. If anyone could lead me in the right direction I would really appreciate it! -- 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/-/Aqyku-yyimsJ. 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. -- 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: My "Contributors" page Conundrum
Okay Nick so your help really made a big difference. The generic view and urlconf helped a lot. Well I didn't figure out how to do Melvyn's recommendation but I was able to implement this another way. It's good but not perfect. Here's all the relevant files: - about models.py from django.db import models from django.forms import ModelForm class Contributor(models.Model): name = models.CharField(max_length=30) lowername = models.CharField(max_length=30) title = models.CharField(max_length=60) bio = models.CharField(max_length=5000) website = models.URLField() def __unicode__(self): return self.name class ContributorForm(ModelForm): class Meta: model = Contributor Basically, my key was to add another field called lowername. This field would hold the lowercase version of the contributors name. So for me it is "jjzolper". By doing this with your help I was able to make it happen. And continuing on: - about contributors (the page that lists all contributors so pulls it out of the database: {% extends "base.html" %} {% block HTMLTitle %}About{% endblock %} {% block CSSFiles %} {% endblock %} {% block JSFiles %} {% endblock %} {% block content %} Contributors {% for Contributor in Contributors_List %} http://www.madtrak.com/about/contributors/{{ Contributor.lowername }}">{{ Contributor.name }} Title: {{ Contributor.title }} {% endfor %} {% endblock %} After having created this new field in the database I could call that field as the relevant URL! The second key. Then it was simple from there on out with your code. the urlconf you described: - urls.py (r'^about/contributors/(?P[a-zA-Z]+)$', 'madtrak.about.views.contributor'), That value like you said is passed through this thing. It is sent to the view for a singular contributor: - about views.py def contributor(request, contributorname): contributor_object = Contributor.objects.filter(lowername = contributorname) return render_to_response('contributor.html', {'Contributor': contributor_object}, context_instance = RequestContext(request)) It tests to see based on the url for the request which entry corresponds to it. about contributor.html (singular so the relevant contributor) {% extends "base.html" %} {% block HTMLTitle %}About {{ Contributor.name }}{% endblock %} {% block CSSFiles %} {% endblock %} {% block JSFiles %} {% endblock %} {% block content %} {% for Contributor in Contributor %} Name: {{ Contributor.name }} Title: {{ Contributor.title }} Bio: {{ Contributor.bio }} Website: {{ Contributor.website }} {% endfor %} {% endblock %} Thanks again for the great advice. Currently this is my best implementation of my about contributor page. I really appreciate your kind words and help when doing this. If there is a better way I'm all ears! But this is what I'm going with for the time being! Thanks so much, JJ On Tuesday, August 28, 2012 1:50:09 AM UTC-4, Nick Santos wrote: > > Hi JJ, > > You're absolutely right that there is a better way to do this that doesn't > involve repetition. To start with, check out the docs under example on the > page for the URL dispatcher: > https://docs.djangoproject.com/en/dev/topics/http/urls/ - I'll walk you > through part of it though. > > First, let's take a look at how capture groups work. Capture groups allow > you to pass a variable portion of the url to a view, which is what you'll > need to do in order to have one definition that lets you have a generic > view that looks up the contributor. So, you can assign a view to a URL > where only part of it is known at the time of the definition, and pass the > unknown parts into the view. In your case, your url definition would look > like: > > urlpatterns = patterns('', > your other patterns... > (r'^about/contributor/(?P[a-zA-Z]+)/$', 'your.view.name > '), > possibly more patterns > ) > > So, what that (?P[a-zA-Z]+) says, in parts is that we want to > capture a value - designated by the parenthesis - to be passed to > your.view.name as a named parameter called contribname - this is defined > by the ?P. That value looks like text with at least one > character. The text definition is [a-zA-Z] (careful, this doesn't include > spaces right now)and the at least one is +, and comes between two slashes. > If you want to learn more about writing things like that, look into regular > expressions. > > Then, in your view, you can take that parameter and look up the relevant > contributor and make the view generic to something like: > > def contributor_page(request, contribname): > contrib_object = Contributor.objects.filter(name=contribname) > return render_to_response('contributor.html', {'Contributor': > contrib_object}, context_instance =
Re: My "Contributors" page Conundrum
Thanks Thomas. Now does anyone have any legitimate help? Because I'm stuck. Thanks, JJ On Thursday, September 20, 2012 8:53:59 PM UTC-4, Thomas wrote: > > On 9/20/12 5:28 PM, JJ Zolper wrote: > > Anyone have any ideas? > > Yes, Melvyn did. > > hth > > - Tom > > > Thanks! > > JJ Zolper > > On Tuesday, August 28, 2012 2:24:03 AM UTC-4, Melvyn Sopacua wrote: >> >> On 28-8-2012 6:58, JJ Zolper wrote: >> >> > My problem is that I want each contributor to have their own separate >> page. >> > So if the first guys name for some example is Mike Smith then if you >> were >> > to click his name for example you would be sent to >> > /about/contributor/mikesmith and so on. >> >> < >> https://docs.djangoproject.com/en/1.4/ref/models/instances/#django.db.models.Model.get_absolute_url> >> >> >> and make sure you read the permalink bit. >> -- >> Melvyn Sopacua >> > -- > 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/-/uFK1RTmzm5MJ. > To post to this group, send email to django...@googlegroups.com > . > To unsubscribe from this group, send email to > django-users...@googlegroups.com . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > -- 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/-/lUdEgZLVuz8J. 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: My "Contributors" page Conundrum
Anyone have any ideas? Thanks! JJ Zolper On Tuesday, August 28, 2012 2:24:03 AM UTC-4, Melvyn Sopacua wrote: > > On 28-8-2012 6:58, JJ Zolper wrote: > > > My problem is that I want each contributor to have their own separate > page. > > So if the first guys name for some example is Mike Smith then if you > were > > to click his name for example you would be sent to > > /about/contributor/mikesmith and so on. > > < > https://docs.djangoproject.com/en/1.4/ref/models/instances/#django.db.models.Model.get_absolute_url> > > > and make sure you read the permalink bit. > -- > Melvyn Sopacua > -- 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/-/uFK1RTmzm5MJ. 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: My "Contributors" page Conundrum
Melyvn, Thanks for the tip but I'm still having trouble understand how to make this work. If you see the post I sent to Nick that should explain my problem in enough detail. Maybe you can give some advice or any example of some sort? Thanks, JJ On Tuesday, August 28, 2012 2:24:03 AM UTC-4, Melvyn Sopacua wrote: > > On 28-8-2012 6:58, JJ Zolper wrote: > > > My problem is that I want each contributor to have their own separate > page. > > So if the first guys name for some example is Mike Smith then if you > were > > to click his name for example you would be sent to > > /about/contributor/mikesmith and so on. > > < > https://docs.djangoproject.com/en/1.4/ref/models/instances/#django.db.models.Model.get_absolute_url> > > > and make sure you read the permalink bit. > -- > Melvyn Sopacua > -- 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/-/DKB3lEvJuLcJ. 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: My "Contributors" page Conundrum
Nick, Sorry my other very long posted vanished so I'm going to keep it shorter this time. So I was able to implement what you said. Thanks a lot! Only tricky part is I had to change my name in the database to "JJZolper" instead of "JJ Zolper" so that it could find me. So now if you do: http://www.madtrak.com/about/contributors/JJZolper It works! However, that's not very practical so I could use some help still. I'm wondering if I should come up with some other field in my contributor database like "id" or something and see if I could make it so it takes the name "JJ Zolper" and creates an id of "jjzolper" and thus when http://www.madtrak.com/about/contributors/jjzolper<http://www.madtrak.com/about/contributors/JJZolper> is called everything is happy because the same code you showed me would go through the database and work fine! Is this a good practice or is there a better way? Also, even though I've made progress on requesting the page with the name and all that I still have another problem. On this page: http://www.madtrak.com/about/contributors If you click a name to hopefully go to the page of that contributor it breaks. Here is the code: {% for Contributor in Contributors_List %} {{ Contributor.name }} Title: {{ Contributor.title }} {% endfor %} So bascially it pulls the contributor name which is messed up now cause I changed my name to JJZolper but this seems to work. I was trying to go after what Melvyn said about permalink and get absolute url to try to solve the problem of making these two pages actually connect up but I still haven't made it work. Any ideas there? I could use some help basically depending on the object handling the absolute url function and then sending it off to the respective url and then the file. I mean those are the right steps I think? Thanks so much, JJ PS. I'm making sure to copy this so hopefully it won't just crap out on me before I post it. Oh the joys of spending time on something and it getting destroyed. The internet is fun, eh? haha On Tuesday, August 28, 2012 1:50:09 AM UTC-4, Nick Santos wrote: > > Hi JJ, > > You're absolutely right that there is a better way to do this that doesn't > involve repetition. To start with, check out the docs under example on the > page for the URL dispatcher: > https://docs.djangoproject.com/en/dev/topics/http/urls/ - I'll walk you > through part of it though. > > First, let's take a look at how capture groups work. Capture groups allow > you to pass a variable portion of the url to a view, which is what you'll > need to do in order to have one definition that lets you have a generic > view that looks up the contributor. So, you can assign a view to a URL > where only part of it is known at the time of the definition, and pass the > unknown parts into the view. In your case, your url definition would look > like: > > urlpatterns = patterns('', > your other patterns... > (r'^about/contributor/(?P[a-zA-Z]+)/$', 'your.view.name > '), > possibly more patterns > ) > > So, what that (?P[a-zA-Z]+) says, in parts is that we want to > capture a value - designated by the parenthesis - to be passed to > your.view.name as a named parameter called contribname - this is defined > by the ?P. That value looks like text with at least one > character. The text definition is [a-zA-Z] (careful, this doesn't include > spaces right now)and the at least one is +, and comes between two slashes. > If you want to learn more about writing things like that, look into regular > expressions. > > Then, in your view, you can take that parameter and look up the relevant > contributor and make the view generic to something like: > > def contributor_page(request, contribname): > contrib_object = Contributor.objects.filter(name=contribname) > return render_to_response('contributor.html', {'Contributor': > contrib_object}, context_instance = RequestContext(request)) > > Then, in outputting your links, you can put the relevant name in the url, > etc. > > I hope that helps. Let me know if anything is unclear. Good luck > > > On Mon, Aug 27, 2012 at 9:58 PM, JJ Zolper <codin...@gmail.com > > wrote: > >> Hello, >> >> I'm trying to develop a simple hyperlink between two pages. It sounds >> simple but it's a little bit more complex then that. >> >> Here is the template code that proceeds through the database of >> contributors: >> >> Contributors >> >> >> {% for Contributor in Contributors_List %} >> http://www.madtrak.com/about/contributors/;>{{ >> Contributor.name }} >> >> Title: {{ Contributor.title }} >> >> {% endfor %} >> >>
Re: Customizing the Django Admin Interface
Derek, You can see the custom changes I made here: http://www.madtrak.com/admin That is the extent of what I have done in relation to the default. Nothing more then some colors in the CSS and text color. Additionally I changed the actual wording for the to Log in | MadTrak Django Admin other then that text change and the colors I'm not sure what you are asking? What is: I cannot seem to find the source text, for example, for "Select ... to change" and would appreciate seeing/knowing how you did it. referring to? JJ On Monday, September 17, 2012 3:09:26 AM UTC-4, Derek wrote: > > Hi JJ > > I'd like to know how you changed the wording... I cannot seem to find the > source text, for example, for "Select ... to change" > and would appreciate seeing/knowing how you did it. > > There are examples on various blogs, but Django has changed how it is > works since they were written. > > Thanks > Derek > > On Sunday, 16 September 2012 08:25:18 UTC+2, JJ Zolper wrote: >> >> Hello, >> >> I was able to locate the Django files for the admin under contrib in the >> source. I was curious if I could get some tips about customizing the >> interface. >> >> One website I read said I shouldn't change any of the Django source but >> if I want to set up a slightly different login page for example, to put the >> admin files in my local directories that I'm working with. >> >> The real question is that I was able to edit some template files to >> change some of the wording displayed but when I tried to edit the CSS files >> to get a different design I did not see any changes when I restarted my >> server. Is there some sort of collectstatic command that needs to be run? >> Any input on how to propagate these CSS files through would be great. >> >> Thanks, >> >> 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/-/ezvcwLBOUMgJ. 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: Customizing the Django Admin Interface
Pretty sure you're in the wrong thread bud. On Sunday, September 16, 2012 2:52:34 AM UTC-4, Gutso wrote: > > Hi Everyone, > > I have one query: > > Should we change the database(mySQL) table's engine through migration > scripts or not? If not then why? > > Following were my proposal: > > def forwards(self, orm): > > # Change engine from MYISAM to INNODB > db.execute('alter table abc ENGINE=INNODB;') > > def backwards(self, orm): > ># Revert Engine to MYISAM > db.execute('alter table abc ENGINE=MYISAM;') > > - gurpreet > -- 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/-/YbLLdanMN8cJ. 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: Customizing the Django Admin Interface
Hevok so what are the steps for doing this? Sure I know where the admin files are located but once I have copied them does magic just happen and Django uses my new configurations? Thanks, JJ PS. apparently after I left my website alone for a little the CSS propagated through and now I see this: http://www.madtrak.com/admin Which has the red, different text color, etc. On Sunday, September 16, 2012 4:34:10 AM UTC-4, hevok wrote: > > Its the correct way to copy the templates and static files into your > project folder, if you want to customize them. Otherwise the changes > would disappear as soon as you deploy or setup-up your project on a > different computer/virtual environment. > > Try F5, CTRL-F5 or CTRL-R to reload CSS in the browser as they are often > kept in cache. > > Best regards, > Hevok > > > On Sunday, September 16, 2012 8:25:18 AM UTC+2, JJ Zolper wrote: >> >> Hello, >> >> I was able to locate the Django files for the admin under contrib in the >> source. I was curious if I could get some tips about customizing the >> interface. >> >> One website I read said I shouldn't change any of the Django source but >> if I want to set up a slightly different login page for example, to put the >> admin files in my local directories that I'm working with. >> >> The real question is that I was able to edit some template files to >> change some of the wording displayed but when I tried to edit the CSS files >> to get a different design I did not see any changes when I restarted my >> server. Is there some sort of collectstatic command that needs to be run? >> Any input on how to propagate these CSS files through would be great. >> >> Thanks, >> >> 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/-/8Cop1sBPfqYJ. 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.
Customizing the Django Admin Interface
Hello, I was able to locate the Django files for the admin under contrib in the source. I was curious if I could get some tips about customizing the interface. One website I read said I shouldn't change any of the Django source but if I want to set up a slightly different login page for example, to put the admin files in my local directories that I'm working with. The real question is that I was able to edit some template files to change some of the wording displayed but when I tried to edit the CSS files to get a different design I did not see any changes when I restarted my server. Is there some sort of collectstatic command that needs to be run? Any input on how to propagate these CSS files through would be great. Thanks, 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/-/RoJCeAFKCZ0J. 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: Output of form in Extjs
Hi Russell, I would like to create was plugin, as you presentation. I would like to contribute with this code. How can it help you? Thank's On Wednesday, September 5, 2012 8:46:06 AM UTC-3, Russell Keith-Magee wrote: > > Hi João, > > Thanks for the suggestion, but this isn't something we're likely to > add to Django's core itself. > > This is for two reasons. The first is that we have been specifically > avoiding any dependency on any particular database library. Django is > a server-side framework, so we don't want to impose any client-side > decisions on users. > > The second is that we want to move away from the .as_* model, towards > a more flexible approach. There was a Summer of Code project last year > aimed at moving the forms library to a templates approach; that hasn't > come to completion yet, but the broader aim still stands -- rather > than try an encode every possible output format, we'd like to move to > a place where an end user can plug in any output format. To that end, > your ext2js renderer would be an end-user plugin, rather than > something built into Django itself. > > Yours, > Russ Magee %-) > > On Wed, Sep 5, 2012 at 3:05 AM, JJ <joaoju...@gmail.com > > wrote: > > Hi all, > > I created parse django to extjs in modelforms and forms. Basically works > as > > form.as_p but is form.extjs_output. I mapped all widgets fields to > extjs. I > > would like to submit this code to django-project. What do you think? > > Thank you. > > > > João Júnior > > > > -- > > 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/-/h6rzplc6r3kJ. > > To post to this group, send email to > > django...@googlegroups.com. > > > To unsubscribe from this group, send email to > > django-users...@googlegroups.com . > > For more options, visit this group at > > http://groups.google.com/group/django-users?hl=en. > -- 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/-/Rr_3g9NbW5kJ. 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.
Output of form in Extjs
Hi all, I created parse django to extjs in modelforms and forms. Basically works as form.as_p but is form.extjs_output. I mapped all widgets fields to extjs. I would like to submit this code to django-project. What do you think? Thank you. João Júnior -- 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/-/h6rzplc6r3kJ. 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.
My "Contributors" page Conundrum
Hello, I'm trying to develop a simple hyperlink between two pages. It sounds simple but it's a little bit more complex then that. Here is the template code that proceeds through the database of contributors: Contributors {% for Contributor in Contributors_List %} http://www.madtrak.com/about/contributors/;>{{ Contributor.name }} Title: {{ Contributor.title }} {% endfor %} and spits out the contributors name in a link form and the title of that person. My problem is that I want each contributor to have their own separate page. So if the first guys name for some example is Mike Smith then if you were to click his name for example you would be sent to /about/contributor/mikesmith and so on. I supposed I could define a url for each contributor so I could set this up: Contributors {% for Contributor in Contributors_List %} {{ Contributor.name }} Title: {{ Contributor.title }} {% endfor %} but that doesn't seem like the correct way to do this. that Contributor.link is then hardcoded into the system. It's not generated by the system obviously. I also have: def mikesmith(request): mikesmith = Contributor.objects.filter(name='Mike Smith') return render_to_response('mikesmith.html', {'Contributor': mikesmith}, context_instance = RequestContext(request)) I have that repeated for each and every contributor. This goes againist Django's DRY mentality so I have a feeling there is a much better way. Thanks, JJ -- 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/-/xWx39cCFzvYJ. 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.
Question about RSS Feeds and a Weblog
Hello, I'm considering the act of starting a weblog like the Django one here: https://www.djangoproject.com/weblog/ on my personal website. This might be a super noob question but does anyone know what that runs on? Is it indeed a "blog" underneath the hood? I've seen that Django has RSS feeds and that sounds cool too so I wasn't sure if that's what the above link runs on? Any input on going about a sort of "timeline" esque page with entries similar to the one of above would be great! JJ -- 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/-/_jCkJmiLFtEJ. 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: I LOVE THIS COMMUNITY!
I agree too! On Tuesday, August 21, 2012 7:38:45 PM UTC-4, Peith wrote: > > i agree -- 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/-/eqKeF9UQshwJ. 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: Issue Deploying Django
Thank you mark for the great response. Let me add on to the reason I started this thread for any who missed it. I need to be able to have the capability to install geospatial libraries such as GEOS, PROJ, PostGIS, and possibly GDAL. On my current host i do not have root privleges and so if for example webfactiom doesnt have support for those then I would look into other options. I also dont want to rely on a premadr script from webfaction. Why? Well, i want complete flexibility to install any sort of add on I need for my django project. Thats where a VPS or cloud sever strikes me as being the right choice. Thanks to everyone for their time! JJ -- 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/-/7hRN8BTNc6UJ. 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: Setting APPEND_SLASH = False and PREPEND_WWW = True
Such a clean cut and knowledgeable answer. 10/10 thanks so much Russell! I'll make sure to add both to my settings file. Cheers, JJ On Thursday, August 9, 2012 10:50:26 PM UTC-4, Russell Keith-Magee wrote: > > On Fri, Aug 10, 2012 at 10:41 AM, JJ Zolper <codin...@gmail.com> > wrote: > > Hello all, > > > > I am interested in making these two changes to Django: Setting > APPEND_SLASH > > = False and PREPEND_WWW = True. > > > > The following links describe what each of these do but do not tell me > > actually where these settings reside so that I can actually change them: > > > > http://djangobook.com/en/2.0/chapter17/ > > http://django-book.readthedocs.org/en/latest/appendixD.html > > > https://docs.djangoproject.com/en/dev/ref/middleware/#django.middleware.common.CommonMiddleware > > > > https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-APPEND_SLASH > > > > I did not see them in my settings.py file where I expected them and I > don't > > want to go through my Django source trying to helplessly find it. > > When you generate your project, Django generates a sample settings.py > that contains the settings you're most likely going to need to > override -- things that involve paths, the list of apps you want to > install, and so on. > > There are *many* other settings that can form part of a Django project > -- they're all documented at the last link you provided. You can put > any of these settings in your own settings.py file. If you don't > provide them, the default value is used; if you do, your value is > used. > > If you want, you can even invent your own settings for your own app. > This might be handy for storing things like authentication keys for > third-party services. > > So - just put: > > APPEND_SLASH = False > PREPEND_WWW = True > > in your project's settings.py file, and you'll be off and running. > > Yours, > Russ Magee %-) > -- 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/-/b6cIZXxcKdEJ. 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: Issue Deploying Django
I absolutely agree that's why if a place like webfaction can't completely convince me that they can take care of everything I could want then I think I need to go with root access with a cloud server or VPS. Sorry for the long wait on the reply. On Friday, August 3, 2012 11:13:46 AM UTC-4, Kurtis wrote: > > With Cloud Servers, yes -- you do get Root access. It's basically the > equivelant of a VPS that you can easily spawn, scale, and replicate as > needed. > > Without root access on servers, virtual environments only get you so far. > What happens when you need to install Python imaging library but they don't > have a specific library? What happens when you decide you want to plugin to > some other library and the version of GCC they have is too ancient to > support its make system? etc These are just some examples of headaches > that may crop up without a good "open" system (such as a VPS, Cloud Server) > or a web host who explicitly supports Django. > > On Fri, Aug 3, 2012 at 10:18 AM, JJ Zolper <codin...@gmail.com > > wrote: > >> >Agreed that virtualenv will allow you to install python packages - >> however not any linux/unix packages. I have no problems using >Django on >> Dreamhost. http://dashdrum.com/blog/2011/08/django-on-dreamhost/ >> >> Thanks for the advice I will look into dreamhost too! >> >> On Fri, Aug 3, 2012 at 8:24 AM, Dan Gentry <d...@gentryville.net >> > wrote: >> >>> Agreed that virtualenv will allow you to install python packages - >>> however not any linux/unix packages. I have no problems using Django on >>> Dreamhost. http://dashdrum.com/blog/2011/08/django-on-dreamhost/ >>> >>> >>> On Thursday, August 2, 2012 10:34:35 PM UTC-4, trevorj wrote: >>>> >>>> You are trying to install packages system-wide when you don't have >>>> credentials to do so. >>>> >>>> You can install everything you need without cluttering the system >>>> itself. >>>> >>>> For instance, use a virtualenv and set your PREFIX. >>>> >>>> Either way, happy hacking! >>>> On Aug 1, 2012 8:32 PM, "JJ Zolper" <codin...@gmail.com > >>>> wrote: >>>> >>>>> I'm trying to install GEOS and on my bluehost account under my >>>>> django_src folder and what happened in the image happened. >>>>> >>>>> it said cannot create directory permission denied so i tired sudo make >>>>> install after what I had just done ( "make" ). >>>>> >>>>> and then it said whats in the second image. >>>>> >>>>> When I tried to run: >>>>> >>>>> ./manage.py runfcgi [options] >>>>> >>>>> I got an error about GEOS so that's why I was doing that. >>>>> >>>>> Thanks for the help. >>>>> >>>>> JJ >>>>> >>>>> On Wednesday, August 1, 2012 1:03:21 PM UTC-4, JJ Zolper wrote: >>>>>> >>>>>> Thanks so much for the reply! >>>>>> >>>>>> I had a feeling I would need it but I just like to be sure before I >>>>>> act. >>>>>> >>>>>> Another thing. On Ubuntu there were additional packages I had to >>>>>> install. I believe one was called "psycopg2-python-dev" or something >>>>>> like >>>>>> that. >>>>>> >>>>>> If I install psycopg2-python at: >>>>>> >>>>>> http://www.initd.org/psycopg/ >>>>>> >>>>>> Are there any additional packges that I might need? >>>>>> >>>>>> I apologize for not being able to remember the additional ones I >>>>>> added before on Ubuntu but I'm at work and couldn't find in my >>>>>> installation >>>>>> history what they might have been or in my django google group >>>>>> discussions. >>>>>> >>>>>> I feel like one was called "libpq-dev" actually. >>>>>> >>>>>> Thanks for the help. >>>>>> >>>>>> JJ >>>>>> >>>>>> On Wednesday, August 1, 2012 2:07:54 AM UTC-4, lawgon wrote: >>>>>>> >>>>>>> On Tue, 2012-07-31 at 20:52 -0700, JJ Zolper wrote: >>>>>>> > Do I need
Setting APPEND_SLASH = False and PREPEND_WWW = True
Hello all, I am interested in making these two changes to Django: Setting APPEND_SLASH = False and PREPEND_WWW = True. The following links describe what each of these do but do not tell me actually where these settings reside so that I can actually change them: http://djangobook.com/en/2.0/chapter17/ http://django-book.readthedocs.org/en/latest/appendixD.html https://docs.djangoproject.com/en/dev/ref/middleware/#django.middleware.common.CommonMiddleware https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-APPEND_SLASH I did not see them in my settings.py file where I expected them and I don't want to go through my Django source trying to helplessly find it. Thanks a lot, 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/-/uhtyGoccsi4J. 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: Issue Deploying Django
>Agreed that virtualenv will allow you to install python packages - however not any linux/unix packages. I have no problems using >Django on Dreamhost. http://dashdrum.com/blog/2011/08/django-on-dreamhost/ Thanks for the advice I will look into dreamhost too! On Fri, Aug 3, 2012 at 8:24 AM, Dan Gentry <d...@gentryville.net> wrote: > Agreed that virtualenv will allow you to install python packages - however > not any linux/unix packages. I have no problems using Django on Dreamhost. > http://dashdrum.com/blog/2011/08/django-on-dreamhost/ > > > On Thursday, August 2, 2012 10:34:35 PM UTC-4, trevorj wrote: >> >> You are trying to install packages system-wide when you don't have >> credentials to do so. >> >> You can install everything you need without cluttering the system itself. >> >> For instance, use a virtualenv and set your PREFIX. >> >> Either way, happy hacking! >> On Aug 1, 2012 8:32 PM, "JJ Zolper" <codinga...@gmail.com> wrote: >> >>> I'm trying to install GEOS and on my bluehost account under my >>> django_src folder and what happened in the image happened. >>> >>> it said cannot create directory permission denied so i tired sudo make >>> install after what I had just done ( "make" ). >>> >>> and then it said whats in the second image. >>> >>> When I tried to run: >>> >>> ./manage.py runfcgi [options] >>> >>> I got an error about GEOS so that's why I was doing that. >>> >>> Thanks for the help. >>> >>> JJ >>> >>> On Wednesday, August 1, 2012 1:03:21 PM UTC-4, JJ Zolper wrote: >>>> >>>> Thanks so much for the reply! >>>> >>>> I had a feeling I would need it but I just like to be sure before I act. >>>> >>>> Another thing. On Ubuntu there were additional packages I had to >>>> install. I believe one was called "psycopg2-python-dev" or something like >>>> that. >>>> >>>> If I install psycopg2-python at: >>>> >>>> http://www.initd.org/psycopg/ >>>> >>>> Are there any additional packges that I might need? >>>> >>>> I apologize for not being able to remember the additional ones I added >>>> before on Ubuntu but I'm at work and couldn't find in my installation >>>> history what they might have been or in my django google group discussions. >>>> >>>> I feel like one was called "libpq-dev" actually. >>>> >>>> Thanks for the help. >>>> >>>> JJ >>>> >>>> On Wednesday, August 1, 2012 2:07:54 AM UTC-4, lawgon wrote: >>>>> >>>>> On Tue, 2012-07-31 at 20:52 -0700, JJ Zolper wrote: >>>>> > Do I need to go through and install the python like adapters is that >>>>> > what it's complaining about? I don't think this has to do with my >>>>> > Django code on the server it's just a file missing right? >>>>> >>>>> you need to install pycopg - and it is nothing to do with your code >>>>> -- >>>>> regards >>>>> Kenneth Gonsalves >>>>> >>>>> -- >>> 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/-/**0Jx03fySUVUJ<https://groups.google.com/d/msg/django-users/-/0Jx03fySUVUJ> >>> . >>> To post to this group, send email to django-users@googlegroups.com. >>> To unsubscribe from this group, send email to django-users+unsubscribe@* >>> *googlegroups.com <django-users%2bunsubscr...@googlegroups.com>. >>> For more options, visit this group at http://groups.google.com/** >>> group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en> >>> . >>> >> -- > 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/-/9V4D-bMpS28J. > > 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. > -- 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: Issue Deploying Django
Yes when I saw no root privleges I realized very soon that I either have to get a new host that has what I need installed or get my own box and full control. With virtualenv I can install the packages on bluehost? On Thu, Aug 2, 2012 at 10:34 PM, Trevor Joynson <trevorjoyn...@gmail.com>wrote: > You are trying to install packages system-wide when you don't have > credentials to do so. > > You can install everything you need without cluttering the system itself. > > For instance, use a virtualenv and set your PREFIX. > > Either way, happy hacking! > On Aug 1, 2012 8:32 PM, "JJ Zolper" <codinga...@gmail.com> wrote: > >> I'm trying to install GEOS and on my bluehost account under my django_src >> folder and what happened in the image happened. >> >> it said cannot create directory permission denied so i tired sudo make >> install after what I had just done ( "make" ). >> >> and then it said whats in the second image. >> >> When I tried to run: >> >> ./manage.py runfcgi [options] >> >> I got an error about GEOS so that's why I was doing that. >> >> Thanks for the help. >> >> JJ >> >> On Wednesday, August 1, 2012 1:03:21 PM UTC-4, JJ Zolper wrote: >>> >>> Thanks so much for the reply! >>> >>> I had a feeling I would need it but I just like to be sure before I act. >>> >>> Another thing. On Ubuntu there were additional packages I had to >>> install. I believe one was called "psycopg2-python-dev" or something like >>> that. >>> >>> If I install psycopg2-python at: >>> >>> http://www.initd.org/psycopg/ >>> >>> Are there any additional packges that I might need? >>> >>> I apologize for not being able to remember the additional ones I added >>> before on Ubuntu but I'm at work and couldn't find in my installation >>> history what they might have been or in my django google group discussions. >>> >>> I feel like one was called "libpq-dev" actually. >>> >>> Thanks for the help. >>> >>> JJ >>> >>> On Wednesday, August 1, 2012 2:07:54 AM UTC-4, lawgon wrote: >>>> >>>> On Tue, 2012-07-31 at 20:52 -0700, JJ Zolper wrote: >>>> > Do I need to go through and install the python like adapters is that >>>> > what it's complaining about? I don't think this has to do with my >>>> > Django code on the server it's just a file missing right? >>>> >>>> you need to install pycopg - and it is nothing to do with your code >>>> -- >>>> regards >>>> Kenneth Gonsalves >>>> >>>> -- >> 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/-/0Jx03fySUVUJ. >> 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. >> > -- > 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. > -- 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: Issue Deploying Django
Yeah I've been looking into webfaction. Any information would be great thanks William! Only issues I would forsee is the root control. That is unless they have all that I need but at the same time I think I would lean to having root over not. Also I'm on a shared hosting right now and it's pretty good but I might be ready to get more serious with my own box and what not. On Thu, Aug 2, 2012 at 6:14 PM, william ratcliff <william.ratcl...@gmail.com > wrote: > I will say that I've had pretty good luck hosting with webfaction and > installing packages locally. They also have really good support--I'd tell > them your use case and ask them if it would work with them. Even though > it's shared hosting, I do have ssh--though not root > > William > > > On Thu, Aug 2, 2012 at 6:03 PM, JJ Zolper <codinga...@gmail.com> wrote: > >> Yes it seems that way. Thats because its shared hosting and i dont have >> root privleges. bluehost has hindered what I can do with Django. >> >> But does a cloud server at rackspace have root privleges like a vps? >> because i think i need to install these geospatial libraries to be able to >> really make forward progress with my site. >> >> I bought this hosting at bluehost a while ago but i didnt know as much as >> i do know about django and what i need etc so im thinking a new host. >> Either slicehost, maybe a cloud server, something like that with full >> control like root. >> >> JJ >> >> -- >> 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/-/jLF6C23y1pEJ. >> 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. >> >> > -- > 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. > -- 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: Issue Deploying Django
Yes it seems that way. Thats because its shared hosting and i dont have root privleges. bluehost has hindered what I can do with Django. But does a cloud server at rackspace have root privleges like a vps? because i think i need to install these geospatial libraries to be able to really make forward progress with my site. I bought this hosting at bluehost a while ago but i didnt know as much as i do know about django and what i need etc so im thinking a new host. Either slicehost, maybe a cloud server, something like that with full control like root. JJ -- 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/-/jLF6C23y1pEJ. 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: Issue Deploying Django
Thanks so much for the reply! I had a feeling I would need it but I just like to be sure before I act. Another thing. On Ubuntu there were additional packages I had to install. I believe one was called "psycopg2-python-dev" or something like that. If I install psycopg2-python at: http://www.initd.org/psycopg/ Are there any additional packges that I might need? I apologize for not being able to remember the additional ones I added before on Ubuntu but I'm at work and couldn't find in my installation history what they might have been or in my django google group discussions. I feel like one was called "libpq-dev" actually. Thanks for the help. JJ On Wednesday, August 1, 2012 2:07:54 AM UTC-4, lawgon wrote: > > On Tue, 2012-07-31 at 20:52 -0700, JJ Zolper wrote: > > Do I need to go through and install the python like adapters is that > > what it's complaining about? I don't think this has to do with my > > Django code on the server it's just a file missing right? > > you need to install pycopg - and it is nothing to do with your code > -- > regards > Kenneth Gonsalves > > -- 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/-/luCfpw0prn8J. 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: Error in Brand New Django 1.4.1 released Yesterday
Nope. Not Python 1.4. Django 1.4. http://pypi.python.org/pypi/Django/1.4#downloads I ran the following commands in the python interpreter and saw the following: >>> import django >>> print django.get_version() 1.4 I'm good to go. Not sure if the 1.4.1 file off of djangoproject.com is in the right shape so I went with what I knew, 1.4. Cheers, JJ -- 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/-/PprM-ZVPHDsJ. 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: Error in Brand New Django 1.4.1 released Yesterday
Okay I'm sure it's fine but I was able to get a hold of 1.4 from python.org and I used that when installing Django to my server on bluehost.com for the time being I'm going to go with that. Each time I tried to run the command on there after having downloaded the 1.4.1 file from https://www.djangoproject.com/download/ that's what I saw, 1.5. On Tuesday, July 31, 2012 3:45:50 AM UTC-4, James Bennett wrote: > > On Tue, Jul 31, 2012 at 2:42 AM, JJ Zolper <codinga...@gmail.com> wrote: > > What about if you download it from the link I put. > > When I said "I downloaded a copy of the 1.4.1 tarball", that's exactly > what I meant. > > django.get_version() prints '1.4.1'. I do not know what the problem is > with your local install, but I can verify that it is not an issue with > the package on djangoproject.com. > -- 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/-/CXVD0dSI93gJ. 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: Error in Brand New Django 1.4.1 released Yesterday
What about if you download it from the link I put. I mean I'm sure it's fine just pointing out that where I got it from it said 1.5 On Tuesday, July 31, 2012 3:30:31 AM UTC-4, James Bennett wrote: > > On Tue, Jul 31, 2012 at 2:15 AM, JJ Zolper <codinga...@gmail.com> wrote: > >>>> import django > >>>> print django.get_version() > > > > I didn't see 1.4.1 I saw 1.5 > > > > Sure it's probably a minor configuration fix to change it to 1.4.1 but I > was > > really worried that I did something wrong. > > > > Maybe someone else can repeat this and see if I made a mistake or that > > indeed something is wrong with the brand new release? > > Here is django/__init__.py in the 1.4 release branch: > > https://github.com/django/django/blob/stable/1.4.x/django/__init__.py > > VERSION is (1, 4, 1, 'final', 0). > > I downloaded a copy of the 1.4.1 tarball, unpacked it, and looked at > the __init__.py; again, VERSION was (1, 4, 1, 'final', 0). > -- 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/-/bX7XtGbM88wJ. 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.
Error in Brand New Django 1.4.1 released Yesterday
Hello all, I didn't realize a new release was put out until something weird happened. I'm installing DJ on my production server now and when I was downloading a copy from https://www.djangoproject.com/download/ and installed it and went into python: >>> import django>>> print django.get_version() I didn't see 1.4.1 I saw 1.5 Sure it's probably a minor configuration fix to change it to 1.4.1 but I was really worried that I did something wrong. Maybe someone else can repeat this and see if I made a mistake or that indeed something is wrong with the brand new release? Cheers to all! JJ -- 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/-/sN647bh67AAJ. 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: Models: Referencing A Model In Another App and Different Project
"As a general remark related to the issues that JJ has described... are there perhaps - or rather, should there be - pointers from the Django site that discuss some good practices to the overall approach of designing and building sites/projects/apps/databases - as opposed to the technical nitty-gritty of mode/view/form construction?" I second this motion! "It seems there are an increasing number of "newbies" flocking to Django, with perhaps little or no background in CS fundamentals, and guidelines like these would be a good place to point them at!" As far as web programming goes I would say that yes I am a newbie even though I am a Computer Engineer at Virginia Tech. More documentation on this topic would be grand! Thank you Derek for the comment! On Sunday, July 29, 2012 3:24:29 AM UTC-4, Derek wrote: > > As a general remark related to the issues that JJ has described... are > there perhaps - or rather, should there be - pointers from the Django site > that discuss some good practices to the overall approach of designing and > building sites/projects/apps/databases - as opposed to the technical > nitty-gritty of mode/view/form construction? > > It seems there are an increasing number of "newbies" flocking to Django, > with perhaps little or no background in CS fundamentals, and guidelines > like these would be a good place to point them at! > > > On Thursday, 26 July 2012 03:12:09 UTC+2, 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/-/CX4UbSGdzHIJ. 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: Models: Referencing A Model In Another App and Different Project
Okay well atleast im learning from my mistake! The reason I thought multiple projects was needed was because in each settings file I was tied to a database and i felt I need 5 databases. But it seems clear that i dont need that many projects. When you said "you should allocate webserver locations to these projects rather then start nesting projects" what do you mean? Yes exactly because its called mysite thats a sign that i should ony have one project! Yep. Yes i believe the sub projects are more of apps that tie to a table in one big database. So when you said "This is probably a lack in the documentation as well, but normally you'd handle stuff like static pages and the home page in the top-level project's inner directory or even bypass django completely by grabbing the urls in the webserver and serving static html. Views for the MadTrak project should be in: MadTrak/ settings.py views.py " You mean MadTrak/ settings.py views.py about models.py static/ css/ Web.css templates Index.html ?? OR do you mean MadTrak/ manage.py views.py MadTrak/ settings.py static/ css/ Web.css about models.py templates Index.html ??? "I think you should start by answering /why/ you need separate databases for this. If you have no clear reason, then that's your answer: you don't need separate databases. While a model corresponds to a table, a collection of models /does not/ correspond to a database." Yes i asked myself that question and i dont think i need seperate databases just simply put multiple models that correspond to multiple tables in one database. When you said "Also, the geodjango database drivers are not specifically for spatial databases. And similarly spatial databases can contain tables (and thus django models) that have no geometric fields. So - it is possible to use all your applications in a spatially enabled database with the spatially enabled database driver. " It really opened my eyes. It really did. Youre help is the type that will change my web building skills forever and im grateful to you for that. I can use the same database for good and enable it as spatial and use it for all my applications! Another thing. In a geodjango project my settings file looked like this: Database: django.contrib.gis.db Or whatever i forget exactly but in regular ones its Database: psycopg_postgresql Like my question is in my settings file for my solo project what do i put to have a spatially enabled django database but also have the postgresql. Im sure its simple but how do i " it is possible to use all your applications in a spatially enabled database with the spatially enabled database driver" ?? Database: -- 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/-/cHVGgxYHrfsJ. 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: Models: Referencing A Model In Another App and Different Project
You are probably right to be honest. I might be overdoing it with seperating things apart. I guess sometimes I'm too efficient! Here's some more to chew on though: 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. TO MICHAEL: Question 1 & 2. I don't really have to do it this way probably. I could place the code in the same artist project most likely. I might just be slightly naive right now when it comes to when to use a "project" and when to just break it down into code. The reason I wanted to connect is because that I have that separate GeoDjango project just for doing geographic type work and that is not in the same project space as Artist yet I want to do geographic work with the Artist database so I can return data based on the artist. Does that make sense? Question 3. I probably should but I don't quite feel like I know how to yet. And Conclusion for Michael: Combining the two sounds better everyday to be honest. It might be my best solution. So now that you see my directory tree might you be able to give me some advice how to attack this problem? Should I put my GeoDjango project in the Artist project? If it makes sense what I'm doing (Querying the Artist database in the Artist project with the GeoDjango cod) then what do you reccomend I do? Thanks, JJ On Thursday, July 26, 2012 9:14:08 AM UTC-4, (unknown) wrote: > > I'm not sure whether there is a good solution for this problem with the > prerequisites you mentioned. > Just because you import onde model doesn't mean you have full access to > the > underlying database of another project. > > If nobody comes up with a better idea (I never tried something similar), > here > is what I think: > > Do you really have to do it this way? Why do you need the connecting link > on > the model layer? > How about creating an interface to query the Artist app? (REST or > whatever) > > I'd either do that (REST), or I'd combine these two applications into one > project. > > good luck, > > Michael > > > -Original Message- > From: django-users@googlegroups.com on behalf of JJ Zolper > Sent: Thu 7/26/2012 3:12 AM > To: django-users@googlegroups.com > Subject: Models: Referencing A Model In Another App and Different Project > > 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 ca
Models: Referencing A Model In Another App and Different Project
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/-/uypkc91fB9AJ. 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: Query Distances from User
I agree I can have the user input city and state and do a lat lon as a basic search and let the user put in their home address or pan on a map for an advanced search. However given the large amounts of data Im striving for pure speed and efficiency. By possibly deciding againist geolocation and relying on the user I avoid extraneous server requests. I also give full control to my users. -- 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/-/LxLKs8ho84kJ. 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: Discovering Artists through GeoDjango by referencing my Artists database
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:/
Discovering Artists through GeoDjango by referencing my Artists database
I apologize for posting more than once I just wanted to make changes. I appreciate the help in advance! JJ -- 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/-/tXPsEMbkQe0J. 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: Query Distances from User
I dont believe I said it wasnt supported. Currently I am interested in having the user have the flexibility to change and update their location manually so they can find results in their area. I dont believe geolocation is the answer for that. I have the user input city and state and use WGS84 in lat lon and be able to calculate locations across america. -- 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/-/v0Rf91mzJeQJ. 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.
Discovering Artists through GeoDjango by referencing my Artists database
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/-/bveITGLO17IJ. 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.
Discovering Artists through GeoDjango by referencing my Artists database
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/-/ht2cfu74GawJ. 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.
Discovering Artists through GeoDjango by referencing my Artists database
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/-/nnsb5jjHLPgJ. 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.
Discovering Artists through GeoDjango by referencing my Artists database
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/-/fBEgEgm4qjAJ. 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: Query Distances from User
Thank you for the great information! Currently I'm focused on my desktop browser platform but if I move to mobile I'll consider GeoLocation! JJ On Tuesday, July 24, 2012 10:56:34 AM UTC-4, Melvyn Sopacua wrote: > > On 15-7-2012 4:30, JJ Zolper wrote: > > > So i was thinking maybe GeoIP might be good because it will use the > users > > location and last known GeoIP of the artist for example. > > > > I was curious if anyone had any ideas or better ideas then I had. > > IP addresses are only good if the remote address matches the physical > location [1]. > > Using geolocation [2] is probably a better solution especially since the > user can opt-in with it, support is growing [3] and available in mobile > devices. > > [1] > < > http://serverfault.com/questions/125944/with-more-mobile-users-my-geo-ip-database-is-becoming-useless> > > > [2] <http://www.mozilla.org/en-US/firefox/geolocation/> > [3] <http://diveintohtml5.info/geolocation.html> > -- > Melvyn Sopacua > -- 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/-/BmaWSc19WBkJ. 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: Query Distance from User
Just use Lat/Lon. You can fidget over which ojection to use later as long as your data is good. (WGS84 is the best btw) I agree lat long sounds beautiful to me! Well thats good. For geolocation, you can use the HTML5 Geolocation API that will use the person's browser to give you a location usually accurate to 200m (better if they're on a phone with gps), more than enough given your search radius of 200miles. Oh okay ill keep that in mind in case i make a iphone app cause right now i like the idea of lat long. For distance lookups, go with a simple bounding box algorithm (bounded by map edges, distance calc by pythagoras). Again exact positioning is NOT ESSENTIAL for your use case, especially on the 25mi scale. What about a circle? Use lat long equated to a city or address and do a circle with that point in lat long and find all the data within the circle? If you ever find yourself needing better/more accurate position calculation. use postgis, but never install from source, use your distro's packages (it Just Works tm). Should be called 'postgresql-9.1-postgis' on most distros. do a search. make sure you have libproj and libgeos installed as well. Is "it just works" a programming catch phrase? Haha. Yes the distros this next time not the other way. -- 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/-/W95IyM6TCqcJ. 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: Query Distance from User
I absolutely agree! That sounds like a much better way to install postgis and the other various packages. No more fiddling with my configure issues. I will try installing all of it tomorrow. -- 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/-/eSyJKGzdjigJ. 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: Query Distance from User
So wait, Does UTM have to do with the timezones in the USA? Do some of the lines match to tomezone lines? You also never really answered my question before. Sure it sounds like you know what UTM is but I sure dont and thats all youre talking about. If this is about the timezones or whatever then yes I can sort of imagine the issue youre talking about. I know what pythagoreans theorem is im a math guy but i cant quite pick how it applies to any of what we are talking about. Are you saying i need it to be able to calculate the circle and distances from a point in a 25 mile radius so x^2 +y^2 = 25 mi ^2? Sorry if i seem slow. Still new to this. JJ -- 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/-/yUDYlBFabCgJ. 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: Query Distance from User
g for dblatex... no configure: WARNING: dblatex is not installed so PDF documentation cannot be built configure: WARNING: could not locate Docbook stylesheets required to build the documentation checking CUnit/CUnit.h usability... no checking CUnit/CUnit.h presence... no checking for CUnit/CUnit.h... no configure: WARNING: could not locate CUnit required for liblwgeom unit tests checking iconv.h usability... yes checking iconv.h presence... yes checking for iconv.h... yes checking for libiconv_open in -liconv... no checking for iconv_open in -lc... yes checking for iconvctl... no checking for libiconvctl... no checking for pg_config... /usr/bin/pg_config checking PostgreSQL version... PostgreSQL 9.1.4 checking libpq-fe.h usability... yes checking libpq-fe.h presence... yes checking for libpq-fe.h... yes checking for PQserverVersion in -lpq... yes checking for xml2-config... no configure: error: could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter. jjz@jjz-Laptop:~/postgis-1.5.2$ make make -C liblwgeom make[1]: Entering directory `/home/jjz/postgis-1.5.2/liblwgeom' gcc -g -O2 -fno-common -DPIC -Wall -Wmissing-prototypes -c -o measures.o measures.c In file included from measures.h:16:0, from measures.c:18: liblwgeom.h:18:31: fatal error: ../postgis_config.h: No such file or directory compilation terminated. make[1]: *** [measures.o] Error 1 make[1]: Leaving directory `/home/jjz/postgis-1.5.2/liblwgeom' make: *** [liblwgeom] Error 2 jjz@jjz-Laptop:~/postgis-1.5.2$ sudo make install [sudo] password for jjz: make -C liblwgeom make[1]: Entering directory `/home/jjz/postgis-1.5.2/liblwgeom' gcc -g -O2 -fno-common -DPIC -Wall -Wmissing-prototypes -c -o measures.o measures.c In file included from measures.h:16:0, from measures.c:18: liblwgeom.h:18:31: fatal error: ../postgis_config.h: No such file or directory compilation terminated. make[1]: *** [measures.o] Error 1 make[1]: Leaving directory `/home/jjz/postgis-1.5.2/liblwgeom' make: *** [liblwgeom] Error 2 jjz@jjz-Laptop:~/postgis-1.5.2$ cd .. jjz@jjz-Laptop:~$ Which I feel like is an error? Wow really that sounds too good to be true haha its sounding better already! On Sunday, July 15, 2012 7:20:45 PM UTC-4, Jani Tiainen wrote: > > Or if your database backend supports spatial fields, you can let the > database to do the hard work and use Geodjango (built-in GIS extension) > which supports spatial operations like query by distance within. > > I think most standard databases can do that (mysql, postgresql, sqlite, > oracle) but I would recommend postgres + postgis if possible. > > Then everything is just matter of taste, you can pick pretty much any > coordinate system and you get the results you want. No math involved. > > On Mon, Jul 16, 2012 at 2:12 AM, JJ Zolper <codinga...@gmail.com> wrote: > >> I'm also thinking since Northern VA is so big in terms of people if I get >> a good thing going here I can port that to other major cities but if I find >> a less server heavy method I can use that for smaller areas possibly. Not >> sure, I'll see. >> >> JJ >> >> >> On Sunday, July 15, 2012 1:22:10 PM UTC-4, Nicolas Emiliani wrote: >>> >>> >>> >>> What you have just explained seems to be a good option! Is the option to >>>> use latitude and longitude a very common one? I'm not >>>> as familiar as to which options of calculation have known to be the >>>> most stable, usable, fast, or efficient. Or there is any common >>>> knowledge about the such thing. >>>> >>> >>> Well with (lat, long) you can point to any place on earth, it's like >>> having an (x,y) point on a cartesian plane. >>> And yes, it is the standard method. >>> >>> >>>> >>>> Here's what I'm thinking. First the user enters their town for example >>>> so Vienna, VA. Then they choose how far from their location so 25 miles. >>>> But then they also have an advanced search option where they can refine >>>> their request even more. They are able to play around with a Google Map on >>>> the side and zoom into their physical house location on the map and put a >>>> marker/point there of some sort. This could be lat/long I don't know yet. >>>> This way if that data checks out they get and even more accurate >>>> representation of the artists in their area. Any thoughts or opinions on >>>> how you think I >>>> should go about this? >>>> >>>> >>> With the (lat,long) that belongs to the user position yo can then ask >>> for a radius in block
Re: Query Distance from User
By UTM do you mean Universal Transverse Mercator? Well hmm I'm not quite sure what issue i would run into with someone living on the edge of the zone. Typically this request is a one time thing. The request goes in and the person either is within (on the line inside) the boundary or they are just out side. There are no moving parts here no flow of data across the screen just a direct request and a return of who fits that data. This search doesn't have to be built proof I mean I just want to get a basis of how to do this so I can see what happens. Also the portion about meters confuses me. Whats the benefit of the portion at the end? On Sunday, July 15, 2012 4:23:34 PM UTC-4, Dennis Lee Bieber wrote: > > On Sun, 15 Jul 2012 09:47:12 -0700 (PDT), JJ Zolper > <codinga...@gmail.com> declaimed the following in > gmane.comp.python.django.user: > > > > First the user enters their town for example so Vienna, VA. Then they > > choose how far from their location so 25 miles. But then they also have > an > > advanced search option where they can refine their request even more. > They > > are able to play around with a Google Map on the side and zoom into > their > > physical house location on the map and put a marker/point there of some > > sort. This could be lat/long I don't know yet. This way if that data > checks > > out they get an even more accurate representation of the artists in > their > > area. Any thoughts or opinions on how you think I should go about this? > > > I'm tempted to suggest using UTM internally, but you'd probably > end > up with somebody living on the edge of a zone, and having to special > case the search radius as it crosses the zone boundary. > > Reason to consider UTM? Coordinates are in meters, and computing > if > a point is within a 4m (40km => ~25 miles) just becomes a case of > applying Pythagoras [sqrt((x1-x2)^2 + (y1-y2)^2) <= radius]. > > http://www.uwgb.edu/dutchs/usefuldata/utmformulas.htm > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ > > -- 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/-/uynE7lYpqrwJ. 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.