index for fields with unique=True and db_index True

2010-11-05 Thread jordi
When I create the following model I get an index for field2 with syndb or sqlindexes. Why doesn't it create an index for field3? from django.db import models class Entitat(models.Model): field1 = models.CharField(max_length=4, unique=True) field2 = models.CharField(max_length=4, db_index=T

django-avatar image src

2010-11-05 Thread Sithembewena Lloyd Dube
Hi all, I installed the django-avatar app in my project and, in a template, i have the {% load avatar_tags %} and {% avatar user 65 %} template tags. When I load the page and view source, the avatar's alt tag is correct but the image src is wrong. It appears relative to the template's directory in

Re: django-avatar image src

2010-11-05 Thread Sithembewena Lloyd Dube
Update: I added AVATAR_STORAGE_DIR = MEDIA_ROOT to my settings.py file. When I load the page, the avatar's src is "C:/Websites/TPFRepository/projectname/media/username/image.jpg" - which is correct. if i paste that into Windows Explorer, I do find the image. Still, it is not displayed on the page

Re: Sample Auto Log Out Code

2010-11-05 Thread Daniel Roseman
On Nov 5, 6:51 am, derek wrote: > Fred > > This seems not related to the original topic; please start a new > thread. That seems to be a constant issue with Fred's posts: I think every one of his that I've seen has been added onto the end of an existing thread, while changing the subject. Fred,

Re: Sample Auto Log Out Code

2010-11-05 Thread Daniel Roseman
On Nov 3, 12:43 pm, octopusgrabbus wrote: > Does anyone have samples for auto logging out a user? What do you mean by 'auto logging out'? -- DR, -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@

how to use csvimport.py successfully - integrity error _id moy not be null

2010-11-05 Thread shofty
ive built a mini shop as part of a project. im trying to drag content in from csv, using one of the django snippets link:(http:// djangosnippets.org/snippets/788/) so my models are Brand Category Product and product references both a brand and a category. python csvimport.py --csv dubkorps.csv --

inserting bits of javascript into individual pages

2010-11-05 Thread Ellen
Dear all, I am just learning the ropes of django so please direct me to a better place if my question has been asked a million times before or plain ridiculous. I am managing a website that uses the django platform -- I am not responsible for building it from scratch so the basic functionality is

Re: django-avatar image src

2010-11-05 Thread Mário Neto
instead this: MEDIA_URL = os.path.realpath(PROJECT_PATH + '/media/') try: MEDIA_URL = '/media/' 2010/11/5 Sithembewena Lloyd Dube > Update: I added AVATAR_STORAGE_DIR = MEDIA_ROOT to my settings.py file. > > When I load the page, the avatar's src is > "C:/Websites/TPFRepository/projectname/media

Re: django-avatar image src

2010-11-05 Thread Sithembewena Lloyd Dube
Mario, thank you very much! You just made my day. Regards, Lloyd On Fri, Nov 5, 2010 at 1:23 PM, Mário Neto wrote: > instead this: > MEDIA_URL = os.path.realpath(PROJECT_PATH + '/media/') > try: > MEDIA_URL = '/media/' > > 2010/11/5 Sithembewena Lloyd Dube > >> Update: I added AVATAR_STORAGE_D

Re: Why Won't Form Elements Display?

2010-11-05 Thread octopusgrabbus
Thanks. I put back the {% block title %}, {% block head %}, and {% block content %} directives, corrected the error in forms.py, but the field still won't display. Any other ideas to try? On Nov 4, 6:44 pm, Daniel Roseman wrote: > On Nov 4, 10:32 pm, octopusgrabbus wrote: > > > > > I have a form

Re: inserting bits of javascript into individual pages

2010-11-05 Thread Tereno
Hi Ellen, Sounds like what you're looking to do is template inheritance. You can most definitely add dynamic bits of code based on individual pages. Some documentation on the topic can be found here: http://docs.djangoproject.com/en/dev/topics/templates/ Basically what I think you'll need is to c

Re: inserting bits of javascript into individual pages

2010-11-05 Thread Daniel Roseman
On Nov 5, 8:26 am, Ellen wrote: > Dear all, > > I am just learning the ropes of django so please direct me to a better > place if my question has been asked a million times before or plain > ridiculous. > > I am managing a website that uses the django platform -- I am not > responsible for buildin

Re: Why Won't Form Elements Display?

2010-11-05 Thread Daniel Roseman
On Nov 5, 12:10 pm, octopusgrabbus wrote: > Thanks. I put back the {% block title %}, {% block head %}, and {% > block content %} directives, corrected the error in forms.py, but the > field still won't display. Any other ideas to try? Not really. Do those blocks exist in the parent template? Can

Strange Error

2010-11-05 Thread mwarkentin
In the middle of the night, I started getting a bunch of emails about server errors on my Django app. I haven't touched it for over a month. I logged onto the server and restarted Apache.. the error continued popping up for a couple of seconds, and then everything went back to normal. Any ideas

Re: How to aggregate values by month

2010-11-05 Thread derek
Maybe slightly "off topic" but does anyone have robust strategies for readily switching between different DB-specific SQL code which is (presumably) embedded in one's app/project? (As shown in the two examples presented here) On Nov 5, 1:10 am, David Zhou wrote: > FWIW, on Postgres DBs, I've don

Re: Empty Response

2010-11-05 Thread Eric
In "Live HTTPS headers", a FF plugin, I see this: http://cstoolstest.tnc.org/search/search?q=conservation&collections=EAST%7CTEA&start=1 GET /search/search?q=conservation&collections=EAST%7CTEA&start=1 HTTP/ 1.1 Host: User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: 1.9

Re: Django apps and models

2010-11-05 Thread derek
I'll add my 2c here... I don't think you need to create an app for this (not yet). Just create a normal Django project and go from there. Apps are more meant for very generic types of functionality that can be used in many, many situations e.g. tagging. Your design is still very broad and so ha

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-05 Thread derek
Its not clear exactly what you think the problem is. The system is behaving correctly ito the way you have set it up. 1. You have specified that name and address are compulsory fields in Place. 2. You have specifed that Restaurant must be linked to Place (i.e. Place must be created before Restaur

Re: Empty Response

2010-11-05 Thread Eric
Actually, I just realized that Python is crashing silently during one of my method calls. But, this only happens when coming through Apache and not when I hit Django's own server directly. :( Thanks for the help! On Nov 5, 9:31 am, Eric wrote: > In "Live HTTPS headers", a FF plugin, I see this:

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-05 Thread ringemup
I'm not trying to create a Restaurant without a name and address. I'm trying to turn an existing Place into a Restaurant. On Nov 5, 9:42 am, derek wrote: > Its not clear exactly what you think the problem is.  The system is > behaving correctly ito the way you have set it up. > > 1. You have spe

Re: Why Won't Form Elements Display?

2010-11-05 Thread octopusgrabbus
Thanks. I'm starting from the beginning and will eventually get back to this level of template extraction. On Nov 5, 9:00 am, Daniel Roseman wrote: > On Nov 5, 12:10 pm, octopusgrabbus wrote: > > > Thanks. I put back the {% block title %}, {% block head %}, and {% > > block content %} directives

Re: access an app on another server

2010-11-05 Thread Russ B.
I had a similar problem where I needed to get read-only access to a Django model from a system script. I'm not sure what information you're trying to pull, but in my own case I just wrote a view that dumped the info I needed and write a simple authentication function that tested the visitor's IP ad

Re: Django apps and models

2010-11-05 Thread andy
Thanks for the advise, I had considers this option, and I really dose seem that apps are move for generic features as you pointed out but I have about 10 tables which are as depended in structure as the ones noted above. I really don't what to have too much code in one view.py or model.py file. For

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-05 Thread Derek
You mean "trying to add a Restaurant which is linked to an existing place" I am not familar with the syntax you are using for the **{} wrapper. The original example shows: r = Restaurant(place=p1, serves_hot_dogs=True, serves_pizza=False) and the attached note says: Pass the ID of the "parent"

Re: Forking a background process on request

2010-11-05 Thread Elver Loho
Celery is exactly what I'm looking for! Thanks! :) On 4 November 2010 13:41, Brian Bouterse wrote: > I would look into django-celery to do asynchronous tasks.  It can also be > executed as a webhooks style, see here. > > Brian > On Thu, Nov 4, 2010 at 3:31 AM, Elver Loho wrote: >> >> Hi, >> >> I

Re: Multi-table Inheritance: How to add child to parent model?

2010-11-05 Thread ringemup
**{} is sort of the inverse of **kwargs in a function signature -- it's a way to use a dictionary in place of keyword arguments, and should function identically. Which "original example" are you referring to? On Nov 5, 10:25 am, Derek wrote: > You mean "trying to add a Restaurant which is link

Re: Empty Response

2010-11-05 Thread Eric
Yep, that is what it was. Our SA did some Googling and found the solution to the problem. http://code.google.com/p/modwsgi/wiki/IssuesWithExpatLibrary Thanks for the help and thoughts. On Nov 5, 9:47 am, Eric wrote: > Actually, I just realized that Python is crashing silently during one > of m

TemplateDoesNotExist - on Windows

2010-11-05 Thread deepak dhananjaya
Greetings! I have installed the latest django on windows, and the current folder structure here is : clinicmanager\clinic - my app clinicmanager\templates - template dir i m using settings.py in clinicmanager\settings.py TEMPLATE_DIRS = ( "C:/drives/workarea/Django/django/bin/clinicman

Re: How to get request.user when Django emails a 500 error report?

2010-11-05 Thread Margie Roginski
Thank you Sid! Early on there were no responses to my question, and I hadn't looked recently. So just now I got back to this issue and googled "django error email user" and what a suprise to find my own question (with your response) came back near the top of my search! Your response was so excell

Splitting tests.py to package

2010-11-05 Thread Jari Pennanen
I've been trying to split tests.py, but I've noticed that models defined inside test module does not work. Normally one can define models in tests.py like this: class JSONFieldModel(models.Model): json = JSONField() class JSONFieldTest(TestCase): def setUp(self): pass def tes

grouping of fields inside a model into a class

2010-11-05 Thread nitm
Hi, Is there a way to combine a set of fields I have in a model class into a different class without it having it's own separate table? An example: I want to implement the user profile model class, and in it I would like to have the address of the user. The address is group of fields (city, stree

How to remove an app and its tables

2010-11-05 Thread Margie Roginski
I've stopped using a particular app in my project. I've used South to remove its tables, but I still see those tables referenced by the auth, content_type, and django_project_version tables. Is this ok? Anyone know if it will cause me any problems down the line? Margie -- You received this m

Adding "Using foo" to the end of an order by

2010-11-05 Thread benbeec...@gmail.com
I need to sort results alphanumerically. Thanks to some code floating around #postgres (http://www.rhodiumtoad.org.uk/junk/naturalsort.sql) I now have some handy operators to do just that. The raw sql I'd issue to ensure that the results are sorted correctly would be something like "select * from f

Re: enable admin gives error

2010-11-05 Thread jt
Thank you very much Russ, the missing comma was indeed the problem. Having corrected my syntax it runs fine. :D jt On Nov 5, 12:25 am, Russell Keith-Magee wrote: > On Fri, Nov 5, 2010 at 11:59 AM, jt wrote: > > Hi, > > I'm just starting out.  Things ran fine until I uncomment out: > > (r'^admin

Re: How to remove an app and its tables

2010-11-05 Thread Michael Sprayberry
Margie,     I believe this may cause issues if for some reason that there is a call to those tables and it still finds a reference to it. Remember to go and remove them from the admin register that should get rid of all references to them.     Michael I've stopped using a particular app  in my