Re: foreign key with unique versus one-to-one

2013-04-03 Thread Mike Dewhirst
On 4/04/2013 5:15pm, Russell Keith-Magee wrote: On Thu, Apr 4, 2013 at 1:01 PM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote: I have noticed that there appears to be no difference in Postgres between a OneToOneField and a ForeignKey with unique=True Is there an

Re: General Apache Deploy Strategy

2013-04-04 Thread Mike Dewhirst
On 5/04/2013 12:36am, Bill Freeman wrote: It is also possible to use a non-distribted VCS, like Subversion, but you lose, IIUC, the ability to check in incremental stuff If you work in (say) your own branch of a SVN repo you can check in as often as you like. And you can merge other branches -

Re: Trouble with CSS/Static Files

2013-04-04 Thread Mike Dewhirst
On 5/04/2013 2:33pm, Vibhu Rishi wrote: Hi, >Have you ran >$ manage.py collectstatic Can you explain why I need to do this on my dev machine when I am not deploying it to production ? If I look at the docs at https://docs.djangoproject.com/en/dev/howto/static-files/#deployment , it mentio

Re: General Apache Deploy Strategy

2013-04-05 Thread Mike Dewhirst
op of the checked-out code from the networked repo and commit when you get a network again. You wouldn't do that though. You would abandon svn for git or hg or similar. On Thu, Apr 4, 2013 at 7:30 PM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote: On 5/04/2013 12:36am, Bill Fr

Re: need help designing models

2013-04-06 Thread Mike Dewhirst
On 7/04/2013 3:27pm, surya wrote: Consider a university college. 1. College has name, uid, website 2. Each college has a many departments - Each department has name, uid. 3. Each batch in a department has name, and ratings. *from django.db import models* * * *class College(models.Model):* *name

Re: need help designing models

2013-04-06 Thread Mike Dewhirst
On 7/04/2013 4:36pm, surya wrote: actually, you are right, django models do provide id.. but this uid field is something else.. Eg: massachusetts institute of technology. uid = MIT..i will be using it as primary key. Doing so raises questions about investing primary keys with real meaning. I

Re: New to testing

2013-04-10 Thread Mike Dewhirst
On 11/04/2013 2:02pm, Lachlan Musicman wrote: Hi I'm new to testing. Not to Django. To my shame. I'm trying to test some m2m signals connections, so I have a Inside your test class before writing tests you can have ... def setUp(self): jack = MaleAccountFactory() jill =

Re: New to testing

2013-04-10 Thread Mike Dewhirst
On 11/04/2013 2:42pm, Lachlan Musicman wrote: On 11 April 2013 14:23, Mike Dewhirst wrote: On 11/04/2013 2:02pm, Lachlan Musicman wrote: Inside your test class before writing tests you can have ... def setUp(self): jack = MaleAccountFactory() jill

Re: m2m symmetry confusion

2013-04-11 Thread Mike Dewhirst
On 11/04/2013 4:41pm, Lachlan Musicman wrote: At the moment I have tables on the database: account_account account_account_parents account_account_children account_account_partners account_account_siblings Not wishing to throw a spanner in the works, but I have always had a design in the bac

Re: m2m symmetry confusion

2013-04-11 Thread Mike Dewhirst
Conceptually all there is in families is people objects and relationship objects. Therefore, you really only need two tables being person and relationship. This could be satisfied with relationship being the 'through' table for person having m2m('self'). You would probably need a clean() met

Re: Static Files on IIS install

2013-04-11 Thread Mike Dewhirst
On 12/04/2013 12:56pm, Mark Lybrand wrote: I have managed to get a Django app installed on IIS7. It is not finding the static files for the admin section. Can someone give me some pointers on the steps I need to take to get static files to work in general, https://docs.djangoproject.com/en/1.

Re: Static Files on IIS install

2013-04-12 Thread Mike Dewhirst
404 NOT FOUND - >http://localhost:8001/static/admin/css/dashboard.css"; > > >OS: Windows 7 > >Web server: IIS 7 with FastCGI > >Python: 2.7.4 > >Django: 1.4.5 > > > >Should I post my settings.py file as well? > > > > > >On Thu, Apr 11

Re: Guide for migrating to a custom user model?

2013-04-17 Thread Mike Dewhirst
On 18/04/2013 9:55am, Brian Neal wrote: Hello - I have a Django site that I've been maintaining for 4 years. It is running Django 1.4 now and is using the usual Django User model plus the get_profile() method to retrieve some extra information for each user. Now that Django 1.5 has landed and we

Re: Guide for migrating to a custom user model?

2013-04-17 Thread Mike Dewhirst
- unless someone else gets in first. Mike - Chris [1]: http://ponytech.net/blog/2013/03/31/migrate-your-user-profile-data-django-15-custom-user-model/ On Wed, Apr 17, 2013 at 5:34 PM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote: On 18/04/2013 9:55am, Brian Neal wrote:

Re: Unexpected Server Error (500) in tutorial

2013-04-25 Thread Mike Dewhirst
On 26/04/2013 8:32am, dsmakear...@gmail.com wrote: That probably means the tutorial can't really demonstrate 404.html, 500.html, or 403.html customization. If you are getting 500 errors you should be able to see your own 500.html displayed. On Thursday, April 25, 2013 6:24:37 PM UTC-4

Re: Unexpected Server Error (500) in tutorial

2013-04-25 Thread Mike Dewhirst
On 26/04/2013 3:41am, dsmakear...@gmail.com wrote: I am running python 3.3.1, django-dev, Windows 7, When I Set DEBUG=False, I then get "Server Error (500)" not 404. With some experimentation, I discovered that if I set DEBUG=False the tutorial app appears to always fail with Server Error 5

Re: Import project from Linux to Windows

2013-05-05 Thread Mike Dewhirst
On 6/05/2013 11:40am, Nathaniel Sim wrote: Hi all An existing web is developed on Linux and i want to create a test environment on my Windows 7. I already copied the entire folder onto my web root, please advise me on how to create a test environment. Nathaniel Difficult to know where to star

Re: Import project from Linux to Windows

2013-05-06 Thread Mike Dewhirst
On 7/05/2013 1:18pm, Nathaniel Sim wrote: It is a Django web app and Django is installed. I copy the project from remote server to my xampp/htdocs. What are the steps if i want to develop in Windows OS and using Aptana Studio as IDE? 1. Establish a repository to manage source code change, get

Re: [newbie question] python manage syncdb doesn't create all the tables. Models has been splitted up.

2013-05-09 Thread Mike Dewhirst
On 9/05/2013 10:04pm, crosa wrote: Hi guys, I'm testing django in order to build a little application. This application will have several models, so I've decided to split up them, in order to do this more readable (Any other form to do this?) When I run python manage.py syncdb, the models tables

Re: not able to create a site, instead text document pops out.

2013-05-10 Thread Mike Dewhirst
On 10/05/2013 10:23pm, gintare wrote: Windows7 computer. Django 1.5.1 Python 2.7 Not able to create a site, instead text document pops out. Command: c:\Python27\Scripts>c:\Python27\Scripts\django-admin.py startproject mysite This looks as though you changed directory to c:\python27\script

Re: Help converting from mysql to postgres

2013-05-18 Thread Mike Dewhirst
I cannot claim any DBA credentials so be careful reading further. I use dumpdata successfully with lots of --exclude=djkgd.sdsghg options only for testing fixtures. I have tried a few times and failed to get it working transferring between two Postgres databases. I use postgres dump and load

Re: No styling in Chapter 6 in djangobook

2013-05-20 Thread Mike Dewhirst
On 21/05/2013 11:07am, djingo django wrote: I'm starting to learn Django and have been reading through the djangobook.com. I am able to get the code running when I come to Chapter 6: The Django Admin Site, but it looks nothing like the well-formed and well-styled screenshots in the documentatio

Re: Help with robots.txt

2013-05-24 Thread Mike Dewhirst
On 24/05/2013 10:04pm, frocco wrote: Hello, Can someone give me an example of configuring robots.txt? I want to block the admin site. and anything else? I needed this info recently and googled robots.txt. This was the second item ... http://www.robotstxt.org/robotstxt.html -- You rece

Re: Scripts to update Django tables

2013-05-29 Thread Mike Dewhirst
On 30/05/2013 12:01am, Brian wrote: I'm new to Django (and frameworks in general) and having an issue with a project I'm working on. Basically, I want to scrape data from a sports league website on a regular schedule and add updated stats into my database. I think the way you have described th

Re: Using multiple model files per app with the Improved Multiple Model Files Django Snippet

2013-05-30 Thread Mike Dewhirst
On 30/05/2013 10:43pm, Doug S wrote: I'm trying to use multiple files for my models in a single app. I found a nice solution on Django Snippets : http://djangosnippets.org/snippets/1838/ but I'm not able to get it to work. The docs assume that I know more than I do abo

Re: Best packages for aggregating news + compiling stats

2013-05-30 Thread Mike Dewhirst
On 31/05/2013 1:18pm, C. N. Desrosiers wrote: I'm in the early stages of planning a website that will aggregate news on a specific topic (and later have other sections with statistics pulled from various public data sets). Google News seems to have an excellent algorithm for selecting the most r

Re: linux or windows

2013-05-31 Thread Mike Dewhirst
On 31/05/2013 9:11pm, Kakar Arunachal Service wrote: Hi! I know this question is one absurd question, but just out of curiosity, is it important to use linux other than the windows, related to django. Cause i'm in windows, and if it is, then i was thinking to use Ubuntu. Please advise. I develo

Re: Writing your first Django app - Tutorial Question

2013-06-04 Thread Mike Dewhirst
On 5/06/2013 9:10am, Tony Guilin wrote: In the https://docs.djangoproject.com/en/1.5/intro/tutorial01/ tutorial under the, Playing with the API section, I'm trying to go through the example in my python shell as described. p = Poll(question="What's new?", pub_date=timezone.now()) But

problem with logical and

2013-06-06 Thread Mike Dewhirst
I can't work this one out. I have a blind spot. Any help appreciated. My unit tests indicate a problem with the following method (is_current) on a model. Because I couldn't figure it out I instrumented with a whole mess of print statements. The problem occurs on the line with self.quality_tag.

Re: problem with logical and

2013-06-06 Thread Mike Dewhirst
On 7/06/2013 1:31pm, Mike Dewhirst wrote: I can't work this one out. I have a blind spot. Any help appreciated. Accidentally fixed this trying workarounds. Still not sure what was happening but I suspect I don't fully understand None in the boolean context. Anyway, I'm bein

Re: Deployment problem with google bots

2013-06-23 Thread Mike Dewhirst
On 22/06/2013 11:54pm, frocco wrote: Hello I get error messages from time to time because a google bot try's to view a product that no longer exists. How do I prevent this? Are you responding with the correct error message (probably 404) when someone looks for a non-existent page? -- You

Re: Help in finding how to learn Django

2013-06-28 Thread Mike Dewhirst
On 28/06/2013 5:49pm, subsn...@gmail.com wrote: Hi all, What is the best way to learn Django 1.5 thouroughly? I have been a .NET developer and have a really good understanding of OOP, HTML5, CSS and JavaScript. I also have an entry-level knowledge of Python. I am completely new to MVC (or MVT, i

Re: What is the best practice to learn Django 1.5?

2013-06-28 Thread Mike Dewhirst
On 28/06/2013 11:47pm, Roberto López López wrote: Two scoops of django is also a good book https://django.2scoops.org/ +1 On 06/28/2013 03:45 PM, Gabriel wrote: Hey, you could also try Getting Started With Djangorest, that's a series of classes in everything you might need to become a Dja

data transfer between databases

2013-06-30 Thread Mike Dewhirst
This is probably a Postgres question but someone might be able to offer advice on how to transfer data :) New "reference" or read-only data gets input during development and I want to transfer it to the production database from time to time. I think my choices are: 1. Re-enter it manually -

Re: data transfer between databases

2013-06-30 Thread Mike Dewhirst
nship. Thanks Mike On 30/06/2013 5:40pm, Mike Dewhirst wrote: This is probably a Postgres question but someone might be able to offer advice on how to transfer data :) New "reference" or read-only data gets input during development and I want to transfer it to the production databa

Re: HELP : Installation of Django 1.6 in Windows

2013-06-30 Thread Mike Dewhirst
On 1/07/2013 12:16am, Othmane Abouelaecha wrote: Hi !! I recently learned to program with python 3.2 I have a difficulty concerning Django I want to install the latest version 1.6 that supports python 3.2 I only found a way to install in Linux but I'm running Windows 7 !! You should be able to

Re: data transfer between databases

2013-06-30 Thread Mike Dewhirst
Best regards François On Jun 30, 2013, at 6:24 PM, Mike Dewhirst wrote: mulianto and Avraham Thanks for your suggestions. Dumping data isn't the entire problem - which is this: There will be an *ongoing* need to add new data from tables in one database to the same-named tables in another

Re: data transfer between databases

2013-07-01 Thread Mike Dewhirst
Tom I'm not a DBA so I'll need to do some quiet study of those references. Thanks for that. Cheers Mike On 1/07/2013 9:35pm, Tom Evans wrote: On Sun, Jun 30, 2013 at 11:24 PM, Mike Dewhirst wrote: mulianto and Avraham Thanks for your suggestions. Dumping data isn't the

Re: Getting URL root

2013-07-01 Thread Mike Dewhirst
On 2/07/2013 10:09am, Larry Martell wrote: I have an app I distribute to clients. When I run the app on my local machine I connect to http://127.0.0.1/... When I'm VPN-ed into a client site I connect to the app on their machine with http://xx.xx.xx.xx/... When a client is running locally at thei

Re: data transfer between databases

2013-07-01 Thread Mike Dewhirst
On Monday, July 1, 2013 10:32:53 PM UTC+10, si...@2ndquadrant.com wrote: > On 1 July 2013 13:02, Mike Dewhirst >wrote: > > >> On 1/07/2013 9:35pm, Tom Evans wrote: >> >>> On Sun, Jun 30, 2013 at 11:24 PM, Mike Dewhirst >>> > >>> wrote: &

Re: data transfer between databases

2013-07-02 Thread Mike Dewhirst
On 2/07/2013 4:01pm, Simon Riggs wrote: On 2 July 2013 05:49, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote: On Monday, July 1, 2013 10:32:53 PM UTC+10, si...@2ndquadrant.com <mailto:si...@2ndquadrant.com> wrote: On 1 July 2013 13:02, Mike Dewhirst wrote:

Re: Getting URL root

2013-07-02 Thread Mike Dewhirst
On 2/07/2013 5:07pm, Larry Martell wrote: I need to get it from a standalone program. It's a django script, but not invoked from a request. import socket def get_fully_qualified_domain_name(): return socket.getfqdn() -- You received this message because you are subscribed to the Google Gr

Re: Getting URL root

2013-07-02 Thread Mike Dewhirst
On 2/07/2013 9:51pm, Larry Martell wrote: On Tue, Jul 2, 2013 at 1:25 AM, Mike Dewhirst wrote: On 2/07/2013 5:07pm, Larry Martell wrote: I need to get it from a standalone program. It's a django script, but not invoked from a request. import socket def get_fully_qualified_domain

Re: Getting URL root

2013-07-02 Thread Mike Dewhirst
On 2/07/2013 4:43pm, Larry Martell wrote: On Mon, Jul 1, 2013 at 7:55 PM, Sithembewena Lloyd Dube wrote: It sounds like you want to get the subdomain. Havew a look at the urlparse module and its usage. http://stackoverflow.com/questions/6925825/get-subdomain-from-url-using-python Perhaps I

Re: Unable to get python manage.py runserver to work

2013-07-11 Thread Mike Dewhirst
On 12/07/2013 1:01pm, Yves S. Garret wrote: I was able to import django from inside of python 2.6.6 (which is what I'm going with at the moment). However, when I try to display something in a browser, this is the problem that I'm getting: $ python /path/to/file/manage.py runserver Traceback (mo

how can an abstract class know which class inherits it

2013-07-11 Thread Mike Dewhirst
I have four models, all of which inherit the fields and methods of a single abstract model. For one of those abstract fields, I would like help_text to vary depending on which model has inherited it. Is this possible? If so, how can I do it? Thanks Mike -- You received this message becaus

Re: help with query set

2013-07-14 Thread Mike Dewhirst
On 15/07/2013 1:11am, Bobby Roberts wrote: hi. I need help with this simple setup. i need to get a list of announcements where active =1 and the discontinueDate is either null OR less than NOW. I haven't looked at your code but your words above indicate you want all announcements which have

Re: Error with Passing a class name as a parameter in a ManyToManyField

2013-07-14 Thread Mike Dewhirst
On 15/07/2013 1:02am, Charounson Saintilus wrote: This is my first time using the Django Web Framework and I'm new to the python language, so please bear with me. I've created a model (i.e. a class) called Course which defines several variables: class Course(models.Model): name = models

Re: Python 2.7 + Django 1.4 + apache 2.4

2013-07-16 Thread Mike Dewhirst
On 16/07/2013 12:25pm, carlos wrote: where is the error ?? On Mon, Jul 15, 2013 at 5:11 PM, maiquel mailto:maiquelknech...@gmail.com>> wrote: How to set up django on Apache I'm using django 1.4 and apache 2.4 and Python 2.7 My configuration is well in httpd.conf Th

Re: Python 2.7 + Django 1.4 + apache 2.4

2013-07-16 Thread Mike Dewhirst
On 16/07/2013 9:59pm, Robert Jonathan Šimon wrote: I have one question what must be in wsgi.py? This is mine ... which works for Django 1.5 from __future__ import unicode_literals # -*- coding: utf-8 -*- import os import sys from django.core.wsgi import get_wsgi_application project = "xxx" sr

mutable verbose_name and help_text

2013-07-16 Thread Mike Dewhirst
Is there a way to adjust inherited verbose_name and help_text in child tables depending on which child table is inheriting? Sergiy Khohlov very kindly offered a generic OOP solution[1] to a recent question I asked "how can an abstract class know which class inherits it" I tried Sergiy's solut

Re: Best practice - using Django model's in-built id field?

2013-07-18 Thread Mike Dewhirst
On 19/07/2013 11:31am, Victor Hooi wrote: Hi, I'm just wondering - is it considered good or bad practice to use a Django model's in-built ID field? Say for example you wanted a unique identifier for each transactio - should you be generating your own, or can you use just self.id? Don't go the

Re: Best practice - using Django model's in-built id field?

2013-07-18 Thread Mike Dewhirst
ll be issues with migration, what do you mean? Is it because that field is also as a FK to other models? Or something else? Cheers, Victor On Friday, 19 July 2013 11:50:25 UTC+10, Mike Dewhirst wrote: On 19/07/2013 11:31am, Victor Hooi wrote: > Hi,

Re: Allow users to have a online store on the site

2013-07-19 Thread Mike Dewhirst
On 20/07/2013 8:36am, Karl Arunachal wrote: Hello, There's one plugin for wordpress called Marketpress E commerce, it has many features, but what i am interested is that, with that plugin users can create online store in your site and sell their products. So, is there any plugin or package like M

Re: cannot import name current_datetime

2013-07-25 Thread Mike Dewhirst
On 25/07/2013 5:18pm, jacob poke wrote: Djangobook on the internet. Quick beginners question: In Chapter 3, where I am looking at a dynamic webpage in the 2nd example I am running into some problems with the current_datetime function I am trying to set up. When, in views.py I insert the "datet

Re: django.contrib.auth and username's field size

2013-07-25 Thread Mike Dewhirst
On 26/07/2013 8:12am, Jonathan Baker wrote: Ideally your Django project would contain many different applications, which in turn have their own models.py module. I've yet to work on a project large enough to warrant that i try this, so what I'm about to say is completely untested... but I would t

Re: Django documentation code ?

2013-07-26 Thread Mike Dewhirst
On 27/07/2013 3:37am, Vinod Halaharvi wrote: Is there a way to download just the code examples listed in the Django documentation pages ? That's not necessarily a good idea but it depends what you want to do.. Why do you want to do that? It wouldn't be too difficult to write a little screen s

Re: error

2013-07-26 Thread Mike Dewhirst
On 27/07/2013 5:10am, veda av wrote: manage.py not recognized as an internal or external command why do we get this error manage.py isn't there. Or if it is there it isn't on the path. Did you cut any corners during installation? -- You received this message because you are subscribed to t

Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-07-26 Thread Mike Dewhirst
On 27/07/2013 10:20am, Cate Liu wrote: I am a new newbie to Django. Great tutorial BTW. I followed it to the T and 99.9% worked. Except the last step in the Advanced tutorial, the step 3 in 'Using your own package'. I could see http://127.0.0.1:8000/admin/ and create polls without any problem.

many-to-many between apps

2013-07-31 Thread Mike Dewhirst
Is it possible to establish a many-to-many relationship between a model in one app and a model in another app? I've just tried to do it and run into what I think is circular import trouble. This is a retro-fit after initial deployment. #in item.models.reference class Reference(models.Model):

Re: many-to-many between apps

2013-07-31 Thread Mike Dewhirst
On 31/07/2013 5:08pm, Mike Dewhirst wrote: Is it possible to establish a many-to-many relationship between a model in one app and a model in another app? Yes. I needed to avoid importing the class and use ... class Region(models.Model): ... various fields ... ref

Re: how to create a new table in existing app

2013-07-31 Thread Mike Dewhirst
On 31/07/2013 5:57pm, Mike Dewhirst wrote: I just defined a new many-to-many relationship in an existing table then manually defined the many-to-many table model. Unfortunately, syncdb didn't/wouldn't create the table for me. No errors, just no table! Is there a trick to it? Yes. J

Re: Error UnicodeDecodeError when access http://127.0.0.1:8000/admin/

2013-08-02 Thread Mike Dewhirst
On 3/08/2013 2:44am, Hoàng Trần wrote: Hi everybody, I am very new to Django. I've just installed it and walked through https://docs.djangoproject.com/en/1.5/intro/tutorial01/ My environment is: windows 7 / Python 2.6.6 / Django 1.5.1 / MySQL 5.5.27 I've finished the 01 tutorial, and intend t

Re: django and favicon.ico

2013-08-04 Thread Mike Dewhirst
On 5/08/2013 4:22am, Tundebabzy wrote: Hi, Is there any documentation on how django behaves during a GET /favicon.ico? In my django 1.4.5 installation with runserver, GET /favicon.ico redirects to /media/img/favicon; on OpenShift, it redirects to /media/favicon.ico. It is a static image no diff

Re: Django for corporate web site

2013-08-05 Thread Mike Dewhirst
On 6/08/2013 2:07pm, sean chen wrote: I need to build a site for a small law firm. I looked at the poweredby pages http://www.djangosites.org/, but I found it shows sites for different purposes and I did not find a good example site for me to spark my thoughts further. I see there exists a focus

Re: Exception Value: No module named url -- on django poll tutorial

2013-08-08 Thread Mike Dewhirst
On 8/08/2013 5:53pm, goreano wrote: Hi, I'm a newbie diving into django I've found a problem I've been hitting my head against for the last 2 days. I think it is a path issue, actually I get the same error as i try to open any URL on localhost:8000 Can you please give me a hint... I have to i

Re: Exception Value: No module named url -- on django poll tutorial

2013-08-08 Thread Mike Dewhirst
Sorry - I didn't look past your settings ROOT_URLCONF Nor did I see that others have responded. Please disregard mine. Cheers Mike On 8/08/2013 11:20pm, Mike Dewhirst wrote: On 8/08/2013 5:53pm, goreano wrote: Hi, I'm a newbie diving into django I've found a problem I

Re: Why can't a Model have the same name as a View?

2013-08-08 Thread Mike Dewhirst
On 9/08/2013 4:13am, JJ Zolper wrote: Hello everyone, I've only been working with Python and Django for a couple of years now and whenever I can I like to learn more about certain rationalizations for certain decisions made within each of them. In Django we define a Python class with a name to

Re: south in windows

2013-08-11 Thread Mike Dewhirst
On 12/08/2013 5:36am, Karl Arunachal wrote: Hi, I am trying to sync south in my db, but i can't sync it. Its giving me an error: (use ./manage.py migrate to migrate these) Is there anyway to do this command, "./manage.py", in windows. I could have done it by chmod + x manage.py in other os. But h

Re: django windows user

2013-08-11 Thread Mike Dewhirst
On 12/08/2013 8:47am, Aaron C. de Bruyn wrote: MySQL or Postgresql for your database, followed by some basic SSH/SCP knowledge. For Windows users I recommend two tools: PuTTY and WinSCP. If you have a choice go with PostgreSQL and Filezilla is a useful tool which knows the SSL/TLS protocols

Re: Filtering a drop-down list in Admin

2013-08-11 Thread Mike Dewhirst
On 12/08/2013 4:51am, Chad wrote: Hi, I am new to Django, I have read a good bit of the documentation and am trying to write an app. This app is simple and should allow for a lost of contacts and companies. Each company has different locations (or addresses) such as main office, branch office et

Re: ImportError: No module named 'exceptions' - Python3

2013-08-11 Thread Mike Dewhirst
On 12/08/2013 3:21pm, abhijeet shete wrote: Hi Folks, I ported my project from python2.7 to python3 using 2to3 module. One of my class is inherited from Exception class, but after porting to python3 i am getting *No module named 'exceptions' *error. My class looks something like this

Re: South doesn't recognize modification in ManytoMany fields

2013-08-14 Thread Mike Dewhirst
On 15/08/2013 8:01am, Pradeep Kumar wrote: I have made a model change from standard = models.ManyToManyField(Standard) to standard = models.ManyToManyField(Standard, blank = True, null = True) South schemamigration for this app doesn't recognize the change ? I think it is probably not neces

Re: Model verbose name appears to split up on capitalisation (e.g. "iOS") - any way to suppress this?

2013-08-14 Thread Mike Dewhirst
On 15/08/2013 2:06pm, Victor Hooi wrote: For example, verbose_name-Plural on the main admin page (/admin) still seems to insist on capitalising the first "i" - as in, it appears as "IOS clients", rather than "iOS clients", as it's set in class Meta: Try verbose_name = " iOS Clients" with a lea

Re: Model verbose name appears to split up on capitalisation (e.g. "iOS") - any way to suppress this?

2013-08-15 Thread Mike Dewhirst
e the workaround. Mike Cheers, Victor On Thursday, 15 August 2013 15:08:00 UTC+10, Mike Dewhirst wrote: On 15/08/2013 2:06pm, Victor Hooi wrote: > For example, verbose_name-Plural on the main admin page (/admin) still > seems to insist on capitalising the first &quo

Re: Greyed out models in Django Admin

2013-08-16 Thread Mike Dewhirst
On 16/08/2013 3:37pm, huw_at1 wrote: Hi, I still have this issue and can't really figure out what the problem is. I have found that if I turn on DEBUG then the apps models become active again such that I can add new records via the admin interface. However when turning off DEBUG they become inac

Re: upgrading to 1.5.1

2013-08-18 Thread Mike Dewhirst
On 18/08/2013 4:51pm, Harjot Mann wrote: Hello Everyone Currently I am using django version 1.4.5 and I want to upgrade it to 1.5.1, I have an app in django. I want to know that what problems will I face while upgrading to that version. I have no idea about the features of new version. Any major

Re: Representing infinity or "no limit" in an integer field?

2013-08-19 Thread Mike Dewhirst
On 19/08/2013 5:39pm, Victor Hooi wrote: Hi, I have a Django IntegerField that I'm using to store the purchase limit for a product. purchase_limit = models.IntegerField() I also need to represent no limit (i.e. infinity) as well in that field. I was thinking of just using NULL to represe

Re: pycharm constant error

2013-08-24 Thread Mike Dewhirst
On 25/08/2013 11:56am, Patrick Larmann wrote: Hello guys, I really appreciate the help. I have a problem with Pycharm. I am getting this constant error in my runserver.py in both of my projects. I did not modify or touch the file, and yet the error persists. I attached a screenshot. It looks (t

Re: pycharm constant error

2013-08-24 Thread Mike Dewhirst
er to. Mike Thx! On Saturday, August 24, 2013 11:02:38 PM UTC-4, Mike Dewhirst wrote: On 25/08/2013 11:56am, Patrick Larmann wrote: > Hello guys, > I really appreciate the help. I have a problem with Pycharm. I am > getting this constant error in my runserver.py

Re: Django Sites set current domain to site_id

2013-08-27 Thread Mike Dewhirst
On 28/08/2013 4:01am, Gerd Koetje wrote: Hi all, I got a django application that is called by difrant domains for the same code (some minor changes for each domain) When i visit my application trough domain1.com or domain2.com its keep outputting data from the set site_id in settings How can i

Re: Django Sites set current domain to site_id

2013-08-27 Thread Mike Dewhirst
On 28/08/2013 9:08am, Mike Dewhirst wrote: On 28/08/2013 4:01am, Gerd Koetje wrote: Hi all, I got a django application that is called by difrant domains for the same code (some minor changes for each domain) When i visit my application trough domain1.com or domain2.com its keep outputting

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Mike Dewhirst
On 1/09/2013 2:11am, Gerd Koetje wrote: to explain myself a bit more: gerd12 = should be valid gerd1234 = should be valid gerd 1234 = should not be valid %$$%%#$ = should not be valid gerd123456 - should not be valid You have just specified five cases for unit tests. Start there and experim

Re: I really about to give up Django

2013-09-02 Thread Mike Dewhirst
On 2/09/2013 11:58pm, Andre Terra wrote: /Non sequitur/. Obscure variable names can happen regardless of the coder's language choice, ... which reminds me that I need to refactor more aggressively to make sure my variables and especially column names (and verbose_name) more closely match/ref

Re: django security

2013-09-08 Thread Mike Dewhirst
On 8/09/2013 3:23am, Natko Perko wrote: I browsed through books like Pro Django, Two scoops, Effective Django etc. and I pretty much found the same things as in the documentation. I was hoping to find, as I said before, a version for dummies with things explained from the basics or sowhat, like

Re: New field in django

2013-09-09 Thread Mike Dewhirst
On 10/09/2013 3:28pm, Harjot Mann wrote: On Mon, Sep 9, 2013 at 10:59 AM, Xavier Ordoquy wrote: The message is: "Table 'tcc_report' already exists" This means that you already created the tables with syncdb which bypassed south and you're trying to created them again with south. You'll be abl

Re: Validation on creation

2013-09-16 Thread Mike Dewhirst
On 17/09/2013 2:06pm, Lachlan Musicman wrote: Hola, I'm pretty sure I get this, but I thought I'd ask. With an inventory model like: class Movement(models.Model): item = models.ForeignKey(Carrier) date = models.DateField(default=timezone.now()) user = models.ForeignKey(User)

Re: Trouble with STATIC_URL in v1.5.2

2013-09-16 Thread Mike Dewhirst
On 17/09/2013 3:49pm, Jacky Tian wrote: I think the standard way of including static files in templates in 1.5+ is through the staticfiles app . In particular, look at the documentation on the {% static %} template tag. Depending on

Re: Using environment variables in settings.py - good practice? How to handle missing variables gracefully?

2013-09-18 Thread Mike Dewhirst
On 19/09/2013 3:59pm, Victor Hooi wrote: Hi, Hmm, in many cases there isn't really a sensible default (e.g. API keys or passwords). I was asking more in terms of - is this the "right" way of doing it in Django, or are people using some other technique to handle configuration you don't want in t

Re: Couple of random Error 500 issues

2013-09-20 Thread Mike Dewhirst
On 21/09/2013 3:34am, Carlos Villavicencio wrote: Hello, I have a django project running on digitalocean (in a 512M server) and suddenly it appears Error 500 on the Apache. I'm running wsgi and only 2 users (because we are starting) Looking on the logs, the errors were the following: 1. Impro

Re: Overriding Settings before running any tests that loads fixtures.

2013-09-21 Thread Mike Dewhirst
On 22/09/2013 9:47am, Alex Thomas wrote: My basic problem is that I am trying to run a test that loads fixtures but I want to modify some settings before the fixtures are loaded. Check out Two Scoops of Django - there is a whole chapter on this. Esssntially you need some test settings which on

Re: CMS base to start with?

2013-09-27 Thread Mike Dewhirst
On 28/09/2013 7:37am, Anton Melser wrote: Are you try with https://www.djangopackages.com/ ?? The problem is the amount of choice. There seem to be many great packages there but I was hoping someone from the community with more intimate knowledge of wh

In the Admin how do I display the target data instead of the m2m intermediary data

2013-10-01 Thread Mike Dewhirst
Consider a bunch of substances and a bunch of papers written by various researchers. Some of the papers apply to more than one substance and a substance can have multiple papers. Here are the models ... class Paper_Substance(models.Model): paper = models.ForeignKey('Paper', null=True, blank

Re: In the Admin how do I display the target data instead of the m2m intermediary data

2013-10-01 Thread Mike Dewhirst
On 2/10/2013 10:20am, Russell Keith-Magee wrote: On Wed, Oct 2, 2013 at 6:19 AM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote: Consider a bunch of substances and a bunch of papers written by various researchers. Some of the papers apply to more than one substance

is it possible to make the |safe template filter conditional on content

2013-10-02 Thread Mike Dewhirst
I made a custom template filter (ref_href) which converts numbered references (like [1], [2] etc) into footnote hyperlinks. It works but requires the |safe filter which is dangerous. To be actually safe I want to *only* use the |safe filter when the data contains a numbered reference. Which I

Re: is it possible to make the |safe template filter conditional on content

2013-10-03 Thread Mike Dewhirst
custom filter myself and convert it to Klingon but add my own html for footnotes and flag all such fields as safe? Hadn't thought of that. Might investigate calling the Django safe filter from within the custom filter ... Great idea, thanks Mike On Thu, Oct 3, 2013 at 2:55 AM, Mike Dew

Re: is it possible to make the |safe template filter conditional on content

2013-10-03 Thread Mike Dewhirst
On 4/10/2013 9:44am, Mike Dewhirst wrote: On 4/10/2013 12:21am, Bill Freeman wrote: You can certainly write a custom filter. And if you do that, you can divvy up your value into footnote links and other, and escape the other parts yourself, returning the result as a safe string. So you mean

Re: css

2013-10-20 Thread Mike Dewhirst
On 20/10/2013 11:07pm, Diogene Laerce wrote: Hi, Could someone tell me if it is normal to have the css not working once one starts the real server (nginx) instead of the dev server on the admin interface ? The dev server "just knows" where the static files are. The real server needs to be con

Re: needs_autoescape in custom template filter vs model method

2013-10-21 Thread Mike Dewhirst
On 22/10/2013 4:56am, fchow wrote: My question is about returning HTML markup in a model method vs. a custom template filter. Personally, I prefer the custom template filter due to a nicer separation of model/display concerns. That said, I recently discovered Django's mark_safe() from djang

Re: HOWTO: Create a ManyToMany Relationship?

2013-10-22 Thread Mike Dewhirst
On 23/10/2013 11:51am, Pepsodent Cola wrote: I'm a beginner so I can only answer your first question. The below link has helped me with 1:M and N:M relationship experiments. Can someone point me to where this is explained in the docs (1.6)? https://docs.djangoproject.com/en/1.6/topics/db/

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