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 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 member. I think I want t

Re: custom manager to control access

2012-04-04 Thread Mike Dewhirst
wrote: On Apr 4, 3:15 am, Mike Dewhirst 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 but I would h

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 https://docs.djangoproject.com/en/dev/top

Re: Django 1.5 static files strangeness

2012-04-07 Thread Mike Dewhirst
m django.contrib.staticfiles.urls import 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 = Fa

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 into

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, prices such as 2.10 are s

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 work

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
jurisdiction and 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 <mailto:mi...@dewhirst.com.au>> wrote: This is off-topic except for people starting un(der

Re: sweat-equity

2012-05-15 Thread Mike Dewhirst
:41pm, 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 wou

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 b

Re: Model design question

2012-05-17 Thread Mike Dewhirst
ef clean(self): for item 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/0

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 some

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

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

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 Python

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 architect

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). How

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 development on a Win

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 displa

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
ling 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 to the get_absol

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 pa

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 ... https

Re: advantages and disadvantages of Raw sql queries in django

2012-06-29 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 Python 1.4. Django 1.4.

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 TinyM

Re: TinyMCE config

2012-08-01 Thread Mike Dewhirst
display. I'm a bit stumped at this point. On Wed, Aug 1, 2012 at 7:59 PM, Mike Dewhirst 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 th

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 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 Django release to officially

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 wi

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 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 source which sets out the logi

Re: Created & updated date/time in models

2012-08-08 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 acc

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 becau

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:

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 in the

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 sa

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 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 PostgreSQL 9.1 My question: Is it

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', > 'field_xyz

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 y

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 t

Re: No ROLLBACK within TestCase on second database

2012-09-04 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 b

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 example. Maybe Im just

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, you

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 serv

Re: Django and LDAP

2012-09-11 Thread Mike Dewhirst
for getting started. On Tue, Sep 11, 2012 at 12:36 AM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote: 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 m

Re: Django and LDAP

2012-09-11 Thread Mike Dewhirst
On 12/09/2012 8:05am, Mike Dewhirst wrote: On 12/09/2012 7:49am, Ivan Pavlović wrote: Thank you Mike for your answer. I started this topic, because i have an assignment at my Faculty, which requires connection between Django and an LDAP (assistant insisted on 389ds). I installed Django, enabled

prevent change depending on other field values

2012-09-13 Thread Mike Dewhirst
I want to lock a value in a ForeignKey field in a record once two other fields are non-blank. The record can be saved with changes to that ForeignKey field provided one of the other two fields is blank. Other fields in the record can be changed or the record deleted and reinserted but it wil

Re: check if an user is authenticated from another app

2012-09-14 Thread Mike Dewhirst
On 15/09/2012 2:56am, refreegrata wrote: Hello list. Obviously, I come here with a question. I have a web application developed with Django. It's working Ok. The app is just for internal use and the access to every view is only avaliable for authenticated users with permissions over the section

Re: tree.io installation with django

2012-09-16 Thread Mike Dewhirst
On 16/09/2012 6:41am, Fabian Weiss wrote: The invalid syntax thing is also a bit odd, as it looks valid to me. I haven't followed this thread but whenever I get an invalid syntax error with valid syntax it is usually a problem with an earlier line. In my cases it is often a missing comma or

Re: tree.io installation with django

2012-09-16 Thread Mike Dewhirst
2012 01:59:09 UTC+2 schrieb Mike Dewhirst: On 16/09/2012 6:41am, Fabian Weiss wrote: > The invalid syntax thing is also a bit odd, as it looks valid to me. > I haven't followed this thread but whenever I get an invalid syntax error with valid syntax it is usually a probl

Re: last changed by User

2012-09-27 Thread Mike Dewhirst
On 28/09/2012 2:16pm, Greg Donald wrote: On Thu, Sep 27, 2012 at 10:28 PM, Lachlan Musicman wrote: I wanted to display the user that last changed a model instance. I use django-reversion for this: https://github.com/etianen/django-reversion See also Pro Django by Marty Allchin and https

Re: last changed by User

2012-09-27 Thread Mike Dewhirst
On 28/09/2012 3:01pm, Mike Dewhirst wrote: On 28/09/2012 2:16pm, Greg Donald wrote: On Thu, Sep 27, 2012 at 10:28 PM, Lachlan Musicman wrote: I wanted to display the user that last changed a model instance. I use django-reversion for this: https://github.com/etianen/django-reversion

Re: Javascript encoding and python decoding and vice versa

2012-10-08 Thread Mike Dewhirst
On 9/10/2012 4:07pm, Laxmikant Gurnalkar wrote: Hi, Guys. Anybody knows to encrypt the content in javascript and decode it using python and vice versa. Not sure where you see the threat but if it is between the browser and the server then I think your server needs to provide https encryption

Re: Object Serializer

2012-10-09 Thread Mike Dewhirst
On 10/10/2012 12:10pm, Victor Manuel Quiñones Victor wrote: Hi guys, I need some help here... I need to serialize some objects and save them into the database. What library would you suggest for it? Have you looked at ... https://docs.djangoproject.com/en/1.4/topics/serialization/ Thank y

Re: Best practices for open sourcing a Django project?

2012-10-14 Thread Mike Dewhirst
On 15/10/2012 6:47am, Joshua Russo wrote: I have project that I have been working and I was contemplating open sourcing it but I ran into a little hang up. How to handle the database authentication. The settings file obviously needs to be included but I don't want to advertise the production data

Re: environment variable DJANGO_SETTINGS_MODULE is undefined.

2012-10-22 Thread Mike Dewhirst
On 23/10/2012 8:37am, DjgoNy wrote: I have problem importing from django_tables import tables and when i do it on manage.py shell i get this error. >>> import django_tables2 Traceback (most recent call last): File "", line 1, in File "build\bdist.win32\egg\django_tables2\__init__.py", l

Re: Billing and invoicing app?

2012-10-23 Thread Mike Dewhirst
On 24/10/2012 1:08pm, Jesramz wrote: Quick question, is there a good billing and invoicing app, that anyone can point me to? http://www.djangopackages.com/ Thanks all! -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion

Re: environment variable DJANGO_SETTINGS_MODULE is undefined.

2012-10-24 Thread Mike Dewhirst
On 23/10/2012 2:10pm, Mike Dewhirst wrote: On 23/10/2012 8:37am, DjgoNy wrote: I have problem importing from django_tables import tables and when i do it on manage.py shell i get this error. >>> import django_tables2 Traceback (most recent call last): File "", line 1,

signals documentation question

2012-10-29 Thread Mike Dewhirst
The 1.5 docs say ... Where should this code live? You can put signal handling and registration code anywhere you like. However, you'll need to make sure that the module it's in gets imported early on so that the signal handling gets registered before any signals need to be sent. This makes you

Re: signals documentation question

2012-10-29 Thread Mike Dewhirst
e. Cheers Mike On 30/10/2012 4:55pm, Russell Keith-Magee wrote: On Tue, Oct 30, 2012 at 1:40 PM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote: The 1.5 docs say ... Where should this code live? You can put signal handling and registration code anywhere you like. However

Re: Posting from HTTP to HTTPS on same domain results in CSRF failure

2012-10-31 Thread Mike Dewhirst
On 31/10/2012 7:21pm, Kevin wrote: Hello everyone, I am in the process of deploying a Django app which works both on HTTP and HTTPS connections, and require that some specific forms only submit via HTTPS. I want the transition process over to HTTPS to be seamless for the end-user. I am impl

how to semi-automate a choice in contrib.admin

2012-11-01 Thread Mike Dewhirst
If a user leaves a compulsory (blank=False) field empty in the Admin app I want to check the value of a different field and depending on that value either ... do nothing and let the system complain it needs data or fill in some appropriate data so it is no longer empty I have tried doing thi

Re: how to semi-automate a choice in contrib.admin

2012-11-01 Thread Mike Dewhirst
On 2/11/2012 3:09pm, Mike Dewhirst wrote: If a user leaves a compulsory (blank=False) field empty in the Admin app I want to check the value of a different field and depending on that value either ... do nothing and let the system complain it needs data or fill in some appropriate data so it

Re: docstrings for inherited models not showing in Admin Docs

2012-11-10 Thread Mike Dewhirst
David I think the solution is to look at the admindocs source and tweak it to do what you want and submit a patch. The target audience for admindocs is template authors. This means you are possibly trying to make admindocs do something it wasn't designed to do. I don't mean your specific pro

testing unique_together IntegrityError

2012-11-10 Thread Mike Dewhirst
Can anyone help with some unit test guidance please? How can I trap an IntegrityError in a test to prove unique_together is working? I'm modelling a company and multiple divisions. A solo division doesn't need a division.name so I'm allowing it to be blank. It's __unicode__() method returns

Re: testing unique_together IntegrityError

2012-11-10 Thread Mike Dewhirst
On 11/11/2012 4:45pm, Mike Dewhirst wrote: Can anyone help with some unit test guidance please? How can I trap an IntegrityError in a test to prove unique_together is working? I'm modelling a company and multiple divisions. A solo division doesn't need a division.name so I'm al

Re: objects tools redirect to models def

2011-08-21 Thread Mike Dewhirst
On 22/08/2011 11:56am, Mariano DAngelo wrote: Hi I'm new in django I'm trying to redirect a personalize object tool to a function on a model module how can I do this becouse alll tutorial show how to redirect to a link thanks I'm not sure what you are asking about. Redirection is norma

Re: How to create a sub-app directly

2011-08-21 Thread Mike Dewhirst
On 22/08/2011 1:22am, Jim wrote: I tried ../manage.py startapp someapp under apps/, but that created the someapp under mysite/ rather than under apps/. That's what is expected. mysite should contain settings.py and mysite/apps should contain models.py (among other files). If you want a sep

Re: Quick question on importing

2011-08-22 Thread Mike Dewhirst
On 23/08/2011 3:29pm, raj wrote: I am editing my user model, and I want to place a foreign key to a class in another model, that is in a different app. How would I go about importing it? Tree: /project/myapp/model1.py /project/myapp2/model2.py can i simply just say: from myapp2 import model2 Th

Re: How to make an app independent on a specific site?

2011-08-23 Thread Mike Dewhirst
On 24/08/2011 2:09pm, Jim wrote: Greetings, everyone. I am new to Django, and much of my knowledge comes from the Django book version 2 . In the book, a site, mysite, is created for demo purposes. And an app, books, is also created for demo purposes. In the

Re: Setting default form value in template

2011-08-25 Thread Mike Dewhirst
I think you need a bit of R&D here. The general advice I've seen is to get it working without javascript and then find a js solution. I feel it is difficult. Back at the server you only have the data the browser sends you. If I understand what you are saying, your problem is to write some java

Re: why is settings.py executed twice?

2011-08-28 Thread Mike Dewhirst
Best answer is here ... http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html M On 28/08/2011 11:02am, Gelonida N wrote: Hi, This is also one of the things (I just started using django, so I have still quite many questions) , that I don't really understand. It doesn't brea

manage.py test app can't find tests

2011-08-30 Thread Mike Dewhirst
Using Python 2.7 and Django trunk I can run python tests.py successfully in the app directory or in /app/tests subdirectory where it says (no setup or teardown required yet) . -- Ran 25 tests in 0.

possible fix for auth test template

2011-09-01 Thread Mike Dewhirst
Django trunk revision 16715 manage.py test is producing one failure out of 326 tests which might be due to an empty template. The test is asserting that response contains 'Session not accessed' With an empty template the assertion should succeed if it said the response does not contain somet

Re: possible fix for auth test template

2011-09-01 Thread Mike Dewhirst
re. Unfortunately, any deeper and I lose my way. Mike On 2/09/2011 1:52pm, Mike Dewhirst wrote: Django trunk revision 16715 manage.py test is producing one failure out of 326 tests which might be due to an empty template. The test is asserting that response contains 'Session not acce

Re: Authorization workflow model

2011-09-05 Thread Mike Dewhirst
On 6/09/2011 5:46am, Mario8k wrote: Hello, Does anyone knows some solution (reusable app, snippet or any idea) to model an authorization workflow of data? That is... supose that a user have restricted some model field, ie, cannot edit directly this field. And now supose that he could request to

Re: Internationalization

2011-09-22 Thread Mike Dewhirst
On 23/09/2011 1:45am, nadae ivar wrote: i check it but not undestand It takes a bit of study and much concentration. I tried it understand it myself recently and posed some questions here and got some very good answers and had my understandings corrected at the time. I still haven't implemen

Re: can't get STATICFILES to work (Django dev version)

2011-10-04 Thread Mike Dewhirst
On 3/10/2011 10:00pm, Gelonida N wrote: On 09/26/2011 10:21 PM, nara wrote: I am having trouble getting STATICFILES to work. I have read the docs, and followed the instructions, but I never get my css files to load. My current workaround is to put all the css inline in my template file, but that

Re: configuring

2011-10-12 Thread Mike Dewhirst
Yeah The last line of the traceback indicates a problem with your MySQL setup possibly with the backend. Check the docs for interfacing Django to MySQL. I use PostgreSQL so I can't help much here. Good luck Mike On 12/10/2011, at 11:12 PM, yezi wrote: > hey everyonei just cant proceed

Re: a django question about "python manage.py syncdb"

2011-10-14 Thread Mike Dewhirst
On 14/10/2011, at 8:23 PM, Chen Xu wrote: > Hi, > I am new to Django. > I have installed Django and go t everything set up correctly, just started > some easy tutorials. > > So when I do > Django-admin.py startapp blog > > > it creates a /blog directory that looks like thsi > /blog > -

Re: model: how to reference to the model itself?

2011-10-23 Thread Mike Dewhirst
On 24/10/2011 3:47pm, Ken wrote: I want to create a parent-child like catalog system. from django.db import models class Catalog(models.Model): username = models.EmailField() name = models.CharField(max_length=64) color = models.CharField(max_length=20) state = models.Intege

Re: model: how to reference to the model itself?

2011-10-23 Thread Mike Dewhirst
On 24/10/2011 4:00pm, Mike Dewhirst wrote: On 24/10/2011 3:47pm, Ken wrote: I want to create a parent-child like catalog system. from django.db import models class Catalog(models.Model): username = models.EmailField() name = models.CharField(max_length=64) color = models.CharField(max_length

Re: synchronize django admin interface password with other application passwords

2011-11-06 Thread Mike Dewhirst
On 7/11/2011 7:43am, Gelonida N wrote: Hi, I would like to use the django admin interface for authentification of a web site. However I also have to store a password hash (different algorith / different salt) for another application, such, that both applications can use the same password. What

Re: Serving up CSS files in development

2011-11-07 Thread Mike Dewhirst
Forgive top posting - I can't debug your code but I can show you what I do (an excerpt from my settings.py) to debug my own using print statements. I use PROJECT as the project name and PROJECT_ROOT to contain SRC_ROOT which contains settings.py ... MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'ht

help_text line continuation

2011-11-13 Thread Mike Dewhirst
I have been using the Python line continuation symbol +\ in my models help_text when my text goes beyond column 80 in my editor. I just accidentally omitted it for a continued line and discovered it doesn't seem to be needed!!! Is that a feature of Django's admin app or a trap for the unwary?

Re: site organization best practices

2011-11-15 Thread Mike Dewhirst
On 16/11/2011 6:11am, Stuart Laughlin wrote: FWIW I agree with Mike. It's difficult to advise without seeing exactly what you're doing, but I think Mike's advice/approach is sound. I agree too. But in today's mail is a link to an answer to a similar question about centralising control of login

Re: Strange new error

2011-11-16 Thread Mike Dewhirst
On 17/11/2011 9:55am, Gchorn wrote: Weird, when I navigate to that folder, it hangs as though it's having to load up a ton of files, and then after a lengthy pause it shows 0 items. I don't know how I could have erased the contents of this folder as I have never opened it (or why it's hanging ev

Re: Strange new error

2011-11-16 Thread Mike Dewhirst
On 17/11/2011 12:03pm, Gchorn wrote: I'm sorry, it's not totally clear to me what you mean by "trashed disk." If I use a disk utility, what am I looking for? Some sort of corruption of the actual hard drive? Are you saying my hard drive itself might be compromised and need replacement? I think

<    1   2   3   4   5   6   7   8   9   10   >