Re: How to trace the raw executed sql in Django

2011-11-18 Thread Kayode Odeyemi
On Fri, Nov 18, 2011 at 5:18 PM, Tom Evans wrote: > On Fri, Nov 18, 2011 at 4:20 PM, Kayode Odeyemi wrote: > > Just for the sake of learning. How am I the one creating the queries? I > only > > created a model to be saved by calling save() on it. The rest is left to > &g

Re: How to trace the raw executed sql in Django

2011-11-18 Thread Kayode Odeyemi
Thanks Tom. On Fri, Nov 18, 2011 at 2:32 PM, Tom Evans wrote: > On Fri, Nov 18, 2011 at 1:25 PM, Kayode Odeyemi wrote: > > On Fri, Nov 18, 2011 at 12:04 PM, Tom Evans > > wrote: > >> > >> On Fri, Nov 18, 2011 at 8:20 AM, Kayode Odeyemi > wrote: > >&

Re: How to trace the raw executed sql in Django

2011-11-18 Thread Kayode Odeyemi
On Fri, Nov 18, 2011 at 12:04 PM, Tom Evans wrote: > On Fri, Nov 18, 2011 at 8:20 AM, Kayode Odeyemi wrote: > > Hello friends, > > > > I'm having a deep Django-MySQLDB error and I'm doing some debugging to > > trace exactly where the problem is. It seems to

How to trace the raw executed sql in Django

2011-11-18 Thread Kayode Odeyemi
Hello friends, I'm having a deep Django-MySQLDB error and I'm doing some debugging to trace exactly where the problem is. It seems to me that this is very related to MySQLDB cursor implementaton. What I want to do is to run the raw sql from the interactive mode like this: import MySQLdb db=MySQL

Re: rollback django-admin.py sqlflush

2011-10-27 Thread Kayode Odeyemi
On Thu, Oct 27, 2011 at 8:06 PM, Tom Evans wrote: > On Thu, Oct 27, 2011 at 6:24 PM, Kayode Odeyemi wrote: > > The docs says "Prints the SQL statements that would be executed for > > the flush command." > > Why did it truncate the data in the tables? > > &g

Re: rollback django-admin.py sqlflush

2011-10-27 Thread Kayode Odeyemi
The docs says "Prints the SQL statements that would be executed for the flush<https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-flush> command." Why did it truncate the data in the tables? On Thu, Oct 27, 2011 at 6:16 PM, Kayode Odeyemi wrote: > Hello

rollback django-admin.py sqlflush

2011-10-27 Thread Kayode Odeyemi
Hello all, I stupidly flush my db with sqlflush. Please how do I do a rollback? Is it possible? Thanks -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: How to make a foreign key field of type other than int?

2011-10-25 Thread Kayode Odeyemi
On Mon, Oct 24, 2011 at 6:30 PM, Carl Meyer wrote: > Hi, > > On Oct 24, 10:53 am, Kayode Odeyemi wrote: > > I'm sorry but it doesn't just seem to work for me. I have tried > > > > possibilities like: > > > > self.fields['branch_name&#x

Re: How to make a foreign key field of type other than int?

2011-10-24 Thread Kayode Odeyemi
On Mon, Oct 24, 2011 at 4:34 PM, Tom Evans wrote: > On Mon, Oct 24, 2011 at 4:21 PM, Kayode Odeyemi wrote: > > On Mon, Oct 24, 2011 at 2:57 PM, Tom Evans > wrote: > >> > >> On Mon, Oct 24, 2011 at 11:14 AM, Kayode Odeyemi > >> wrote

Re: How to make a foreign key field of type other than int?

2011-10-24 Thread Kayode Odeyemi
On Mon, Oct 24, 2011 at 2:57 PM, Tom Evans wrote: > On Mon, Oct 24, 2011 at 11:14 AM, Kayode Odeyemi > wrote: > > Hello all, > > > > class BranchModelChoiceField(ModelChoiceField): > > def label_from_instance(self, obj): > > return obj

Re: How to make a foreign key field of type other than int?

2011-10-24 Thread Kayode Odeyemi
ot make great indexes. > > Just change your primary key to be something like: > > class Branch(models.Model): >name = models.CharField(max_length=**255, primary_key=True) > > This approach has it's caveats specially when removing/renaming entries. I > wouldn't suggest this app

Re: How to add extra fields to User table

2011-10-24 Thread Kayode Odeyemi
On Sun, Oct 23, 2011 at 8:52 AM, Chen Xu wrote: > Hi, Every one: > I am trying to create a user registration form. > The default of User table has limited number of fields, but I want to add > more into it. > Therefore, I am wondering what is the better way to do it? Creating another > UserProfil

How to make a foreign key field of type other than int?

2011-10-24 Thread Kayode Odeyemi
Hello all, Is there a way to have a foreign key on a model which uses a type other than Django's forceful int type to make the storage for a ModelChoiceField widget? I have something like this I'm working with: forms.py class BranchModelChoiceField(ModelChoiceField): def label_

Re: CSRF verification failed. Request aborted.

2011-10-22 Thread Kayode Odeyemi
On Sat, Oct 22, 2011 at 9:40 PM, wrote: > On Sat, 22 Oct 2011 19:21:59 +0100 > Kayode Odeyemi wrote: > > > I am accessing my view from a Drupal application that sends in data > > via POST. I'm not using any REST API such as > > piston, django-tastypie. > &g

CSRF verification failed. Request aborted.

2011-10-22 Thread Kayode Odeyemi
Hello, I am accessing my view from a Drupal application that sends in data via POST. I'm not using any REST API such as piston, django-tastypie. A few days ago, I'm smiling and happy that it all worked. Today, it's a different story. I'm currently getting: Forbidden (403) CSRF verification fail

Re: django.db.models import Q help!

2011-10-21 Thread Kayode Odeyemi
On Fri, Oct 21, 2011 at 7:43 PM, Ian Clelland wrote: > On Fri, Oct 21, 2011 at 11:06 AM, Kayode Odeyemi wrote: > >> Hello, >> >> Please I need help with django.db.models.Q. I have the query below which >> is returning empty >> >> qs = >>

django.db.models import Q help!

2011-10-21 Thread Kayode Odeyemi
Hello, Please I need help with django.db.models.Q. I have the query below which is returning empty qs = Q(financial_institution=request.user.get_profile().financial_institution) txn = Transaction.objects.extra( where=['(tpin=%s or teller_no=%s or identifier=%s) AND financial_insti

Re: Constant name error undefined in custom template tags

2011-10-10 Thread Kayode Odeyemi
On Sun, Oct 9, 2011 at 8:49 PM, Daniel Roseman wrote: > On Sunday, 9 October 2011 20:26:26 UTC+1, Kayode Odeyemi wrote: > >> Hello, >> >> I'm creating a template tag that will will allow session variables stored >> as strings or >> dict in a view to be

Re: Javabean-like get & set on ModelForm

2011-10-10 Thread Kayode Odeyemi
r 2011 20:00:36 UTC+1, Kayode Odeyemi wrote: > >> Hello, >> >> I'm using Django ModelForm on add/edit URLs which are both sharing a >> single template file. The >> code I'm working with is like this: >> >> class WebappAuthorize(models.Model):

Constant name error undefined in custom template tags

2011-10-09 Thread Kayode Odeyemi
Hello, I'm creating a template tag that will will allow session variables stored as strings or dict in a view to be available in its template. The syntax is: {% session_value [view_name] [session_variable] [arg] %} But at the moment I don't know how I can get Django to stop throwing name errors

Javabean-like get & set on ModelForm

2011-10-09 Thread Kayode Odeyemi
Hello, I'm using Django ModelForm on add/edit URLs which are both sharing a single template file. The code I'm working with is like this: class WebappAuthorize(models.Model): institution_name = models.CharField(max_length=32, help_text="Enter your institution name") email = models.CharFie

Re: How to make Django pick new urls immediately

2011-10-07 Thread Kayode Odeyemi
On Fri, Oct 7, 2011 at 9:33 AM, Daniel Roseman wrote: > On Friday, 7 October 2011 09:20:03 UTC+1, Kayode Odeyemi wrote: >> >> 2011/10/6 Yaşar Arabacı >> >> maybe you should restart the server? And, do you include new urls in your >>> root url config? >>&

Re: How to make Django pick new urls immediately

2011-10-07 Thread Kayode Odeyemi
2011/10/6 Yaşar Arabacı > maybe you should restart the server? And, do you include new urls in your > root url config? > > OK! I just found out that if you have urls.py in different packages and these urls.py files are all included in the root package urls.py file of the app, if I have a url (say

How to make Django pick new urls immediately

2011-10-06 Thread Kayode Odeyemi
Hello, I don't know if I'm the only one experiencing this. I have multiple urls.py in different packages based on the similarities of the modules. Everytime I add a new url to urls.py, it doesn't take effect immediately. Always returning 404 until I have to do something... Can't remember what I di

Re: How to solve MultiValueDictKeyError

2011-09-21 Thread Kayode Odeyemi
On Wed, Sep 21, 2011 at 11:43 AM, Tom Evans wrote: > > On Wed, Sep 21, 2011 at 11:33 AM, Kayode Odeyemi > wrote: > > curl -v -H "Content-Type: application/json" -A 'Mozilla' -X POST --data > > 'fees={"fees":{"status":&qu

Re: How to solve MultiValueDictKeyError

2011-09-21 Thread Kayode Odeyemi
On Wed, Sep 21, 2011 at 11:43 AM, Tom Evans wrote: > On Wed, Sep 21, 2011 at 11:33 AM, Kayode Odeyemi > wrote: > > Hello friends, > > > > I don't know why Django is so unstable. > > I don't know why you cross posted this to django-developers. > My a

How to solve MultiValueDictKeyError

2011-09-21 Thread Kayode Odeyemi
Hello friends, I don't know why Django is so unstable. Before restarting my computer everything works fine. Django could parse a simple POST request without complaining KeyError. I'm simply making a POST request like this: curl -v -H "Content-Type: application/json" -A 'Mozilla' -X POST --data

Re: Pickling a QuerySet

2011-09-02 Thread Kayode Odeyemi
Thanks for this. I have a question. Is it possible to pickle a QuerySet and write to csv? I have been trying to use pickle to achieve the same stuff you just did. But I guess I've not been patient enough. Thanks On Fri, Sep 2, 2011 at 11:17 AM, Kevin wrote: > Wow! This is very interesting an

Re: Need Ideas On Data Migration

2011-08-24 Thread Kayode Odeyemi
+1 to South Just started with it myself On Wed, Aug 24, 2011 at 1:25 PM, Rory Hart wrote: > South[1] handles database migrations. both schema and data. It can be a > little tricky when first starting to use it but it is a powerful system. > > Otherwise you could alter the table yourself and cop

Re: saving several models with one save() call

2011-08-24 Thread Kayode Odeyemi
Dmitry, I understand what you are trying to do clearly, coming from a Java background myself. But this is Python. Do it the Python way. On Wed, Aug 24, 2011 at 6:33 PM, ernando wrote: > Hi Tom & Tundebabzy, > > I understood your idea & approach. But as I've mentioned - I receive > the model fro

Re: How to pass url parameters to template url tag

2011-08-11 Thread Kayode Odeyemi
On Thu, Aug 11, 2011 at 9:52 AM, Tom Evans wrote: > On Wed, Aug 10, 2011 at 7:06 PM, bruno desthuilliers > wrote: > > On 10 août, 16:35, Reinout van Rees wrote: > >> > >> Best solution: calculate that url in your python view code and just pass > >> it along in the context. > > > > Definitly not

Re: How to pass url parameters to template url tag

2011-08-11 Thread Kayode Odeyemi
On Wed, Aug 10, 2011 at 10:37 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On 10 août, 21:52, Kayode Odeyemi wrote: > > You don't pass anything from "one view to another". You eventually > pass data from a request to another, using either re

Re: How to pass url parameters to template url tag

2011-08-10 Thread Kayode Odeyemi
On Wed, Aug 10, 2011 at 6:57 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On 10 août, 16:30, Tom Evans wrote: > > > Now for the third solution: write your own template tag. Not > necessarily required, but that's often the best solution wrt/ > decoupling / flexibility / mainta

Re: spam in response to posting to this list

2011-08-10 Thread Kayode Odeyemi
I have been getting this too. On Wed, Aug 10, 2011 at 5:15 PM, Tom Evans wrote: > On Wed, Aug 10, 2011 at 5:06 PM, Eric Hutchinson > wrote: > > I responded to the thread about ordering tables, and got this as a > > response > > > > I reported the same thing a couple of days ago. Russell Keith-M

How to pass url parameters to template url tag

2011-08-10 Thread Kayode Odeyemi
Hello friends, I need some help on how to pass url parameters to template url tag. Something like this: my page page is the url parameter I want to get Thank you -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde -- You received this message because you are subscribed to the Google

Re: {django-tables} Caught NameError while rendering: global name 'name' is not defined.

2011-08-10 Thread Kayode Odeyemi
Thanks. I just simply result to core Django to get done what I need. On Wed, Aug 10, 2011 at 12:22 PM, Tom Evans wrote: > On Wed, Aug 10, 2011 at 12:16 PM, Subhranath Chunder > wrote: > > You seem to have heavily used external django apps like django-pagination > > and django-tables. > > I have

Re: {django-tables} Caught NameError while rendering: global name 'name' is not defined.

2011-08-10 Thread Kayode Odeyemi
27;) tx = TransactionReport().get_reports_paid(dataqs, req) return render_to_response('webapp/reports.html', {'table': tx, 'rows' : tx.rows}) rows is of type TransactionReport. On Wed, Aug 10, 2011 at 11:46 AM, Subhranath Chunder wrote: > &

Re: {django-tables} Caught NameError while rendering: global name 'name' is not defined.

2011-08-10 Thread Kayode Odeyemi
On Mon, Aug 8, 2011 at 12:34 PM, Kayode Odeyemi wrote: > Hello, > > Please why am I get the following error: > > Caught NameError while rendering: global name 'name' is not defined. > > Initially I did not receive this sort of error, it just surfaced all > o

Re: Passing tuple values to a model choices field

2011-08-09 Thread Kayode Odeyemi
#x27;name_branch', flat=True) branches_field = BranchModelChoiceField(branchqs) #ModelChoiceField instance class Meta: model = Transaction fields = ('branch_name') In template file I do this: {{form.branches_field}} Thanks everyone [1] https://docs.djangopr

Re: Passing tuple values to a model choices field

2011-08-08 Thread Kayode Odeyemi
I have made changes like this: """ Introduced a new model to store the form field select values """ class Branch(models.Model): """Branch""" name = models.CharField(max_length=50) name_branch = models.CharField(max_length=50) address_1 = models.CharField(max_length=100) class

Re: Passing tuple values to a model choices field

2011-08-08 Thread Kayode Odeyemi
27;s > pretty OK. > > As you put the widget in your field I think you just need to put > form.branch_name to get it to display. > Le 8 août 2011 14:07, "Kayode Odeyemi" a écrit : > > -- > You received this message because you are subscribed to the Google Gr

Re: Passing tuple values to a model choices field

2011-08-08 Thread Kayode Odeyemi
Orozco wrote: > Oh, sorry, I must have misunderstood then. > > I remember reading a post on thread on SO that addressed this, and I > believe that they came up with a template filter as there was no "simple" > way to do it. > > Here it is: > http://stackoverflow

{django-tables} Caught NameError while rendering: global name 'name' is not defined.

2011-08-08 Thread Kayode Odeyemi
Hello, Please why am I get the following error: Caught NameError while rendering: global name 'name' is not defined. Initially I did not receive this sort of error, it just surfaced all off a sudden. I restored my app to the state where everything worked and I'm still getting the same error. Fu

Re: Passing tuple values to a model choices field

2011-08-08 Thread Kayode Odeyemi
11 at 10:40 AM, Thomas Orozco wrote: > Check out get_FOO_display, there: > https://docs.djangoproject.com/en/dev/ref/models/instances/ > Le 8 août 2011 11:06, "Kayode Odeyemi" a écrit : > > > In the Django [1], the example as described below shows how to build > Forms

Passing tuple values to a model choices field

2011-08-08 Thread Kayode Odeyemi
In the Django [1], the example as described below shows how to build Forms that are tied to a model. from django.db import models from django.forms import ModelForm TITLE_CHOICES = ( ('MR', 'Mr.'), ('MRS', 'Mrs.'), ('MS', 'Ms.'), ) class Author(models.Model): name = models.CharFi

How to use django-tables with Paginator

2011-08-07 Thread Kayode Odeyemi
This question is related to django-tables. I hope I am allowed to post here. I will appreciate some help on how to use Django Paginator with django-tables. Below is what I have been working with: report.py import django_tables as tables from webapp.models import Transaction class T