Re: Pango causing mod_wsgi to crash - Segmentation fault (11)

2011-10-16 Thread pbzRPA
Hi Florian, I have been working on the problem the whole weekend and after trying all the mog_wsgi debugging method I still do not have a solution. I do know that the error does not lie in my django code or my apache configuration as I did the exact setup on a ubuntu machine and it works 100%. It

Pango causing mod_wsgi to crash - Segmentation fault (11)

2011-10-15 Thread pbzRPA
Hi I was wondering if anyone had a similar problem when trying to use pango in django running under mod_wsgi on apache. I am running |20:11:06|# cat /etc/debian_version 6.0.3 When I run a runserver on the same server it works fine but the moment I "import pango" in any of my modules the

Pango causing mod_msgi to crash - Segmentation fault (11)

2011-10-15 Thread pbzRPA
Hi I was wondering if anyone had a similar problem when trying to use pango in django running under mod_wsgi on apache. I am running |20:11:06|# cat /etc/debian_version 6.0.3 When I run a runserver on the same server it works fine but the moment I "import pango" in any of my modules the

Re: Getting a class using a variable name.

2011-09-11 Thread pbzRPA
Ok, I found a way. I don't know if it's the best way but it works :) return getattr(__import__(module_name, fromlist = [class_name]), class_name) Thanks for the help. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Getting a class using a variable name.

2011-09-11 Thread pbzRPA
Hi Martin, Thanks for the tip. The thing is that I store my class names in the database. So class B(models.Mode): form_class = models.CharField(...) def get_form_class(self): return ..(self.form_class) <- this is where I need to some how get the class object from a

Re: Getting a class using a variable name.

2011-09-11 Thread pbzRPA
I should add that in the B class function get_a_class I only have a variable name "A" -- 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

Getting a class using a variable name.

2011-09-11 Thread pbzRPA
Hi, I have been struggling with this for a while now and I can't seem to find a way of returning a class object from a different module without importing it. Say I have two files: test_a.py class A(models.Model): pass test_b.py class B(models.Model): def

Re: Get child model class

2011-05-07 Thread pbzRPA
Ok this solution worked for me :):) {{{ from django.db import models from django.contrib.contenttypes.models import ContentType from django.db.models.query import QuerySet class SubclassingQuerySet(QuerySet): def __getitem__(self, k): result = super(SubclassingQuerySet,

Re: Get child model class

2011-05-07 Thread pbzRPA
this is more or less what I found. I will have to see how I can implement it on my side. http://djangosnippets.org/snippets/1037/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Get child model class

2011-05-07 Thread pbzRPA
Thank you, this is more or less what I am looking for. I don't however want to make the CF class an abstract class as I want to have some common fields in there. The Idea behind this is that I want to store custom fields (CF) for various models that a user will be defining themselves. I do not

Re: Get child model class

2011-05-06 Thread pbzRPA
Just to clarify your suggestion In [100]: isinstance(x, CFT) Out[100]: False In [101]: isinstance(x, CFI) Out[101]: False In [105]: isinstance(e, CF) Out[105]: True This is not what I am looking for. I want to know to what class the CF primary key points to. So if it's CFT or CFI -- You

Re: Get child model class

2011-05-06 Thread pbzRPA
I now the isinstance function but that will return the CF class. I want to know the child class of CF for that specific primary key. On May 6, 9:30 pm, Shawn Milochik wrote: > This might work: > > http://docs.python.org/library/functions.html#isinstance -- You received

Get child model class

2011-05-06 Thread pbzRPA
Hi, I am not sure if this is possible but it would really help if it is. I have 4 classes class CF(models.Model): class CFT(CF): data = models.CharField(max_length=20) class CFI(CF): data = models.IntegerField() class Doc(models.Model): name = models.CharField(max_length

Re: Check all foreign keys before delete.

2011-03-24 Thread pbzRPA
Great thanks, will definitely have a look. -- 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

Re: Check all foreign keys before delete.

2011-03-24 Thread pbzRPA
Hit the nail on the head :) Thank you very much for the quick response. Problem solved. -- 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

Check all foreign keys before delete.

2011-03-24 Thread pbzRPA
Hi, I am constantly running in a brick wall when it comes to deleting records in Django. If you have one or two foreign keys it is easy to check if they are in use, but once an application starts getting big you can not remember which models are making use of a foreign key and if a specific

Re: Queryset from 2 models with second model filtered.

2010-12-09 Thread pbzRPA
Typically I simply want to do a left join but have it as an object in django rather than a sql raw query. The queryset would look like. Select a.code as 'product_code', a.description as 'product_description', b.code as 'customer_code', b.code as 'customer_description',

Queryset from 2 models with second model filtered.

2010-12-09 Thread pbzRPA
Hi, I have a tricky one, I don't have an error but rather trying to avoid many database hits. I am trying to build a product database which can have different field values per customer. So the model would look something like this. class Customer(models.Model): name =

Re: Middleware for models

2010-02-13 Thread pbzRPA
Ok, I think I have sorted out my queryset problem, I wrote a custom manager: class UserBranchModelManager(models.Manager): def for_request(self, request): if settings.DO_BRANCH_FILTER: return super(UserBranchModelManager, self).get_query_set().filter(branch__pk =

Re: can't authenticate in template

2010-02-13 Thread pbzRPA
Just as a suggestion, if you don't need to customize the get_user() method then simply don't have a get_user() method in your custom authentication class. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Middleware for models

2010-02-13 Thread pbzRPA
Sorry one more thing, the above filters my querysets but then comes the get() method on each model. I use urls with pk's so a user could just try to change the url to a pk that does not belong to them and view it. To filter this out I run yet another function: def

Re: Middleware for models

2010-02-13 Thread pbzRPA
Just so you have an idea what I am trying to do. :) I have a custom middleware that adds a userBranchID variable to each request according to the users branch in the User model. Now in each view when I use any queryset I have to do the following: def filter_branch(request, queryset): if

Re: Middleware for models

2010-02-13 Thread pbzRPA
Hi Shawn, I use Managers often to limit my querysets and add additional fields that I want dynamically calculated using sql. I just don't see how I can get the request object to the models.Manager so it knows what to filter by (user.uid). :( I know I could do a filter in each view

Re: can't authenticate in template

2010-02-13 Thread pbzRPA
On Feb 13, 2:23 am, paul <phart...@gmail.com> wrote: > On Feb 12, 5:03 pm, pbzRPA <pbz...@gmail.com> wrote: > > > The middleware looks good. Is your browser maybe not blocking cookies? > > I have really though hard about it, but without code it's really > >

Re: can't authenticate in template

2010-02-12 Thread pbzRPA
The middleware looks good. Is your browser maybe not blocking cookies? I have really though hard about it, but without code it's really difficult to get a picture of where the problem may lie. You also said you do custom authentication, then why is it that you printing out the request in the

Re: can't authenticate in template

2010-02-12 Thread pbzRPA
Can you please add a dump of your MIDDLEWARE_CLASSES as it is in your settings file. -- 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

Re: can't authenticate in template

2010-02-12 Thread pbzRPA
It's going to be difficult to help you out if you using a custom authentication. Take a look at this comment from the django site and tell me if you following these rules in your custom authentication. """ Calling authenticate() first When you're manually logging a user in, you must call

Middleware for models

2010-02-12 Thread pbzRPA
Hi, I don't actually have a problem but rather a need for a suggestion. I am building a web application and in order to demo the site on one database I have a need to secure the data for each user. I have a field in each model that is a foreign key to a unique field on the User model. The tricky

Filter queryset by foreignkey or manytomany count

2009-12-08 Thread pbzRPA
Hi Does anyone know if its possible to filter a queryset by the count of it's foreignkey or manytomany set? For example: class Y(models.Model): name = models.CharField(...) class X(models.Model): name = models.CharField(...) y_rec = models.ManyToManyField(Y) class Z(models.Model): x =

Re: Filtering queryset using two fields in one model

2009-12-08 Thread pbzRPA
com [mailto:django- > > users+ow...@googlegroups.com] On Behalf Of pbzRPA > > Sent: Tuesday, December 08, 2009 7:19 PM > > To: Django users > > Subject: Filtering queryset using two fields in one model > > > Hi, > > > I am not sure if this is a really stupid question

Filtering queryset using two fields in one model

2009-12-08 Thread pbzRPA
Hi, I am not sure if this is a really stupid question but how can you filter a model by comparing two of it's own fields? for example: class X(models.Model): id = models.IntegerField() new_id = models.IntegerField() now I want to say X.objects.filter(id = new_id) Thanks -- You received

Re: Filtering on model methods

2009-10-29 Thread pbzRPA
Thank you for your help. I guess I will have to create temp table etc and do it that way. It's a pity django does not provide this kind of functionality. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Filtering on model methods

2009-10-28 Thread pbzRPA
I think my problem is both 1 and 2. What happens when you want to use python modules to analyse the extra field? For Example: Database table History: id | Ordered | Delivered | Invoiced | 1 10 15 5 2 553

Re: Filtering on model methods

2009-10-28 Thread pbzRPA
Thanks for you reply Mikhail, I do use model managers but more often to get a certain defined queryset back. Could you maybe show me a simple example of how to implement your suggestion? I imagine it looking something like this. class PersonManager(models.Manager): def

Re: Filtering on model methods

2009-10-27 Thread pbzRPA
Sorry I would also like to add that I would like to sort by this field in generic views. So results = Person.objects.filter (compare_to_others__gte = 1).order_by('compare_to_others') --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Filtering on model methods

2009-10-27 Thread pbzRPA
Hi all, I keep running into a problem. Often when creating models for existing databases which you can not modify, I find myself in need of quite a few model methods. That all works fine but then when I run a view I would like to be able to use the object mapper to filter by the method on a

Re: data too long in a CharField column

2009-05-04 Thread pbzRPA
Hi, I am not sure if truncating the data is a good solution as the user will be under the impression that all the text was saved whereas only the first 255 was really saved. You can add a max_length to your form or modelform field which will block the user from typing more then the max length.

Re: Custom SQL with a variable issue.

2009-05-04 Thread pbzRPA
Hi, Could you provide the code of your model and why you would want to use a custom sql instead of the django model object. Regards Pbzrpa --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&q

Re: How do I set a foreign key as a primary key?

2009-05-04 Thread pbzRPA
On May 4, 3:07 pm, pbzRPA <pbz...@gmail.com> wrote: > On May 3, 6:52 pm, Malcolm Tredinnick <malc...@pointy-stick.com> > wrote: > > > > > On Sun, 2009-05-03 at 09:03 -0700, Thierry wrote: > > > I have the following model: > > > > class Pers

Re: How do I set a foreign key as a primary key?

2009-05-04 Thread pbzRPA
On May 3, 6:52 pm, Malcolm Tredinnick wrote: > On Sun, 2009-05-03 at 09:03 -0700, Thierry wrote: > > I have the following model: > > > class Person(models.Model): > >     person = models.ForeignKey(User) > >     age = models.IntegerField() > > > How can I set the

Re: How to handle view/url situation (Newbie)

2009-05-04 Thread pbzRPA
On May 4, 1:24 pm, Masklinn <maskl...@masklinn.net> wrote: > On 4 May 2009, at 12:47 , pbzRPA wrote: > > > I would do the following. > > > from django.http import HttpResponseRedirect > > from django.core.urlresolvers import reverse > > > def d

Re: How to handle view/url situation (Newbie)

2009-05-04 Thread pbzRPA
I would do the following. from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse def deleteItems(request, item): return HttpResponseRedirect(reverse('app.views.showItems')) --~--~-~--~~~---~--~~ You received this message

Django custom operators DB Backend

2009-05-04 Thread pbzRPA
I would like to know if anyone knows how to create custom operators for querysets. Currently you can do something like: foo.objects.filter(myfield__icontains = x) I would like to add my own operator so I can do something like: foo.objects.filter(myfield__converttext = x) where "converttext"

Re: Pyexcelerator VLOOKUP can't parse formula

2007-10-04 Thread pbzRPA
Found a solution for my problem. There is a patch that you can download so that you can reference other worksheets. https://sourceforge.net/tracker/index.php?func=detail=1687510_id=134081=730645 Hope it helps. PB --~--~-~--~~~---~--~~ You received this message

Pyexcelerator VLOOKUP can't parse formula

2007-09-27 Thread pbzRPA
Good day, I am getting an error when trying to parse a VLOOKUP formula to Excel. ws1.write(row_num, 8, Formula("VLOOKUP(G2;Discounts!A2:B28;2;0)")) It seems to have a problem with the exclamation mark. Any hint would help. Thank You PB --~--~-~--~~~---~--~~