Re: Generating random alphanumeric codes

2012-06-26 Thread Adrian Bool
On 26 Jun 2012, at 15:53, Sithembewena Lloyd Dube wrote: > Would anyone have tips on how to generate random 4-digit alphanumeric codes > in python? Also, how does one calculate the number of possible combinations? For upper case, lower case and digits we have, 26 + 26 + 10 = 62

Re: ForeignKey problem

2012-06-25 Thread Adrian Bool
On 25 Jun 2012, at 17:53, Soviet wrote: > Thank you kind sir for your fast response, that worked brilliantly. > Can I be cheeky and ask why does it work? :) Magic! ;-) Although seriously, Django obviously has some code in there to handle just the situation you have come across. Sorry, I

Re: ForeignKey problem

2012-06-25 Thread Adrian Bool
On 25 Jun 2012, at 17:41, Soviet wrote: > I'm new to this Django thing and I run into first problem :). > > Let's say I have two models and in each I have field with ForeignKey > relating to field in other model (hope it's clear). Now that I want to > run migrate with South, I'm getting

Re: Import error

2012-06-22 Thread Adrian Bool
Hi Emily, On 22 Jun 2012, at 15:46, Emily wrote: > This is the class I created... > > import string > import random > > class Helpers: > > def random_password(): Take random_password outside of the Helpers class and you should be OK. On the import statement you need to refer to a 'top

Re: DRY and static attribute for multiple classes.

2011-02-01 Thread Adrian Bool
On 1 Feb 2011, at 21:05, Marc Aymerich wrote: > Hi all, > I want to provide an encapsulated static attribute called _registry > for several classes. > > I try to use inheritance in order to make it DRY: all classes inherit > from a BaseClass that implements the _registry encapsulation. But with

Re: working django with existing database

2011-01-31 Thread Adrian Bool
-users?hl=en. > > > > -- > 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 > django-use

Re: XML parsing

2011-01-31 Thread Adrian Bool
> "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-

Re: pyodbc: Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnectW)')

2011-01-30 Thread Adrian Bool
On 30 Jan 2011, at 09:31, Orgil wrote: > My code is below: > --- > import pyodbc > conn = pyodbc.connect('DRIVER={SQL Server};SERVER=testserver > \mssql2008;DATABASE=eoffice;UID=erp;PWD=123') > --- I'd try replacing 'testserver\mssql2008' with a domain

Re: Customising the Admin Save Models in DJango 1.1

2011-01-27 Thread Adrian Bool
On 27 Jan 2011, at 13:28, Matthew Macdonald-Wallace wrote: >def save(self,*args,**kwargs): >if not self.id: >self.created = datetime.date.today() >if self.Status.ClosesChangeRequest == True: >self.completed =

Re: problem with compressed egg in mysqldb module

2011-01-26 Thread Adrian Bool
On 26 Jan 2011, at 23:24, Cindy wrote: > > On Jan 26, 2:13 pm, Cindy wrote: >> Hi, all. I'm getting this error, when trying to export my django site >> to a new place: Do you mean to a new server? >> >> TemplateSyntaxError: Caught ImproperlyConfigured while rendering: >>

Re: Django: Object Oriented or Relational Database?

2011-01-26 Thread Adrian Bool
Hi Bruno, On 26 Jan 2011, at 12:55, bruno desthuilliers wrote: > Some will talk about "OO/relational impedance mismatch" (ok, I cheated > - Daniel just did;)), but I don't see it that way as far as I'm > concerned - I'm using a relational model wrapped into an OO > representation, and that's

Re: forbid clones

2011-01-26 Thread Adrian Bool
Please ignore this dumn-ass p On 26 Jan 2011, at 12:34, Adrian Bool wrote: > > On 26 Jan 2011, at 12:26, Jaroslav Dobrek wrote: > >>> >>> http://docs.djangoproject.com/en/1.2/ref/models/fields/#unique >> Example: >> >> This should be allowed: &

Re: forbid clones

2011-01-26 Thread Adrian Bool
On 26 Jan 2011, at 12:26, Jaroslav Dobrek wrote: >> >> http://docs.djangoproject.com/en/1.2/ref/models/fields/#unique > Example: > > This should be allowed: > > car1: manufacturer = "foo", name = "bar" > car2: manufacturer = "foo", name = "baz" > > This should not be allowed: > > car1:

Re: Customising the Admin Save Models in DJango 1.1

2011-01-26 Thread Adrian Bool
model = Charge extra = 0 Regards, aid Adrian Bool a...@logic.org.uk -- 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, se

Re: Django: Object Oriented or Relational Database?

2011-01-26 Thread Adrian Bool
On 26 Jan 2011, at 11:55, Daniel Roseman wrote: > > This is what's known as the object-relational impedance mismatch [1]. > Unfortunately, as you've noticed, OO concepts don't map completely cleanly > onto the relational model, and this is an issue with all systems that attempt > to do it.

Django: Object Oriented or Relational Database?

2011-01-26 Thread Adrian Bool
Hi, I'm creating a DB using Django for managing our companies data - customers, services, orders, billing etc. I'm using the Django admin interface to manage the data. I seem to be consistently at odds with myself and would be good to hear the community's point of view on this. I'm