Need help with GeoDjango distance query.
http://stackoverflow.com/questions/14889780/distance-query-within-a-certain-distance-based-on-value-in-joined-table Basically I want all objects within a certain distance, AS WELL as within each object's preferred distance. -- 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: createsuperuser with a custom User model
Ah, I didn't add my fields to REQUIRED_FIELDS, thanks. I was thinking createsuperuser would look at the fields I had included in create_superuser's signature... On Sunday, February 10, 2013 7:04:59 PM UTC-5, Russell Keith-Magee wrote: > > > On Mon, Feb 11, 2013 at 7:48 AM, mack the finger > <nbv...@gmail.com > > wrote: > >> I created a custom User model. It has a few extra fields, most notably a >> "date_of_birth" field. Now when I try to crete a new superuser instance via >> the management command, I get this error: >> >> TypeError: create_superuser() takes exactly 4 arguments (3 given) >> >> My "create_superuser" manager method looks like this: >> >> def create_superuser(self, email, date_of_birth, password): >> u = self.create_user(email, date_of_birth, password) >> u.superuser = True >> u.save() >> return u >> >> The management command isn't asking for the dob... Is this a known >> shortcoming of the new custom User model, or am I not doing something right? >> > > If the management command isn't asking for the date of birth, then it > sounds like you haven't put the DOB field in the list of REQUIRED_FIELDS. > > > https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.models.CustomUser.REQUIRED_FIELDS > > The other possibility is that you're not using a pre-release version of > Django 1.5. Custom user models are a new feature, and aren't available in > Django 1.4; you have to use the 1.5 release candidate or a version from git > to get this feature. > > 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
createsuperuser with a custom User model
I created a custom User model. It has a few extra fields, most notably a "date_of_birth" field. Now when I try to crete a new superuser instance via the management command, I get this error: TypeError: create_superuser() takes exactly 4 arguments (3 given) My "create_superuser" manager method looks like this: def create_superuser(self, email, date_of_birth, password): u = self.create_user(email, date_of_birth, password) u.superuser = True u.save() return u The management command isn't asking for the dob... Is this a known shortcoming of the new custom User model, or am I not doing something right? -- 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.
Fabfile for a multi-server project
I'm working on building a fabric deployment for a project with a fairly complex environment. There will be 2+ app servers running django code, a few database servers running in some kind of master/ slave configuration, a rabbitmq server, a mail server, some load balancers, etc. There will be over 12 different machines at least. My question is how should I write fabric scripts for all these servers? I realize this isn't a fabric group, but I imagine there are a lot of people here who have used fabric extensively, and fabric doesn't have its own group... Right now I plan on having a separate repository for both server config files and deployment scripts, and another separate repo for the django application code. The deploy repo will have a 'deploy' folder, and then inside that folder there will be an 'app' folder, containing the fabfile for apt-get installing, as well as pip installing all requirements for the app server. I'll also have a 'db' folder which will contain a fabfile with a task for apt-get installing postgres, a task for copying over postgres config files, etc. Eventually, I'll have a separate folder for each type of server, with it's own fabfile. Is this the right way? Does it make much sense to have it split up like that? Would it be easier to have one fab file for all different servers? -- 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.
len(qs.all()) != qs.count()
>>> p=EtilizeProduct.objects.all().using('etilize')[23424] >>> p.productdescription_set.all() [] >>> p.productdescription_set.count() 4 Does anybody have any idea why count() returns 4, but all() returns an empty list? I'm not using any custom routers. >>> str(p.productdescription_set.all().query) 'SELECT "productdescriptions"."id", "productdescriptions"."productid", "productdescriptions"."description", "productdescriptions"."isdefault", "productdescriptions"."type", "productdescriptions"." localeid" FROM "productdescriptions" WHERE "productdescriptions"."productid" = 1015433472 ' When I try to enter that command into a dbshell, I get a syntax error. If I remove the quotation marks, I'll get the 4 results: $ ./manage.py dbshell --database etilize Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 269 Server version: 5.1.49-1ubuntu8.1 (Ubuntu) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SELECT "productdescriptions"."id", "productdescriptions"."productid", "productdescriptions"."description", "productdescriptions"."isdefault", "productdescriptions"."type", "productdescriptions"."localeid" FROM "productdescriptions" WHERE "productdescriptions"."productid" = 1011081147; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '."id", "productdescriptions"."productid", "productdescriptions"."description", "' at line 1 mysql> SELECT "productdescriptions".* FROM "productdescriptions" WHERE "productdescriptions"."productid" = 1011081147;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.* FROM "productdescriptions" WHERE "productdescriptions"."productid" = 10110811' at line 1 mysql> SELECT productdescriptions.* FROM productdescriptions WHERE productdescriptions.productid = 1011081147; +++---+--+--+ | productid | description | isdefault | type | localeid | +++---+--+--+ | 1011081147 | Symantec (10888497) Software Licensing | 0 | 0 |1 | | 1011081147 | Symantec VERITAS Storage Foundation v.5.0 Enterprise HA for DB2 Crossgrade License - Government - 1 Server - Price Level S | 1 | 1 |1 | | 1011081147 | Symantec VERITAS Storage Foundation v.5.0 Enterprise HA for DB2| 0 | 2 |1 | | 1011081147 | Crossgrade License - Government - 1 Server - Price Level S | 0 | 3 |1 | +++---+--+--+ 4 rows in set (0.12 sec) mysql> Bye What could be causing this? -- 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.
Handling huge fixtures
We have a feature of our django application where the user will enter a zipcode, and out site will lookup that zipcode against a database table and return the city and state. In order for us to do this, we have a ZipCode model, and a 22 thousand line initial_data.json fixture. The problem is that whenever we try to run *any* test, we have to wait about 60 seconds for that fixture to load, which is really annoying. Does anyone have any tips for handling situations like these? -- 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: Getting started with generic relations
I did read the docs. The ubiquious 'TaggedItem' example I just couldn't wrap my head around. I get it now though. For those who find this looking for a solution: Just add three fields to your model: content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() item = generic.GenericForeignKey('content_type', 'object_id') You can name them anything you want, as long as the names on the first two lines match the names in the third line's constructor. Basically the first line stores the type of object, the second line stores the object's primarykey, and the third line is a helper thats not even truly required, but makes it much much easier to use. Now you can just go: MyModel(item=WhateverModelInstanceYouWant, **other_opts) and it should all magically work. The 'content_type' and 'object_id' fields will be handled by the generic relation API. On Dec 6, 4:34 am, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On 5 déc, 20:30, mack the finger <nbvf...@gmail.com> wrote: > > > I can't quite wrap my brain around how to do generic relations. I have > > a `Receipt` model which is a receipt of a purchase. One of the fields > > is `item` which is a foreign key to a product model. I want to be able > > to not only have products, but other things that the user can buy. > > > What do I need to do here to allow me to link to other types? Just > > change the ForeignKey('Product') to generic.GenericForeignKey()? Is > > that it? > > Actually it's a bit more complicated - but the good news is that it's > documented:http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#generi... > > Please read the above doc first, then come back if you have problems ;) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Getting started with generic relations
I can't quite wrap my brain around how to do generic relations. I have a `Receipt` model which is a receipt of a purchase. One of the fields is `item` which is a foreign key to a product model. I want to be able to not only have products, but other things that the user can buy. What do I need to do here to allow me to link to other types? Just change the ForeignKey('Product') to generic.GenericForeignKey()? Is that it? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django admin for call center support?
I'm responsible for writing a customer service application for a django project, and it needs to be done by Monday (it's friday now). I'm currently getting it built with the Django Admin, but the bosses think the interface is too complex for the "knuckle-draggers" that commonly answer phones. I'm wondering is anyone out there has ever used the Django Admin for such purposes? Did you have to modify the interface in any way? Did your customer service agents have trouble navigating between the pages? Actually, has anyone out there ever had to deploy a Django Admin instance to a group of computer illiterate people? Were they able to cope? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
app engine and the non-rel stuff going on lately
I'm considering starting a project, and am leaning towards using google app engine instead of the traditional LAMP stack. The problem is that with app engine, you can't use django models, or anything else that depends on django models, which means no modelforms, no admin, no authentication, no third party-apps, etc. This is a huge drawback for me. Lately there has been some work getting non-relational databases working with django. In lieu of all of that, what is the likelihood that in the near future django will grow the ability to work more natively with app engine? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
defining models for unit testing only
I wrote a django 'app', thats basically just a class that takes a Queryset, some other information, and then outputs an HttpResponse object (it does some other things too). How do I write unit tests for this class? The app itself does not contain any models, yet the functionality of the class depends on a model. The testing docs do not mention anything about this. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
lightning talks at djangocon
i submitted two talk proposals for djangocon, but neither was accepted. I can easily condense both topics into 5 minute presentations. I have never attended a "con" such as djangocon, so forgive me. How do lightning talks work? Do you "sign up" to do one right before the lightning talk session, or do you have to submit it during the talk proposals? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
dumpdata/loaddata through ssh
$ ./manage.py dumpdata some_app | ssh prgmr "cat | /srv/proj/manage.py loaddata" I'm trying to send fixtures over to my production server. Is there a one liner that can do this without creating an intermediate file? The above code doesn't seem to work. I get "No fixtures found" returned. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.