cross-referencing design question

2009-07-23 Thread Mike Dewhirst
I'm new to Django and want to express a self-referencing design feature to link clients in the same table with each other. Django is currently objecting to this. Could you please point me to documentation which will let me figure it out? This is my models.py in a play project using Django from

Re: cross-referencing design question

2009-07-27 Thread Mike Dewhirst
ars. Thanks again ... Daniel Roseman wrote: > On Jul 24, 5:46 am, Mike Dewhirst <mi...@dewhirst.com.au> wrote: >> I'm new to Django and want to express a self-referencing design >> feature to link clients in the same table with each other. > You don't say what the error is. I c

Re: cross-referencing design question

2009-07-27 Thread Mike Dewhirst
Please disregard my previous - I've got something happening/hatching Thanks Matthias and Daniel Mike Mike Dewhirst wrote: > Matthias Kestenholz wrote: > > > >> Is this your complete Membership model? Or do you have additional >> fields there? If you've only go

Re: cross-referencing design question

2009-07-27 Thread Mike Dewhirst
Daniel and Matthias Thanks for your help. I finally figured out I don't need any automatic Django n:m at all! I just made my own n:m table and everything works the way I expect. I'll really try to keep things simple from now on ... Cheers Mike Mike Dewhirst wrote: > Matthias Kestenh

Re: Django and related_name

2009-07-29 Thread Mike Dewhirst
Asinox wrote: > > > Hi guys, first im so sorry with my english, im new with Django, u > know ;) > > I have a problem with a related_name, the tables are fine, but the > problem is that in the Select (DropDown) the data display is "bad", in > this way: Tarifas_object: > > Html code: > >

Re: Calculating a date

2009-08-05 Thread Mike Dewhirst
adelaide_mike wrote: > This should really be a Python enquiry, but I am sure someone will > know: > > I need to calculate the date 12 weeks before today. What is the best > way? TIA This might give you a clue ... from datetime import date def anniversary_this_week(self, tday=date.today()):

display module and template names in templates

2009-08-10 Thread Mike Dewhirst
If DEBUG is True I would like to include view.__name__ and the template filename somewhere in the rendered page. It would be nice to adjust the {% block title %} so the information appears in the top of the browser window-frame so it didn't upset an page layout stuff. Is there a reasonable

[highly recommended] Re: display module and template names in templates

2009-08-10 Thread Mike Dewhirst
Mike Ramirez wrote: > On Monday 10 August 2009 08:47:57 pm Mike Dewhirst wrote: >> If DEBUG is True I would like to include view.__name__ and the template >> filename somewhere in the rendered page. >> >> It would be nice to adjust the {% block title %} so the inform

Re: Model example for simple family tree

2009-08-11 Thread Mike Dewhirst
sniper wrote: > Hi, > I am new to django and wanted to try it out. > > I would like to create a table for family tree > where Relation is a many to many table which contains Profile ids > > profile_id, relative_id,type,priority. > > RELATIVE_CHOICES = ( > (u'F', u'Father'), >

misunderstanding

2009-08-16 Thread Mike Dewhirst
There's something here I'm not seeing. If anyone can point out the docco which refers I would be most grateful ... I'm using py2.6 and Django from svn head. The template below displays the title correctly but claims "No meta dictionary passed". Since the title is one of the meta_dict

Re: misunderstanding

2009-08-16 Thread Mike Dewhirst
Karen and Eric - thank you. Yet another door opened for me :) Mike Karen Tracey wrote: > On Sun, Aug 16, 2009 at 9:33 PM, Mike Dewhirst <mi...@dewhirst.com.au > > Based on what your template does, you don't seem to really want to > combine a dictionary with the key 'titl

Re: Showng the primary key in admin view

2009-09-02 Thread Mike Dewhirst
Joakim Hove wrote: > Hello, > > I have a (simplified) model like this > > class Customer(models.Model): > name = models.CharField(max_length = 100) > date= models.DateTimeField() > email = models.EmailField() > > > When showing this in the (100 % default) admin view

Re: Showng the primary key in admin view

2009-09-02 Thread Mike Dewhirst
Joakim Hove wrote: > Thank you both for answering; however I am afraid we are > misunderstanding eachother here. > > I have created a admin.py file and registered my CustomerClass with > the admin interface. That works, and I can select the CustomerClass > when logged in to the admin interface.

Re: Showng the primary key in admin view

2009-09-02 Thread Mike Dewhirst
Joakim Hove wrote: > > > Hello, > > thanks for the tip: > >> It is usually not a good idea to give business meaning to a primary key >> in a relational database. The literature is full of reasons against it. > > I had a nagging feeling this might be the case. Do you have any links > to "Best

Re: Users Full Name in model form?

2009-09-07 Thread Mike Dewhirst
Streamweaver wrote: > This was through a custom form in a public view. I haven't done much > with admin forms but maybe someone else knows? > > > > On Sep 4, 4:50 pm, Anthony Simonelli wrote: >> Is this within the Admin interface? If so, I'm having a similar >>

Re: Editors of choice

2009-09-08 Thread Mike Dewhirst
Dj Gilcrease wrote: > On Mon, Sep 7, 2009 at 9:55 AM, Samuel Hopkins > wrote: >> Hello Django peeps, >> >> I am a Django newbee. I have had my eye on Djanjo for a year or so now but >> held off because I had limited python experience. However, after a summer of >>

breadcrumb solution

2009-09-09 Thread Mike Dewhirst
I would like to get breadcrumbs working in a simple way. Could anyone please help? I think I need a singleton with a dict like this ... bread = singleton() bread.dct['last_title'] = Within each view and before doing anything else I want to ... def someview(request): title = 'whatever'

Re: breadcrumb solution

2009-09-09 Thread Mike Dewhirst
Daniel Roseman wrote: > On Sep 9, 7:32 am, Mike Dewhirst <mi...@dewhirst.com.au> wrote: >> I would like to get breadcrumbs working in a simple way. Could anyone >> please help? >> >> I think I need a singleton with a dict like this ... >> >> br

Re: breadcrumb solution

2009-09-09 Thread Mike Dewhirst
Thanks David - I do :) Cheers M David De La Harpe Golden wrote: > Mike Dewhirst wrote: >> I would like to get breadcrumbs working in a simple way. Could anyone >> please help? > >> Is there a better way? > > One thing you can do is a "pure template"

Re: Django Project Management App

2009-09-10 Thread Mike Dewhirst
Greg wrote: > Hi all, > > Since I started with django a year or so ago, I've been gradually > building a very simple project management app for myself - it started > as a project to learn the language but has evolved into a very useful > tool, handling all my timetracking, task management and

Re: What JavaScript framework do you use and why?

2009-09-29 Thread Mike Dewhirst
I have heard nice things about Mochikit. I had a look at it a long time ago and fully intended to get involved but haven't had the opportunity yet ... http://www.mochikit.com/about.html esatterwh...@wi.rr.com wrote: > I use mootools a lot. When I was deciding which on to use, I first >

Re: Versionable Models?

2009-10-27 Thread Mike Dewhirst
Todd Blanchard wrote: > Total django noob here. Rails/PHP/WebObjects refugee here. > > I'm starting a project where some models need to be fully versioned. > > IOW, record update is forbidden - every save to a changed model should > result in a new record with a new version number or

setting up headache migrating to apache

2009-10-29 Thread Mike Dewhirst
I'm trying to replicate my (working ok) winxp testing environment on openSuSE 11.1 with Apache2 as a parallel testing environment. We're nowhere near production at the moment. The problem I'm having on openSuSE when i try /usr/bin/python /srv/www/vhosts/ccm/climate/ccm/tests.py is ...

media_url tute

2009-11-13 Thread Mike Dewhirst
I have looked at the django docs (http://docs.djangoproject.com/en/dev/topics/forms/media/) which painstakingly describe how to set up MEDIA_ROOT and MEDIA_URL. Does anyone know of a tutorial or other docco which covers the topic? Thanks Mike -- You received this message because you are

Re: Restrict admin to superusers only

2009-11-27 Thread Mike Dewhirst
chefsmart wrote: > Is there a way to allow only superusers to login to and use the admin > section? Users with is_staff = True do exist and that can't be changed > because this app is in use and makes use of is_staff in some other > way. I believe so. Create a group (say no_admin?) with no

Re: Custom Authentication Backend

2009-12-02 Thread Mike Dewhirst
bfrederi wrote: > I am writing my own custom authentication for AD/ldap and I am trying > to authenticate the user without saving the user in the Django User > table. I also don't want the user to have to log in every time they > want to view something. Is there any way to not save the user in the

design starting question

2009-12-09 Thread Mike Dewhirst
I want to design a site to replace an existing one running on my client's Windows 2008 server. Currently, external users are given manually generated basic auth login credentials to view their own directory on the server. It is running Apache 2.2 and there is zero html and no database. The

Re: Database image from models

2012-02-14 Thread Mike Dewhirst
On 15/02/2012 7:18am, galgal wrote: Is there any free app to generate database image schema from all models from all apps? I need image with tables and relations shown. This may help ... http://live.gnome.org/Dia/Python Thanks for help. -- You received this message because you are

Re: Admin error

2012-02-14 Thread Mike Dewhirst
On 15/02/2012 4:39pm, Stanwin Siow wrote: Hi there, i'm getting this error when trying to get the default admin page up. invalid syntax (admin.py, line 1) Could you post the contents of the offending file (admin.py) here? Any ideas where to rectify this? Thanks in advance Best

Re: Admin error

2012-02-14 Thread Mike Dewhirst
On Feb 15, 2012, at 1:46 PM, Mike Dewhirst wrote: On 15/02/2012 4:39pm, Stanwin Siow wrote: Hi there, i'm getting this error when trying to get the default admin page up. invalid syntax (admin.py, line 1) Could you post the contents of the offending file (admin.py) here? Any ideas

Re: Admin error

2012-02-14 Thread Mike Dewhirst
', 'paypal.standard.ipn', ) besides the tutorial basically just says to uncomment the lines and we should access the page through localserver/admin Thanks for looking into this Best Regards, Stanwin Siow On Feb 15, 2012, at 2:08 PM, Mike Dewhirst wrote: On 15/02/2012 4:59pm, Stanwin Siow

Re: Admin error

2012-02-14 Thread Mike Dewhirst
On 15/02/2012 5:41pm, Mike Dewhirst wrote: invalid syntax (admin.py, line 1) Your original error indicated there is an admin.py but with an error on line 1 or a missing admin.py which you have confirmed. That is the problem. To get your models to appear in the admin app you need

Re: Admin error

2012-02-15 Thread Mike Dewhirst
=psy-ab=admin.autodiscover()=1_sm=_upl==eb2d694fa5cee7bd=sea=1=sea=1=on.2,or.r_gc.r_pw.r_qf.,cf.osb=eb2d694fa5cee7bd=745=910=sea=1 Mike Best Regards, Stanwin Siow On Feb 15, 2012, at 3:12 PM, Mike Dewhirst wrote: On 15/02/2012 5:41pm, Mike Dewhirst wrote: invalid syntax (admin.py

Re: New app crashes the project on server

2012-02-25 Thread Mike Dewhirst
On 26/02/2012 10:10am, shartha wrote: ImportError at / No module named moh Do you have a file called __init__.py in the directory? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: New app crashes the project on server

2012-02-25 Thread Mike Dewhirst
ettings.LANGUAGE_CODE) import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() # end of myproject.wsgi - - - - - - - - - - - - - - - - - - - - On Feb 25, 7:20 pm, Mike Dewhirst<mi...@dewhirst.com.au> wrote: On 26/02/2012 10:10am,sharthawrote: ImportEr

Re: Importing data using loaddata from exported data using dumpdata

2012-03-03 Thread Mike Dewhirst
have a look at file and see if it looks ok. I find I have to dump a model at a time and load them back in a sensible sequence. Connected by MOTOBLURâ„¢ -Original message- From: Vincent Bastos To: django-users@googlegroups.com Sent: Sun, 04 Mar 2012, 08:40:07

admin css

2012-03-04 Thread Mike Dewhirst
I would like to adjust the admin app's base.css. Nothing outrageous. I just want to change all the #999 color values to something a little bit darker so screen text is slightly easier to see. I could write a python script to do that but it feels wrong. I tried locating somewhere in my project

Re: admin css

2012-03-05 Thread Mike Dewhirst
e relevant section from contrib.admin's base.css like so ... .help, p.help { font-size: 10px !important; color: #44; } ... and bingo I can read the help text much more easily. Cheers Mike On 6/03/2012 3:37am, Lee Hinde wrote: On Sun, Mar 4, 2012 at 8:32 PM, Mike Dewhirst<mi...@dewhirst.com

Re: NullBooleanField default to unknown

2012-03-16 Thread Mike Dewhirst
On 17/03/2012 11:02am, Ben wrote: I have a NullBooleanField that I would like to show up in my admin interface as radio buttons with unknown selected by default. # I have the following simplified files ## models.py ## class Value(models.Model): presence =

Re: NullBooleanField default to unknown

2012-03-18 Thread Mike Dewhirst
is probably your best bet. Mike On 18/03/2012 8:10am, Ben Racine wrote: yes. On Mar 16, 2012 8:07 PM, "Mike Dewhirst" <mi...@dewhirst.com.au <mailto:mi...@dewhirst.com.au>> wrote: On 17/03/2012 11:02am, Ben wrote: I have a NullBooleanField that I would like

Re: Adding link to admin page

2012-03-26 Thread Mike Dewhirst
On 27/03/2012 9:16am, larry.mart...@gmail.com wrote: On Mar 25, 3:29 pm, Larry Martell wrote: I have a client that has an app built with django. On every page of their app is a link to their admin site. They tell me the admin site is generated entirely by django, and

Re: Adding link to admin page

2012-03-26 Thread Mike Dewhirst
On 27/03/2012 10:16am, Larry Martell wrote: On Mon, Mar 26, 2012 at 4:37 PM, Mike Dewhirst<mi...@dewhirst.com.au> wrote: On 27/03/2012 9:16am, larry.mart...@gmail.com wrote: On Mar 25, 3:29 pm, Larry Martell<larry.mart...@gmail.com>wrote: I have a client that has an app built

Re: Adding link to admin page

2012-03-26 Thread Mike Dewhirst
firm it works. Hth Mike On 27/03/2012 12:46pm, Larry Martell wrote: On Mon, Mar 26, 2012 at 7:25 PM, Mike Dewhirst<mi...@dewhirst.com.au> wrote: On 27/03/2012 10:16am, Larry Martell wrote: On Mon, Mar 26, 2012 at 4:37 PM, Mike Dewhirst<mi...@dewhirst.com.au> wrote: On 27/0

Re: Adding link to admin page

2012-03-26 Thread Mike Dewhirst
I should have mentioned that {% extends "admin/base.html" %} is actually extending the django admin/base.html in site-packages because there is no such file in my SRC_ROOT/templates/admin directory. Mike On 27/03/2012 2:19pm, Mike Dewhirst wrote: Larry Here is a working setup

Re: Where are the site variables set?

2012-03-29 Thread Mike Dewhirst
On 30/03/2012 10:02am, Robert Steckroth wrote: Hello Gang, I have two other servers on Debian which have the correct site variables set. E.g. site.name , site.domain. But on this particulaly crazy Centos setup the site variable is set to the default (www.example.com

custom manager to control access

2012-04-03 Thread Mike Dewhirst
I'm trying to make a custom manager for a few models. The objective is to limit user access to information in the database belonging to the company of which they are a member. I think I want to say: class Something(models.Model): ... objects = MemberManager() But when I run manage.py

Re: custom manager to control access

2012-04-03 Thread Mike Dewhirst
On 3/04/2012 7:00pm, Tom Evans wrote: On Tue, Apr 3, 2012 at 9:43 AM, Mike Dewhirst<mi...@dewhirst.com.au> wrote: I'm trying to make a custom manager for a few models. The objective is to limit user access to information in the database belonging to the company of which they are a memb

Re: custom manager to control access

2012-04-04 Thread Mike Dewhirst
: On Apr 4, 3:15 am, Mike Dewhirst<mi...@dewhirst.com.au> wrote: I have now discarded the idea :) I'm not very comfortable with thread locals. I need a bullet-proof approach which makes data from other companies invisible to members of this company. I suppose a view decorator is the way to go

Django 1.5 static files strangeness

2012-04-04 Thread Mike Dewhirst
I'm getting odd static files 404 behaviour switching to DEBUG = False on my Windows XP dev machine. My staging server is Linux running under Apache and the same code and the same version of Django and that is running fine with DEBUG = FALSE See the 200 versus 404 info below ...

Re: Where to load global static data?

2012-04-05 Thread Mike Dewhirst
On 5/04/2012 4:53pm, Lars Ruoff wrote: Sorry, that message went off (twice!) while i was in the middle of typing :-) The question is: How do i load static global data once and for all at server startup. I think you would need to implement caching. See

Re: Django 1.5 static files strangeness

2012-04-07 Thread Mike Dewhirst
staticfiles_urlpatterns urlpatterns += staticfiles_urlpatterns() ... which is needed to find the static files and not wanted with Apache. Sorry Mike On 5/04/2012 2:52pm, Mike Dewhirst wrote: I'm getting odd static files 404 behaviour switching to DEBUG = False on my Windows XP dev machine. My staging

Re: Where do ya'll put your glue models?

2012-04-14 Thread Mike Dewhirst
I wouldn't think of my models as "glue". I would write down a list of requirements and call that an app. It obviously won't need to include Poll and Article because they exist already and can be imported untouched. Most of the Django books and docs suggest that you segregate functionality

Re: Django's DecimalField represenation in admin as 0,00 values

2012-05-02 Thread Mike Dewhirst
On 3/05/2012 2:30pm, orschiro wrote: Anybody? On May 2, 11:07 am, orschiro wrote: I want to represent a price in my model in the form of 0,00. This is the part of my model. price = models.DecimalField(max_digits=5, decimal_places=2, default=Decimal('0.00')) However,

Re: Django - Worldwide Developer Rates - Hourly Income - location and project duration specific

2012-05-03 Thread Mike Dewhirst
I don't know what the entry level contracting rate is in Australia but I would guess AUD$4,000 per month pre-tax. Competent developers can usually get $6k to $8k per month or more if they do short term contracting. That is expensive and hurts startups unless sweat-equity is involved. Mike On

Re: Easy Blog

2012-05-12 Thread Mike Dewhirst
Kevin I just googled "blog app for django" and found quite a number of useful links. You have two choices as I see it. One is to choose an existing app and rewrite its CSS to match your site and the other is to start from scratch. James Bennett wrote Practical Django Projects in which he

sweat-equity

2012-05-14 Thread Mike Dewhirst
This is off-topic except for people starting un(der)-funded Django projects. I have written some guidelines for stakeholders and developers plus an equity-in-lieu-of-salary agreement. The guidelines come from my own experience in projects. Apologies to Scrum and eXtreme purists but I need to

Re: sweat-equity

2012-05-15 Thread Mike Dewhirst
choice-of-law clause as well. Right again. I need that for my own agreement so I'll add one. Thanks Marcin Mike On Tue, May 15, 2012 at 1:40 AM, Mike Dewhirst <mi...@dewhirst.com.au <mailto:mi...@dewhirst.com.au>> wrote: This is off-topic except for people starting un(der)-fu

Re: sweat-equity

2012-05-15 Thread Mike Dewhirst
, Mike Dewhirst wrote: On 15/05/2012 6:23pm, Marcin Tustin wrote: You will want to have a lawyer advise you on your agreements. Although your drafting is pretty tight, it could be a bit tighter, I'd like to strike a decent balance. My own lawyer is a tad aggressive and to be honest I wouldn't sign

Re: Model design question

2012-05-17 Thread Mike Dewhirst
On 18/05/2012 7:02am, oneroler wrote: I'm trying to setup my first app and I'm trying to figure out the best way to have constraints on a particular field (strategy for class Division noted below). Below is the basic model structure. What I would like is for the strategy under a Division to

Re: Model design question

2012-05-17 Thread Mike Dewhirst
in BusinessStrategy.objects.all(business=self.business): if self.strategy == item.strategy: return True raise ValidationError(u'Invalid strategy) On Thursday, May 17, 2012 5:55:11 PM UTC-7, Mike Dewhirst wrote: On 18/05/2012 7:02am, oneroler wrote: >

Re: Nested Foreign Key relationships in Admin?

2012-05-20 Thread Mike Dewhirst
On 21/05/2012 1:57pm, Aditya Sriram M wrote: I'd like to represent foreign key relationships inside the Admin interface when there are multiple nested one-to-many relationships. Provided you have the admin app enabled, in your admin.py in the same directory as your models.py file you need

Re: Nested Foreign Key relationships in Admin?

2012-05-20 Thread Mike Dewhirst
On 21/05/2012 2:45pm, Mike Dewhirst wrote: On 21/05/2012 1:57pm, Aditya Sriram M wrote: I'd like to represent foreign key relationships inside the Admin interface when there are multiple nested one-to-many relationships. Provided you have the admin app enabled, in your admin.py in the same

Re: Nested Foreign Key relationships in Admin?

2012-05-21 Thread Mike Dewhirst
On 21/05/2012 2:55pm, Mike Dewhirst wrote: On 21/05/2012 2:45pm, Mike Dewhirst wrote: On 21/05/2012 1:57pm, Aditya Sriram M wrote: I'd like to represent foreign key relationships inside the Admin interface when there are multiple nested one-to-many relationships. Provided you have the admin

Re: Django site updater

2012-05-23 Thread Mike Dewhirst
I use buildbot to export the code from svn whenever I commit to trunk. It also performs other related tasks such as deleting the entire site first then running tests, compiling to .pyc, deleting source, chowning and chmoding etc. I really like buildbot because you can add programmed (in

Re: Inverting URL security diligence - suggestions?

2012-05-29 Thread Mike Dewhirst
On 30/05/2012 4:25am, phill wrote: I'm interested in inverting the diligence required to lock down URLs for my Django app. That is to say, today we put decorators that are some form of @login_required on view methods that require auth, and no decorators on views that are wide open. I'd like to

Re: Is Django Right for Me?

2012-05-29 Thread Mike Dewhirst
On 29/05/2012 10:33pm, KevinE wrote: Thanks for all the posts - the more I look the more overwhelming web development is getting. Seems every sentence I read requires starting another search to found out WTF this term or that term means grr The most important part of the

Re: editable option for model field?

2012-06-04 Thread Mike Dewhirst
On 5/06/2012 10:06am, Roy Smith wrote: The description of editable says: If False, the field will not be editable in the admin or via forms automatically generated from the model class. To me, this sounds like it will be shown in the admin, just not as an editable field (i.e. readonly).

Re: PyPm / Django 1.4?

2012-06-04 Thread Mike Dewhirst
On 5/06/2012 10:32am, Dennis Lee Bieber wrote: On Mon, 4 Jun 2012 12:41:10 -0700, "Aaron C. de Bruyn" declaimed the following in gmane.comp.python.django.user: What do Windows Django developers use for small local databases? MySQL seems overkill if you're just doing local

trailing slash defeats get_absolute_url

2012-06-14 Thread Mike Dewhirst
My urls are working without a trailing slash but not with one. Django version 1.5, Python 2.7. settings.APPEND_SLASH = True (but there is no difference if it is False) Here is the working part ... http://127.0.0.1:8000/item/search When this search retrieves a list of xitems the urls to

Re: trailing slash defeats get_absolute_url

2012-06-15 Thread Mike Dewhirst
On 15/06/2012 5:11pm, bruno desthuilliers wrote: You have to end your url patterns with a slash, ie r'^search/'. Ok. I added a trailing slash to the get_absolute_url method like so ... return 'xitem/%s/' % self.id ... and added an extra url pattern ... urlpatterns = patterns('item.views',

Re: trailing slash defeats get_absolute_url

2012-06-15 Thread Mike Dewhirst
4 AEST Subject: Re: trailing slash defeats get_absolute_url On Friday, June 15, 2012 9:42:33 AM UTC+2, Mike Dewhirst wrote: > > On 15/06/2012 5:11pm, bruno desthuilliers wrote: > > You have to end your url patterns with a slash, ie r'^search/'. > > Ok. I added a trailing slash

Re: upload image

2012-06-16 Thread Mike Dewhirst
On 17/06/2012 5:16am, Satvir Toor wrote: I want to upload a image through django forms.I created a class and that file-upload element is visible into the browser.It makes me enable to choose the file. How to handle that image??? Can anybody explain what would be whole procedure to upload a image

Re: How do I get django working without having to manually run the server?

2012-06-16 Thread Mike Dewhirst
On 17/06/2012 7:30am, Laurence MacNeill wrote: Ok... I'm still learning this stuff here, and I'm confused about one thing... Well, many things, actually, but only one thing that I'll ask about here. During the tutorial I have to type "python manage.py runserver" in order to see my django

Re: change default date format to dd-mm-YYYY

2012-06-25 Thread Mike Dewhirst
On 25/06/2012 6:51pm, ledzgio wrote: How can I change default project/app date format to dd-mm-? This is straight from the Python 2.7 docs. import datetime d = datetime.datetime(2010, 7, 4, 12, 15, 58) >>> '{:%Y-%m-%d%H:%M:%S}'.format(d) '2010-07-04 12:15:58' or in a template ...

Re: advantages and disadvantages of Raw sql queries in django

2012-06-30 Thread Mike Dewhirst
I firmly believe in using the ORM for everything until i am forced to use handwritten SQL. The main reason is transparency of intentions when the source is examined by a non-DBA. I want my code to be maintainable by other people and provably correct. I suppose you can unit-test code with

Re: Error in Brand New Django 1.4.1 released Yesterday

2012-07-31 Thread Mike Dewhirst
Yesterday I did ... pip install --upgrade django ... and it happily upgraded mine to 1.4.1 Mike On 1/08/2012 9:46am, Dennis Lee Bieber wrote: On Tue, 31 Jul 2012 16:06:20 -0700 (PDT), JJ Zolper declaimed the following in gmane.comp.python.django.user: Nope. Not

Re: TinyMCE config

2012-08-01 Thread Mike Dewhirst
On 2/08/2012 11:19am, jondbaker wrote: I'm trying to install django-tinymce so that I can use utilize it within the admin when editing flatpages and flatblocks. I've been following the instructions at http://django-tinymce.readthedocs.org/en/latest/installation.html, but I can't seem to get

Re: TinyMCE config

2012-08-01 Thread Mike Dewhirst
. On Wed, Aug 1, 2012 at 7:59 PM, Mike Dewhirst <mi...@dewhirst.com.au <mailto:mi...@dewhirst.com.au>> wrote: On 2/08/2012 11:19am, jondbaker wrote: I'm trying to install django-tinymce so that I can use utilize it within the admin when editing flatpages an

Re: Do I understand the support schedule correctly?

2012-08-06 Thread Mike Dewhirst
Russell This might be slightly off-thread. Since 1.5 will be Python 3, would you consider making 1.4 a long-term-support version? I know a couple of large organisations who simply won't consider non-LTS open source kit. Mike On 7/08/2012 10:05am, Russell Keith-Magee wrote: On Sun, Aug 5,

Re: Do I understand the support schedule correctly?

2012-08-06 Thread Mike Dewhirst
On 7/08/2012 11:15am, Russell Keith-Magee wrote: On Tue, Aug 7, 2012 at 8:40 AM, Mike Dewhirst <mi...@dewhirst.com.au> wrote: Russell This might be slightly off-thread. Since 1.5 will be Python 3, would you consider making 1.4 a long-term-support version? Django 1.5 will be the first

splitting models.py

2012-08-08 Thread Mike Dewhirst
I would like to understand the "formula" for splitting a monolithic models.py into ./models/.py files. Can someone point to somewhere in the docs or source which sets out the logic? I have three apps in a project and one has a models.py with 18 models and various 1:n and n:m relationships

Re: splitting models.py

2012-08-08 Thread Mike Dewhirst
On 8/08/2012 6:10pm, Russell Keith-Magee wrote: On Wed, Aug 8, 2012 at 3:27 PM, Mike Dewhirst <mi...@dewhirst.com.au> wrote: I would like to understand the "formula" for splitting a monolithic models.py into ./models/.py files. Can someone point to somewhere in the docs or s

Re: Created & updated date/time in models

2012-08-09 Thread Mike Dewhirst
On 9/08/2012 7:02am, Lachlan Musicman wrote: Hola, I've got a bunch of date dependent data that I will need to analyse as the years go by. So adding create_date and update_date fields seems like the thing to do. I go researching I and I see that there are debates about whether auto_now_add and

script for splitting models.py

2012-08-16 Thread Mike Dewhirst
If anyone is interested I have uploaded a script for splitting a monolithic models.py into multiple files in ./models https://github.com/mdewhirst/split-models Python 2.7 and Django 1.4 One of mine was getting too big and too labour-intensive to debug after a manual split. This was due to

Re: script for splitting models.py

2012-08-16 Thread Mike Dewhirst
On 17/08/2012 4:06am, Melvyn Sopacua wrote: On 16-8-2012 11:33, Mike Dewhirst wrote: https://github.com/mdewhirst/split-models Python 2.7 and Django 1.4 One of mine was getting too big and too labour-intensive to debug after a manual split. This was due to accretion of cruft during my

Re: script for splitting models.py

2012-08-16 Thread Mike Dewhirst
On 17/08/2012 9:31am, Mike Dewhirst wrote: On second thoughts, from __future__ import absolute_import is needed for 1.4 but should be removed when upgrading to 1.5. On third thoughts, that should be "when upgrading to Python 3.x" ! Mike -- You received this message b

Re: script for splitting models.py

2012-08-16 Thread Mike Dewhirst
On 17/08/2012 9:43am, Melvyn Sopacua wrote: On 17-8-2012 1:31, Mike Dewhirst wrote: On 17/08/2012 4:06am, Melvyn Sopacua wrote: On 16-8-2012 11:33, Mike Dewhirst wrote: - Perhaps do the same with editor modelines, like the one you have for emacs. Vi(m)'s start with either vim: vi: or ex

Re: script for splitting models.py

2012-08-16 Thread Mike Dewhirst
On 17/08/2012 9:43am, Melvyn Sopacua wrote: On 17-8-2012 1:31, Mike Dewhirst wrote: On 17/08/2012 4:06am, Melvyn Sopacua wrote: The -*- coding: utf-8 -*- line. Done. It now respects any existing coding in models.py and any existing from __future__ imports. - Same with db_table

Re: Layout and global.css files

2012-08-22 Thread Mike Dewhirst
On 23/08/2012 11:41am, Gregory Strydom wrote: Could anyone perhaps tell me where i could find the layout.css and global.css for the base admin site? Ive tried looking through C:/Python26/site-packages/django but cant seem to find anything. What i am trying to do is just change colour where it

database error and connection._rollback

2012-08-22 Thread Mike Dewhirst
This ... [1] from django.db import connection connection._rollback() ... solved a problem for me in unit testing when I catch a deliberate DatabaseError. Django 1.4 Python 2.7 PostgreSQL 9.1 My question: Is it safe enough to use a method with a leading underscore? Is there a better method?

Re: database error and connection._rollback

2012-08-23 Thread Mike Dewhirst
On 23/08/2012 4:27pm, akaariai wrote: On 23 elo, 08:30, Mike Dewhirst <mi...@dewhirst.com.au> wrote: This ... [1] from django.db import connection connection._rollback() ... solved a problem for me in unit testing when I catch a deliberate DatabaseError. Django 1.4 Python 2.7 PostgreS

Re: Column widths in TabularInline

2012-08-24 Thread Mike Dewhirst
On 25/08/2012 3:06am, Vikas Rawal wrote: How do i customise width of different columns in a TabularInline object in my admin interface. In admin.py you can for example ... fieldsets = ( (None, { 'classes': ['myowncssclassname',], 'fields': (

Re: Column widths in TabularInline

2012-08-26 Thread Mike Dewhirst
On 26/08/2012 6:22pm, Vikas Rawal wrote: > In admin.py you can for example ... > > fieldsets = ( > (None, { > 'classes': ['myowncssclassname',], > 'fields': ( > 'field_abc', >

Re: Column widths in TabularInline

2012-08-27 Thread Mike Dewhirst
On 27/08/2012 4:34pm, Vikas Rawal wrote: There is a field in my model called "name". What do I give in the css file to reduce its width to say 100px? This is css rather than Django but this is what I did to make my input field wider ... .wider .vTextField { width: 60em !important; } If

Re: No ROLLBACK within TestCase on second database

2012-09-04 Thread Mike Dewhirst
On 5/09/2012 12:01pm, Kit Randel wrote: Hi there, I'm running into an issue on Django 1.2 where the second test in my test suite fails due to a duplicate key value violation. It appears that the issue is that calls to my 'default' db, test_app_django in this case, run within a transaction, but

Re: No ROLLBACK within TestCase on second database

2012-09-05 Thread Mike Dewhirst
On 5/09/2012 3:09pm, Kit Randel wrote: On 05/09/12 16:28, Mike Dewhirst wrote: I asked about this a couple of weeks ago and the correct solution is to use a TransactionTestCase Hi Mike, I don't want to be explicitly test transactional behaviour, which I think is the intention behind

Re: Test driven development in Django framework

2012-09-05 Thread Mike Dewhirst
On 6/09/2012 3:04am, Javier Guerra Giraldez wrote: On Wed, Sep 5, 2012 at 7:46 AM, jyria wrote: What is your experience? Is it worth it, and is it possible? I tried it and found it quite difficult to follow guideline of unit testing -- testing a unit of code, a class for

Re: how to attach comments to a User instance

2012-09-06 Thread Mike Dewhirst
On 6/09/2012 4:07pm, heni yemun wrote: Hi, I'm having difficulty attaching comments to a User object i created. So walk me through the process of *attaching comments* to *displaying them*. THANK YOU! Difficult to know exactly what you are trying to do from your specification but typically,

Re: Django and LDAP

2012-09-10 Thread Mike Dewhirst
On 11/09/2012 4:14am, Tony wrote: Hi everybody, I am new to Django and Python, and right now, i am going through the documentation. I have an assignment at my Faculty, where i need to install Django, 389ds LDAP server (where i have to store my users) and i need to somehow connect them two, so i

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-10 Thread Mike Dewhirst
On 11/09/2012 1:31am, DJ-Tom wrote: Hi, I'm new to django and python at the same time (Nightmare ) and currently struggling to get a basic understanding of how everything works and how the different components are connected to each other. My setup is a s follows: - Apache 2.2 running as a

  1   2   3   4   5   6   7   8   9   10   >