Re: How to get the the filename of WGET?

2013-03-29 Thread Michael Elkins
In order to get the filename, you will need to use the multipart/form-data encoding (RFC2388). wget does not support this, but curl does when you use the -F option: curl -F file=@conf.xml http://192.168.23.73:8001/ipdb_file/ However, your code will need to be modified to use the

Re: get() returned more than one ....

2012-07-17 Thread Michael Elkins
On Tue, Jul 17, 2012 at 02:49:49PM +0200, francescobocca...@libero.it wrote: i have a question. In my Django views i used: def getpath(request,user="test"): userpathfile = FileStore.objects.get(username=user) return userpathfile my table FileStore contain 3 fields:

Re: Excluding items from a queryset

2012-07-16 Thread Michael Elkins
On Mon, Jul 16, 2012 at 01:38:47PM +0200, Sithembewena Lloyd Dube wrote: I have a queryset of categories and would like to exclude categories with no items associated. I am cycling through the queryset as follows, without the desired result: for cat in categories: if

Re: database values in a select form.

2012-07-09 Thread Michael Elkins
On Sat, Jul 07, 2012 at 08:25:54PM -0700, Lee Hinde wrote: What I'm noticing is that (in dev mode) the choice list for 'employment_status' doesn't update unless I trigger a change, either to the forms.py or restart the dev server. I'm wondering if there's a better place to handle this. Lee,

Re: Way to isolate inherited model classes?

2012-03-05 Thread Michael Elkins
On Mon, Feb 27, 2012 at 09:18:22AM -0600, Gene horodecki wrote: Hi there. I have a multi-table inheritance in my main application like this: MailItem->Parcel->LargeParcel Now I want to have a separate application called 'dispatch' that serves as a staging area as information comes in about

Re: problem with conditional form

2012-02-24 Thread Michael Elkins
On Fri, Feb 24, 2012 at 10:21:23AM -0800, Len De Groot wrote: I added a model to set the form-type to "0" or "1" which corresponds to "Long form" and "Short form" When I create a new long form and add the following to the form page template I get the expected answer:

Re: Converting a string representation of query to Django object (Q).

2012-02-22 Thread Michael Elkins
On Wed, Feb 22, 2012 at 02:04:37PM -0800, Matt Schinckel wrote: The other option, which should work in your case: expcodes = ['...', '...'] Result.objects.filter(analysis__experiment__experiment_code__in=expcodes) Q objects are great, but not always needed. I agree that this is the

Re: Converting a string representation of query to Django object (Q).

2012-02-22 Thread Michael Elkins
On Wed, Feb 22, 2012 at 01:15:04PM -0800, gowthaman ramasamy wrote: I am trying to construct the following query at the end. Result.objects.filter(Q(analysis__experiment__experiment_code="PyLS24") |Q(analysis__experiment__experiment_code="PyLS40")) How I do now: The values are passed from a

Re: Need help on a (maybe complex) query with aggregate/annotate

2012-02-21 Thread Michael Elkins
On Tue, Feb 21, 2012 at 01:10:28PM -0800, Enrico wrote: But your query counts all the books, even the bad ones. I only need to count the good ones... For example, if my books are: 1. name: LOTR, rating: 10, publisher: A ... 2. name: ASOIAF, rating: 10, publisher: A ... 3. name: Twilight,

Re: Need help on a (maybe complex) query with aggregate/annotate

2012-02-21 Thread Michael Elkins
On Feb 21, 6:11 am, Enrico wrote: > This query: > Publisher.objects.filter(book__rating__gt=3.0).annotate(num_books=Count('bo > ok')) > returns all the publishers with at least one good book (ranked > 3) > with annotated the number of good books for each publisher. > > How can

Re: field name hiding workaround

2012-01-31 Thread Michael Elkins
On Tue, Jan 31, 2012 at 07:59:38AM -0800, Jaroslav Dobrek wrote: class Lexeme(models.Model): class Meta: unique_together = ((u"entity", u"language"),) I beleive this will not work because Lexeme is not abstract, and it has no 'entity' field. language =

Re: Django models

2012-01-30 Thread Michael Elkins
On Mon, Jan 30, 2012 at 09:53:18PM +0800, Stanwin Siow wrote: but once my terminal creates the model classes do i have to copy it into my app's model.py? yes, you will need to copy the output to your models.py. you may need to edit it to put the models in order so that dependencies like

Re: Django models

2012-01-30 Thread Michael Elkins
On Mon, Jan 30, 2012 at 09:26:10PM +0800, Stanwin Siow wrote: However what does this error say? ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. If you have a manage.py for your project, you can just run "manage.py inspectdb" and it

Re: Django model problem

2012-01-30 Thread Michael Elkins
On Sun, Jan 29, 2012 at 08:22:40PM -0800, St@n wrote: I am trying to create a RESTful API with a django website i have running. The project folder is called rosebud and inside the folder r2 lies my application. I have tried to retrieve objects by calling the Users table in django's default

Re: Django models

2012-01-30 Thread Michael Elkins
On Mon, Jan 30, 2012 at 04:13:50AM -0800, St@n wrote: How do i ask django to query for a table that is already created in the database but not part of the models.py? the models.py is used to described the database and to create tables with that models.py. However i already have my tables

Re: get_FOO_display() for generic/variable choice fields

2012-01-27 Thread Michael Elkins
On Tue, Jan 24, 2012 at 03:51:27AM -0800, katstevens wrote: Obviously the 'val = obj.get_field_display()' line doesn't work! Is there a generic way of doing this (something like obj.get_display(fieldname) ?) or am I going to have to hard code separate checks for get_country_display() and

Re: Authentication over JSON

2012-01-07 Thread Michael Elkins
On Sat, Jan 07, 2012 at 11:52:26AM -0500, Kevin Anthony wrote: I have a small exposed json API, currently it doesn't require authentication, but i'd like to integrate it with django's authentication. A quick google search came up empty, and i was wondering if anyone had any recommendations on

Re: dumpdata and self referencing foreign keys

2012-01-06 Thread Michael Elkins
On Fri, Jan 06, 2012 at 07:47:45AM -0800, Michael Elkins wrote: My problem is that "django-admin dumpdata" does not sort the rows such that it avoids forward references for the foriegn key values, which is a problem since I'm using MySQL InnoDB tables. I see that this pro

dumpdata and self referencing foreign keys

2012-01-06 Thread Michael Elkins
I have a model which represents a tree structure using a foreign key to itself: class Foo(models.Model): name = models.CharField(max_length=30) parent = models.ForeignKey('Foo') My problem is that "django-admin dumpdata" does not sort the rows such that it avoids forward

Re: Passing variables from a context processor to a template

2012-01-05 Thread Michael Elkins
On Thu, Jan 05, 2012 at 09:03:56AM -0800, Guy Nesher wrote: I've created a simple context processor which simply returns a variable, however I'm unable to retrieve it from my template. "Each context processor must return a dictionary."

Re: Field Inheritance

2012-01-03 Thread Michael Elkins
On Mon, Jan 02, 2012 at 12:54:38PM -0800, Sepero wrote: I would like to suggest listing/displaying the Parent Class for classes on API pages like this- https://docs.djangoproject.com/en/1.3/ref/models/fields/ In part1 of the Django tutorial, it instructs to create a model like this- pub_date =