Re: newbie problem with accepting form input

2010-12-13 Thread john doe
On Mon, Dec 13, 2010 at 6:12 PM, Titan, Jer-ming Lin wrote: > Hi John, > > each element in the choices is a two elements tuple. first one is > the real data will be saved in the database and second one will > present on the form. therefore, the max_length of 'type' field must

replacing integer with tuple value in template

2010-12-13 Thread morgand
I have a tuple set MY_TYPE = ( (0, 'Other'), (1, 'This'), (2, 'That'), ) In my model I have a field that uses "choices" to set the value. Can save/edit the model as a modelform fine. But I want to display a LIST of my records and replace the integer with the respective text ..

Re: I don't get the big picture (admin, etc.)

2010-12-13 Thread Christophe Pettus
On Dec 13, 2010, at 7:25 PM, cocolombo wrote: > 1) Should the players use the admin to loggin ? I think that there's a good hint given by the is_staff property of a User. The admin is best used by people you would consider "staff," rather than general users of the site. While it is certainly

Re: I don't get the big picture (admin, etc.)

2010-12-13 Thread Venkatraman S
On Tue, Dec 14, 2010 at 8:55 AM, cocolombo wrote: > I read a lot of documentation and books but there are still some very > basic things that I just don't catch about Django. > The docs and we are here to help :) But only if you spend sometime learning the bits yourselves.

I don't get the big picture (admin, etc.)

2010-12-13 Thread cocolombo
I read a lot of documentation and books but there are still some very basic things that I just don't catch about Django. Let's say I want to crate a very basic site for a simple game with no graphics, just text. 1) Should the players use the admin to loggin ? 2) Do I use the user objects, to

Re: newbie problem with accepting form input

2010-12-13 Thread Titan, Jer-ming Lin
Hi John, each element in the choices is a two elements tuple. first one is the real data will be saved in the database and second one will present on the form. therefore, the max_length of 'type' field must be modified to fit the first element in the choices tuple. Plz see the following code, i

redirects and ipv6

2010-12-13 Thread Michael P. Soulier
Hi, We're enabling ipv6 on a server and finding that redirects in django are broken. The host portion is being truncated. Is this a known problem? Thanks, Mike -- Michael P. Soulier "Any intelligent fool can make things bigger and more complex... It takes a touch of

Showing some extra HTML in a ModelForm

2010-12-13 Thread Elmar A.
Hi I'd like to add some additional HTML to to a model form in the admin backend. This HTML does not have any relevant form-functionality, i.e. it should just be displayed for the user. But I need the model instance to create the HTML. Basically, I want to fetch some images and show them to the

newbie problem with accepting form input

2010-12-13 Thread john doe
Dear all, I am making a small Django app for a bug tracking system to get my head round this awesome framework. I am facing a problem wherein when accepting input via a form generated by models. The classes are listed below (not in its entirety). [code] class Report(models.Model): #type

Utility of select_related when rendering ForeignKeys in a form? [Developer eyes appreciated]

2010-12-13 Thread Margie Roginski
Could someone with some developer background take a look at my question below and let me know if my understanding is correct? Let's say I have a Task model that contains a foreign key to a User: class Task(models.Model) owner = models.ForeignKey('auth.User') Now let's say I have a ModelForm

Re: __init__.py file executed twice ?

2010-12-13 Thread Mike Dewhirst
On Dec 13, 10:57 am, martvefun wrote: > On 10-12-10 11:09, Mike Dewhirst wrote: > > On 10/12/2010 7:43pm, martvefun wrote: > >> On 09-12-10 01:37, Mike Dewhirst wrote: > >>> It seems like a good place to put it. Maybe you can test to see if the > >>> threads have been started

Re: ForeignKey search

2010-12-13 Thread Daniel Roseman
On Monday, December 13, 2010 2:54:12 PM UTC, Michele JD Granocchia wrote:(django 1.2) Hi, i need to do the following: Class 1, with a field called "field1" (CharField) Class 2, with a field called "fieldwfk" (ForeignKey) User enters a text and submits, which goes into "searchtext" ---

Conditional inline for django admin

2010-12-13 Thread Nick
I am working with an app that has several different models that are connected to a central model via a ForiegnKey. I'd like to display a certain inline based on a value from the central model. Ex. model1 some_field central = ForeignKey(CentralModel) model2 some_field central =

Re: Paginator and foreign key

2010-12-13 Thread refreegrata
thanks for the answer, but the solution don't show anything. I must be doing something wrong. if now I have --- class Myline(models.mode): fk_myDoc = models.ForeignKey(MyDoc, related_name="") --- How Can I use {% for line doc.X_set.all %} in the

Any Python/Django developers in Silicon Valley?

2010-12-13 Thread MichelleAtTEK
Hi All, I am looking to network with Python/Django users in the South bay area for a long ter/FT opportunity. If you or anyone you know has 3+ years of experience with Python I would like to talk if for nothing more than networking. If interested please give me a call at 408.367.6833 or em

Re: Paginator and foreign key

2010-12-13 Thread bruno desthuilliers
On 13 déc, 16:59, refreegrata wrote: > Hello list, I have a question. Take a look to the next models. > > class MyDoc(models.Model): >     code = models.BigIntegerField() > > class Myline(models.mode): >    fk_myDoc = models.ForeignKey(MyDoc) >

Re: Question on passing user to model objects

2010-12-13 Thread Scoox
Hi Daniel, > However, calling foo.bar_set multiple times does *not* get the same > queryset each time. Okay, that was new to me :-)... Do you know what the reason for that is? > I discuss this a little in a blog > entry >

Re: Paginator and foreign key

2010-12-13 Thread refreegrata
if I return another list: --- for i in range(len(paginatorDocs.object_list)): resultados = {'myDoc': paginatorDocs.object_list[i], 'myLines': Myline.objects.filter(fk_myDoc=paginatorDocs.object_list[i].id),} --- With this I

form upload field and form validation

2010-12-13 Thread Daniel Carvalho
hi I have a form with a file upload field. If the form fails validation, the user has to give all the file fields another time. Someone told me it is possible to avoid that but I can't find more information... There was a thread about this before:

Re: Bringing down a website

2010-12-13 Thread Shamail Tayyab
Hi, Yes, we are using S3 for data. Actually its more related to load testing.. We are firing requests from another machine at Amazon and trying to attain an image quality vs size graph. Our quality of service depends on this data. @paul yes, that sounds nice. On Dec 13, 8:43 pm, Paul

Re: Bringing down a website

2010-12-13 Thread creecode
Hello Shamail, If you're running mod-wsgi you could try a variation on this technique from the folks over at Caktus Consulting Group. On Dec 13, 7:20 am, Shamail Tayyab wrote: > I am planning to write a handler like /shutdown which will ask me a > password and once down,

Re: Question on passing user to model objects

2010-12-13 Thread Scoox
> >     isEditable=0 > >     login=0 > > Assuming these two previous lines are at the top-level of you class > statement, both attributes will be class-attributes (that is "shared > by all instances"). I don't think this is what you want. Yes but that's what I intended. They should (and do) not

Paginator and foreign key

2010-12-13 Thread refreegrata
Hello list, I have a question. Take a look to the next models. class MyDoc(models.Model): code = models.BigIntegerField() class Myline(models.mode): fk_myDoc = models.ForeignKey(MyDoc) --- In my view I do something like

Re: slightly complicated radio input question

2010-12-13 Thread yiftah
thanks Ilian, I used the RadioSelect widget to create a radio list. but i want to create text/select elements between the radio elements (as in my example above) any ideas? yiftah -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Bringing down a website

2010-12-13 Thread Paul Winkler
On Dec 13, 10:20 am, Shamail Tayyab wrote: > What could be the simplest way to do it without altering any of my > current views or anything? Write a view for /shutdown which sets some global flag eg. in the database, then write some middleware to do the rest:

ForeignKey search

2010-12-13 Thread Michele JD Granocchia
(django 1.2) Hi, i need to do the following: Class 1, with a field called "field1" (CharField) Class 2, with a field called "fieldwfk" (ForeignKey) User enters a text and submits, which goes into "searchtext" --- searchtext = request.GET.get('text') Now i want to get all Class2 objects WHERE

Re: Bringing down a website

2010-12-13 Thread Venkatraman S
# For preserving the data, use S3? # Why not handle the 'bad' case in the test cases themselves? # Arent you running the test cases on the box itself? or is it a different entity? (I am not sure how this works on amazon though) -V- http://blizzardzblogs.blogspot.com/ --

Bringing down a website

2010-12-13 Thread Shamail Tayyab
Hi, I am running a website which is currently running in its test phase, it is a site which consumes too much bandwidth when running. We are running the site on Amazon EC2 and paying bandwidth cost. At times, I need to preserve over usage of data by bringing down the website while our test

Re: Question on passing user to model objects

2010-12-13 Thread Daniel Roseman
On Monday, December 13, 2010 11:20:21 AM UTC, Scoox wrote:Hi Daniel, thanks for your answer. Sorry, cmp should be c. I tried to only give the import parts to make it more readable, but I made a mistake there. The model code is pretty standard, except for one function: isEditable=0 login=0 def

newbie question: Error while using tddspry module

2010-12-13 Thread girish shabadimath
Hi all, Im working on djnago 1.2 i need to write tests for django models, what actually do i need to test in models? and also i found this link from google - http://playpauseandstop.github.com/tddspry/writing_tests.html#database-tests-with-databasetestcase

Re: Closing or resetting long-running connections

2010-12-13 Thread David De La Harpe Golden
On 12/12/10 12:10, Craig Trader wrote: > What I would like to be able to do is to have my background process > close and/or reset its database connection, as often as necessary. > > Thank you in advance for any assistance you can render. Yeah, note that django normally actually closes the

Re: Using the Django Admin to change a password.

2010-12-13 Thread derek
I've been getting the same error. There are a number of tickets that have been posted about this, most of which were closed, the reason been given that they are duplicates of: http://code.djangoproject.com/ticket/3011 which has been open for four (4!) years.

Re: Question on passing user to model objects

2010-12-13 Thread bruno desthuilliers
On 13 déc, 12:20, Scoox wrote: > Hi Daniel, > thanks for your answer. Sorry, cmp should be c. I tried to only give > the import parts to make it more readable, but I made a mistake there. > The model code is pretty standard, except for one function: > >    

Re: default_if_none as settings (??)

2010-12-13 Thread PyMan
Oohh yes! That is what I was looking for. Still thanks! As you said it's not working exactly how I use to rememeber...but it's ok! :) On 13 Dic, 14:15, bruno desthuilliers wrote: > On 13 déc, 10:00, PyMan wrote: > > > Maybe I'm wrong

Re: default_if_none as settings (??)

2010-12-13 Thread bruno desthuilliers
On 13 déc, 13:15, Brad Reardon wrote: > If I understand correctly, then the solution would be to do something of > this sort: (pardon the formatting) > > if value: >     {{value}} > else: >     {{default_value}} You may want to read about the builtin "default" and

Re: default_if_none as settings (??)

2010-12-13 Thread bruno desthuilliers
On 13 déc, 10:00, PyMan wrote: > Maybe I'm wrong but I remember about a setting whose I don't remember > the name...acting like a default for default_if_none where > default_if_none was not used. > > Example: > {{ value }}  <-- I forgot about using the

Re: default_if_none as settings (??)

2010-12-13 Thread Brad Reardon
If I understand correctly, then the solution would be to do something of this sort: (pardon the formatting) if value: {{value}} else: {{default_value}} Something of that sort *should* work, although I am not entirely sure. On Mon, Dec 13, 2010 at 4:00 AM, PyMan

ANN: django-admin-tools 0.4.0 released

2010-12-13 Thread David Jean Louis
Hello, I'm happy to announce the availability of the version 0.4.0 of django-admin-tools. Django-admin-tools is a collection of extensions/tools for the default django administration interface, it includes: * a full featured and customizable dashboard, * a customizable menu bar, *

Re: Display related field in queryset

2010-12-13 Thread Marcos Moyano
You can use field lookups: http://docs.djangoproject.com/en/dev/topics/db/queries/#field-lookups-intro ie: Travels.objects.values('date', 'destination__name') Rgds, Marcos On Mon, Dec 13, 2010 at 6:51 AM, nsbk wrote: > Hello, > > I'm using

Re: Question on passing user to model objects

2010-12-13 Thread Scoox
Hi Daniel, thanks for your answer. Sorry, cmp should be c. I tried to only give the import parts to make it more readable, but I made a mistake there. The model code is pretty standard, except for one function: isEditable=0 login=0 def editable(self): if self.login==0: return

Dynamic Fields and Saving data per user

2010-12-13 Thread Dan
I am trying to make an app where each user will have like a mailing list for which they should be-able to create custom fields for any data they may want to hold and be able to save multiple rows of that data. I was thinking to use a model to hold the fields definitions and a key value system to

Re: Question on passing user to model objects

2010-12-13 Thread Daniel Roseman
On Monday, December 13, 2010 10:22:32 AM UTC, Scoox wrote:Hi guys, I have a (probably easy) question. I need to pass the logged in user to my objects. I have the objects company and offer. I tried the following on the project's index / start view: c = Company.objects.all()

Re: Rendering a field value in a custom way

2010-12-13 Thread Scoox
Hi Wayne, thanks for your answer. I now created a function that applies the render functions dynamically to the object. So get_* is automagically created. You are right about the downsides of this approach. However my designer really does not like filters, so I have to stick to the approach.

Question on passing user to model objects

2010-12-13 Thread Scoox
Hi guys, I have a (probably easy) question. I need to pass the logged in user to my objects. I have the objects company and offer. I tried the following on the project's index / start view: c = Company.objects.all() cmp.login=request.user for j in cmp.offer_set.all():

Display related field in queryset

2010-12-13 Thread nsbk
Hello, I'm using http://code.google.com/p/django-jqgrid/ to display grids into a Django application. Since I'm pretty new to Django I don't know how to tell Django to retrurn the value of the related field instead of the id of the related field. What I do now is: travels =

default_if_none as settings (??)

2010-12-13 Thread PyMan
Maybe I'm wrong but I remember about a setting whose I don't remember the name...acting like a default for default_if_none where default_if_none was not used. Example: {{ value }} <-- I forgot about using the "default_if_none" filter If the setting I'm talking about is defined then its value is