How can I create a sequence number for a data set in the model?

2012-04-06 Thread Mark Phillips
I want to create a sequence of values for a column in one of my tables in the model class. The sequence number is updated every time a new rows is added to the table. The sequence number is reset to zero when a foreign key value changes. Is this possible, and how would I do it? Here is the

Re: serialize field name instead of "pk"

2012-04-06 Thread Russell Keith-Magee
On 07/04/2012, at 9:30 AM, Brian Craft wrote: > I have a model with a "name" field that is the primary key. When > serializing, this field gets serialized as "pk" instead of "name". > > Is there an easy way to get django to serialize with the actual field > name instead of changing it to pk?

Re: Editing custom user profiles information in the admin panel

2012-04-06 Thread abisson
Okay... and how is the SQL in the back? Does it do joins between the two tables or what? That slows down a lot no? On Apr 6, 9:11 am, Ejah wrote: > Hi, > You must add your app to the installed apps. Editting through the > admin requires you to register an admin form for

serialize field name instead of "pk"

2012-04-06 Thread Brian Craft
I have a model with a "name" field that is the primary key. When serializing, this field gets serialized as "pk" instead of "name". Is there an easy way to get django to serialize with the actual field name instead of changing it to pk? -- You received this message because you are subscribed to

Re: Tutorial

2012-04-06 Thread Jonathan Baker
Glad to help! On Fri, Apr 6, 2012 at 5:58 PM, Gerald Klein wrote: > OK makes a complete sense and worked the first time thanks very much. > > --jerry > > > On Fri, Apr 6, 2012 at 4:42 PM, Jonathan Baker < > jonathandavidba...@gmail.com> wrote: > >> You redeclaring your Model

Re: Tutorial

2012-04-06 Thread Gerald Klein
OK makes a complete sense and worked the first time thanks very much. --jerry On Fri, Apr 6, 2012 at 4:42 PM, Jonathan Baker wrote: > You redeclaring your Model classes, and you don't need to. By doing so, > the 'self' inside your __unicode__ function refers to a

How can I access log production server?

2012-04-06 Thread Arruda
Hi there, I'm using nginx and fastcgi(using threaded method) to run a django project, but when another thread start I get some erros. But I don't know if this is a thread problem or a db problem or what... But wanted to know if there is someway to get log from the production server. When I use

Re: calculate default values for fields based on the content of other fields

2012-04-06 Thread Python_Junkie
Capture the value from the form submitted into a variable. Use straight sql to query the table and the field that you are interested in and translate the field based on sql. It is not necessary to only use the ORM. This is an abstraction layer, and sometimes the restrictions based upon

Re: Tutorial

2012-04-06 Thread Jonathan Baker
You redeclaring your Model classes, and you don't need to. By doing so, the 'self' inside your __unicode__ function refers to a property that isn't defined (since you redeclared the original class that had the property). Here is what the model should look like: http://codepad.org/P21ZNkZY On Fri,

Re: Tutorial

2012-04-06 Thread Gerald Klein
Hi and thanks for the response here is the code minus the line numbers -- copied from vim, all my tabs are right and I had the right underscores. Please let me know if you see something. thanks again --jerry class Poll(models.Model): 8 question = models.CharField(max_length=200) 9

Re: storing objects in session

2012-04-06 Thread Shawn Milochik
Try using pdb and/or logging statements to trace it. You will almost certainly find your problem that way. If not, you'll be able to ask a more specific question that will be easier for others to answer. On Apr 6, 2012 3:11 PM, "imgrey" wrote: > I'm trying to store temporary

Re: HttpResponse_is_string is removed Django 1.4

2012-04-06 Thread Rajat Jain
Thanks for the reply. Yeah I was just setting this to true. On Friday, April 6, 2012, Ian Clelland wrote: > > > On Thu, Apr 5, 2012 at 6:07 PM, Rajat Jain wrote: >> >> Hi, >> I have noticed that the class variable HttpReponse._is_string (in

storing objects in session

2012-04-06 Thread imgrey
I'm trying to store temporary cart in session, but cart items disappear after 3-4 page reloads. This is simplified version of my code, that reproduces the issue: """ class C(object): ITEMS = {} def pprint(self): return str(self.ITEMS) class I(dict): pass def

Re: Tutorial

2012-04-06 Thread Jonathan Baker
Jerry, You'll want to be sure your method is defined as: def __unicode__(self): return self.name # I'm using 'name' as an example field with double underscores on both sides of 'unicode' instead of just in front of it. Hope this helps, Jonathan On Fri, Apr 6, 2012 at 12:13 PM, jk121960

Tutorial

2012-04-06 Thread jk121960
Hi, I am going through the tutorial, I am experienced programmer and I am learning django. Every thing was fine till the portion where you add the __unicode() methods to the classes. When I execute the Poll.objects.all() ant the command line it doesn't look any different."[]" just like the first

Re: How to restrict values in admin input form?

2012-04-06 Thread Shawn Milochik
https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#adding-custom-validation-to-the-admin Essentially, make a ModelForm exactly as you would normally, and add logic to it. You're going to want to change the queryset of the field(s) in question. For example: class

How to restrict values in admin input form?

2012-04-06 Thread Mark Phillips
I have a table D that contains two foreign keys from tables A and B. There is another table in the model, call it C, that relates the keys in A and B. In the admin input form for table D, I want to restrict the values for B based on what the user input for A and the values already stored in table

Re: Editing custom user profiles information in the admin panel

2012-04-06 Thread Ejah
Hi, You must add your app to the installed apps. Editting through the admin requires you to register an admin form for your profile. Syncdb and you can edit. Hth On 6 apr, 05:56, abisson wrote: > Good evening, > > I just tried the

Re: Unable to open database file ( Asking graphite and django forum )

2012-04-06 Thread Ejah
Having better read your first posting, the problems lies before this. You are supposed to create a project first through django-admin. This will create a template directory where your own settings.py and manage.py resort. You now seem to be editting the framework templates, and that will not

Re: Django default templates

2012-04-06 Thread Jagdeep Singh Malhi
> Im having problems figuring out how to work my way through part 2 of > the tutorial, where I have to copy some default django templates to my > own template directory. Where are the default django templates, Default Django Templates for admin : /your_system_python_path/django/

Re: HttpResponse_is_string is removed Django 1.4

2012-04-06 Thread Ian Clelland
On Thu, Apr 5, 2012 at 6:07 PM, Rajat Jain wrote: > Hi, > > I have noticed that the class variable HttpReponse._is_string (in > django/http/__init__.py) is removed in Django 1.4. I was setting this > variable in a couple of places in my code, so that piece of code is >

Django default templates

2012-04-06 Thread Simon Boje Outzen
Hello Im having problems figuring out how to work my way through part 2 of the tutorial, where I have to copy some default django templates to my own template directory. Where are the default django templates, and where are my own templates? Or do I just create a new folder for templates and copy

Editing custom user profiles information in the admin panel

2012-04-06 Thread abisson
Good evening, I just tried the following https://docs.djangoproject.com/en/1.4/topics/auth/ in order to add some custom fields to my users. I just looked in the DB and admin panel, and these new fields were not added to the auth_user table, nor the User Admin Panel. I created a new app that

Re: Problem with the tutorial.

2012-04-06 Thread x...@poczta.fm
# Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. Not 'django.db.backends.sqlite3' but 'sqlite3'. On 5 Kwi, 21:28, "J. Cliff Dyer" wrote: > You might be overriding the DATABASES setting later on in your settings > file, or you might not be

Re: Unable to open database file ( Asking graphite and django forum )

2012-04-06 Thread KriRad
Corrected sqllite3. drwxrwxrwx 2 admin admin 4096 2012-04-06 17:56 db I am at my wits' end. RRDTool seems enticing. Thanks. On Apr 6, 2:10 pm, Ejah wrote: > Hi, > Two things spring to mind immediately: > One: You have a double 'l' in ENGINE':

Re: calculate default values for fields based on the content of other fields

2012-04-06 Thread Ejah
I think there are two sensible approaches to this: 1. Write some customer javaScript and set the values of your form fields based on the first field 2. Use a form wizard, form 1 contains the base word, form 2 contains all the various variants. As you generate form 2 after 1, you are able to use

Re: Unable to open database file ( Asking graphite and django forum )

2012-04-06 Thread Ejah
Hi, Two things spring to mind immediately: One: You have a double 'l' in ENGINE': 'django.db.backends.sqllite3' Two: Do you have the proper rights in the 'db' directory to create/ write/read? HTH Ernst On Apr 6, 7:25 am, KriRad wrote: > Hi, > > I have read previous