Since recently: django_session error

2010-07-20 Thread PieterB
When I try to access the admin interface, I receive the following error DatabaseError at /admin/ no such table: django_session (File "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/ base.py", line 200, in execute return Database.Cursor.execute(self, query, params) DatabaseError:

Horizontal database sharding implemented by model sharding?

2010-07-20 Thread Andy
What is the best way to implement horizontal database sharding through Django? For example, say I have a class Note. I want to shard the database table Note into N shards based on the Note author's id - author.id % N 1) Should I shard the class Note into N corresponding classes - Note0, Note1, No

Re: Since recently: django_session error

2010-07-20 Thread commonzenpython
i know this might sound kinda dumb, but have you tried syncing the database ? just in case -- 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...@googlegroups.com. To unsubscribe from this group, send e

Re: Since recently: django_session error

2010-07-20 Thread PieterB
Yes, I tried a lot of things :-) On Jul 20, 9:52 am, commonzenpython wrote: > i know this might sound kinda dumb, but have you tried syncing the > database ? just in case -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

Re: forms

2010-07-20 Thread Kenneth Gonsalves
On Tuesday 20 July 2010 12:17:23 commonzenpython wrote: > hey guys, im trying to make a volunteer form which has several fields, > like name, address, and other types of information about the > volunteer, and i was wondering how i can make a form that saves the > user input in the database (MySQL)

Re: GAE + Django Authentication

2010-07-20 Thread Nuno Maltez
Hi, Have you tried django-nonrel? - http://www.allbuttonspressed.com/projects/django-nonrel On Tue, Jul 20, 2010 at 6:59 AM, Venkatraman S wrote: > Hi, > > Has anyone made inroads into django auth in GAE? I have been Googling around > for sometime and havent found a credible link on this. > Hel

Re: Is Django right for what I am trying to do

2010-07-20 Thread derek
On Jul 19, 1:19 am, Martin Tiršel wrote: > On Fri, 09 Jul 2010 16:50:14 +0200, derek wrote: > > More complex or more detailed?  (I would argue that The Django Book is > > about as high quality as you are ever going to get for a free > > tutorial) > > > Try:http://www.hoboes.com/NetLife/pytown

Re: create table

2010-07-20 Thread Franklin Einspruch
cowboy, I think you're looking for this: http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey Franklin 2010/7/20 Ian Lewis : > Hi, > > On Tue, Jul 20, 2010 at 11:42 AM, pengbo xue wrote: >> how can I create tables and foreignkey as below information. >> >> create a user object "m

Re: create table

2010-07-20 Thread pengbo xue
thanks for your help. 2010/7/20 Franklin Einspruch > cowboy, > > I think you're looking for this: > > http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey > > Franklin > > 2010/7/20 Ian Lewis : > > Hi, > > > > On Tue, Jul 20, 2010 at 11:42 AM, pengbo xue > wrote: > >> how can I c

Not reflecting MEDIA_URL value

2010-07-20 Thread barun
Hi, I've a project photo and an application gallery. I want to do a very simple thing: When the URL http://localhost:8000/gallery/ is accessed, a page will be displayed containing a single image. I've set the necessary variables and mapped the URLs. The problem is, in the base.html template (wher

Re: Not reflecting MEDIA_URL value

2010-07-20 Thread David De La Harpe Golden
On 20/07/10 12:11, barun wrote: > > [gallery/views.py] > def index(request): > return render_to_response('base.html', {}) > You have to pass through a RequestContext() for the template context processor that injects MEDIA_URL ('django.core.context_processors.media') into to the template

[Solved] Re: Not reflecting MEDIA_URL value

2010-07-20 Thread barun
Hurray! I had missed this small thing and banging my head for the last few hours! Thanks a lot to you! On Jul 20, 4:18 pm, David De La Harpe Golden wrote: > On 20/07/10 12:11, barun wrote: > > > > > [gallery/views.py] > > def index(request): > >         return render_to_response('base.html', {})

Re: Multiple URLs, Common View

2010-07-20 Thread joconnell
Hi, If you use something like r'^(?P.+)/$' then a variable called page will get passed to your view. It will contain the string that has been matched against the specified pattern (in this case any character 1 or more times (.+)) I think django uses standard python regular expressions in its ur

Re: Is Django right for what I am trying to do

2010-07-20 Thread drygal
I think I was in a similar position not so long ago. It all makes more sense if you get familiar with all functionalities used by or similar to those used by Django. I have played with other template frameworks, sqlalchemy and mod_wsgi, I was aslo writing own classes for handling forms etc. separat

Accessing the current user's first name

2010-07-20 Thread reduxdj
HI, So I tried for an hour or so to access the current user's first name, so I can send out a personalized invitation email. That reads, "Hi Sam, Your friend Charlie wants you to sign up here..." I understand how to access the user info from context, but how do I do it from inside one of my model

DecimalField, how to accept $ character

2010-07-20 Thread reduxdj
Hi, Users on my site can't type dollar signs without a form error showing. I'd rather allow them to type a dollar sign then clean it away after the fact? Can i see an example for this procedure please. Thanks, Patrick -- You received this message because you are subscribed to the Google Groups

Localflavor and "dynamic" forms

2010-07-20 Thread AK
I've been investigating the localflavor mod and I'm wondering how to apply it to my situation, or at least learn *if* it can be applied. A simplified example would be I need a user to enter an address. The user could be from any number of countries so I want the form to to able to validate, say,

Re: Accessing the current user's first name

2010-07-20 Thread Bill Freeman
You don't say what model this is. Since it doesn't exactly match django.contrib.auth.models, I'm going to guess that you may not be aware that the User model includes first_name, last_name, and email fields of its own. Having duplicated those fields, are you perhaps becoming confused about where

Re: DecimalField, how to accept $ character

2010-07-20 Thread Javier Guerra Giraldez
On Tue, Jul 20, 2010 at 9:10 AM, reduxdj wrote: > Users on my site can't type dollar signs without a form error showing. > I'd rather allow them > to type a dollar sign then clean it away after the fact? Can i see an > example for this procedure please. just put the $ sign on the field's label, t

Re: DecimalField, how to accept $ character

2010-07-20 Thread Bill Freeman
Example, no, but you could create a custom field, based on the DecimalField, which a custom validator that checks for and removes a leading dollar sign. I think that django snippets has a good chance of having examples of "currency" fields, and if not, Satchmo has one. Perhaps they do the dollar s

Re: DecimalField, how to accept $ character

2010-07-20 Thread Franklin Einspruch
Or change it to a CharField and do the string-to-decimal conversion yourself. Javier's solution is better, though. Franklin On Tue, Jul 20, 2010 at 10:33 AM, Javier Guerra Giraldez wrote: > On Tue, Jul 20, 2010 at 9:10 AM, reduxdj wrote: >> Users on my site can't type dollar signs without a for

Re: New tutorial added to Django by Example

2010-07-20 Thread Rainy
On Jul 19, 2:33 pm, Venkatraman S wrote: > On Mon, Jul 19, 2010 at 11:46 PM, Rainy wrote: > > > >    http://LightBird.net/dbe/ > > > > You rock ;) > > > A small nit : make the site more search-friendly. Probably, add a few > > > keywords/description etc? > > > Thanks! Do you mean, to every page

Problem with management command

2010-07-20 Thread bax...@gretschpages.com
I'm trying to write a script that I can run from the command line, as cron, or as a management command. Command line works fine. Management command does not. I get an "unknown command" error. Any ideas what I'm doing wrong here: http://dpaste.com/hold/220122/ -- You received this message because

Re: Problem with management command

2010-07-20 Thread Franklin Einspruch
I can't help but notice that you have import_stuffi() in the cron version and import_stuff() in the class. Might that be the problem? Franklin On Tue, Jul 20, 2010 at 11:23 AM, bax...@gretschpages.com wrote: > I'm trying to write a script that I can run from the command line, as > cron, or as a

Re: Accessing the current user's first name

2010-07-20 Thread reduxdj
OK, from my example, the model is called Roommate, so I am not duplicating any User model data there... So all of the information in that model has nothing to do the main user's email or other properties. Thanks for helping, I still don't have an answer from the above. How do I access the current

Re: Problem with management command

2010-07-20 Thread bax...@gretschpages.com
On Jul 20, 10:30 am, Franklin Einspruch wrote: > I can't help but notice that you have  import_stuffi() in the cron > version and import_stuff() in the class. Might that be the problem? > Nope, just a typo. That's not it. -- You received this message because you are subscribed to the Google G

Re: Accessing the current user's first name

2010-07-20 Thread Nuno Maltez
Hi, If user is a FK to the User model, then simply self.user.first_name should work. http://www.djangoproject.com/documentation/models/many_to_one/ Have you set the user property on the object you're trying to save? What error do you get? Btw what exactly are you trying to achieve with this lin

Re: Which Python are people using on OSX?

2010-07-20 Thread shacker
I had to set up Django + MySQL + PiL environments on two machines - one brand new and the other being upgraded from Leopard. The upgrade machine was a big hassle - all the old MacPorts and other libs in all the non-standard locations get in the way and create hidden problems, but everything went

Re: New tutorial added to Django by Example

2010-07-20 Thread Mitch
For SEO, your title tags matter greatly, as do the tags, page content and link text into and within the pages, probably in that order. If I were you, I'd make sure each page's and tag had "Django tutorial" in it. For example, on the "Todo List App" page I'd change the title to something like "Dj

Form for sending emails

2010-07-20 Thread markus
Hi I'm very new to Django but am already very impressed. For an administrative application I want to make, I stumbled over a simple problem and I'm not sure how to solve it. I'm aware that it is a pretty novice question, but still I'm stuck. So, any suggestions would be great! I want to make a fo

Re: permalink problem

2010-07-20 Thread Nuno Maltez
Maybe you can get a better description / traceback of the error from the shell. Something like python manage.py shell >> from myapp.models import Post >> p = Post.objects.all()[0] >> p.get_absolute_url() hth, Nuno On Tue, Jul 20, 2010 at 4:46 AM, vcarney wrote: > I'm having a problem getting a

Re: New tutorial added to Django by Example

2010-07-20 Thread Rainy
On Jul 20, 12:09 pm, Mitch wrote: > For SEO, your title tags matter greatly, as do the tags, page > content and link text into and within the pages, probably in that > order. If I were you, I'd make sure each page's and tag > had "Django tutorial" in it. For example, on the "Todo List App" pa

Re: forms

2010-07-20 Thread commonzenpython
VolunteerForm is the name of my form class in forms.py, i put the code you gave me : if request.POST: form = VolunteerForm(request.POST) if form.is_valid(): fm = form.save() in my views.py when i visit the url, i get the form , but when i submit information, i get a 5

Re: Accessing the current user's first name

2010-07-20 Thread Michael Schade
Are you saying that the "user" entry in the Roommate model is not the user of the roommate that is described by first_name, last_name, etc. below, but that of the person's other roommate? You may not be duplicating the *data* itself (that is, user.first_name is different from your first_name entry

Re: forms

2010-07-20 Thread backdoc
I'm just learning Django myself. But, it sounds like you didn't inherit from Form.forms (or is it Forms.form??). On Tue, Jul 20, 2010 at 1:14 PM, commonzenpython wrote: > VolunteerForm is the name of my form class in forms.py, i put the code > you gave me : > > if request.POST: >form = V

Re: forms

2010-07-20 Thread Scott Gould
First things first: 1. Do you have a Model for your data? 2. Is your form a ModelForm attached to this Model? On Jul 20, 2:14 pm, commonzenpython wrote: > VolunteerForm is the name of my form class in forms.py, i put the code > you gave me : > > if request.POST: >         form = VolunteerForm(re

Re: URL to specify when accessing subdomains using Django

2010-07-20 Thread jaymzcd
Have you been through everything here: http://docs.djangoproject.com/en/dev/ref/contrib/sites/ ? It goes through the whole process of working with the sites framework, its even encouraged to be used when running just a single site. It sounds like you are making it more complicated that needs be. I

Re: Accessing the current user's first name

2010-07-20 Thread Bill Freeman
On Tue, Jul 20, 2010 at 11:38 AM, reduxdj wrote: > OK, from my example, the model is called Roommate, so I am not > duplicating any User model data there... So all of the information > in that model has nothing to do the main user's email or other > properties. > > Thanks for helping, I still don'

Re: import model from other module

2010-07-20 Thread Andreas Pfrengle
I've tried it with and without installing in settings.INSTALLED_APPS, didn't work, table wasn't created vis syncdb. > This might be the info you're > missing:http://docs.djangoproject.com/en/dev/ref/models/options/#app-label This seems to work, however, since I want to use my external modules for

Re: import model from other module

2010-07-20 Thread Andreas Pfrengle
I've tried it with and without installing in settings.INSTALLED_APPS, didn't work, table wasn't created vis syncdb. > This might be the info you're > missing:http://docs.djangoproject.com/en/dev/ref/models/options/#app-label This seems to work, however, since I want to use my external modules for

Re: forms

2010-07-20 Thread commonzenpython
yes, i did inherit from forms.Form , but no, i dont have a model for my data , i only have a class in forms.py that displays three charfields for the user, and i use it throuh my views.py like this : from django.shortcuts import render_to_response from ash.forms import VolunteerForm from django.ht

Template tag does not like parameters with filters ({% with foo as bar %} question)

2010-07-20 Thread Micky Hulse
Hello, I am using this Djangosnippet: == {% with my_date|date:"Y" as year %} ... {% with my_date|date:"m" as month %} ... {% get_calendar for month year as calendar %} ... ... == The above works, but when I try this: == {% g

Inline forms

2010-07-20 Thread Ramesh
Hi, I would like to have inline forms for my project (not admin site) as shown in django tutorials "Writing your first Django app, part 2", http://docs.djangoproject.com/en/dev/intro/tutorial02/ Here is the form image url: http://docs.djangoproject.com/en/dev/_images/admin12.png This works fine

ManyToMany incompatibility between Django 1.1 and 1.2?

2010-07-20 Thread Yngve Nysaeter Pettersen
Hello all, By accident I have ended up with a mixed Django 1.1.1 and Django 1.2.1 environment, on different machines. I am currently considering whether to downgrade the 1.2 installations, or upgrade the older ones, or keep the current setup, but this depends on finding a solution to an a

Re: Accessing the current user's first name

2010-07-20 Thread reduxdj
I'll try storing my current user's data to the session. By the way, is this a limitation or part of the django security model? On Jul 20, 2:55 pm, Bill Freeman wrote: > On Tue, Jul 20, 2010 at 11:38 AM,reduxdj wrote: > > OK, from my example, the model is called Roommate, so I am not > > duplicat

Problem validating two forms in a view

2010-07-20 Thread Renne Rocha
 Hello all,  I want to create a page that the user will be able to include one 'Project', and several 'Ports' (related to this project). But I am having problems saving the Ports form, because the project_id isn't in the form yet.  I have the following models: class Project(models.Model):    nam

Re: GAE + Django Authentication

2010-07-20 Thread Simon Holness
2nd Vote for Nonrel http://www.allbuttonspressed.com/projects/django-nonrel If you'd prefer not to use that, there's also Google's App Engine Helper for Django - http://code.google.com/p/google-app-engine-django/ http://code.google.com/appengine/articles/appengine_helper_for_django.html But unlik

custom tag and filtered value

2010-07-20 Thread owidjaya
how can i pass a filtered value to a custom tag? ie if i do this {% somecustomtag template_variable|lower %} -- 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...@googlegroups.com. To unsubscribe fr

Re: Accessing the current user's first name

2010-07-20 Thread Bill Freeman
I'm not sure that we are understanding one another. In an earlier post you mentioned the phrase "current user". I interpreted that to be the user which had "logged in" to the site, using django.contrib.auth (such as to be able to use the admin, though certainly not all such users need be given ad

Re: custom tag and filtered value

2010-07-20 Thread mhulse
On Jul 20, 2:57 pm, owidjaya wrote: > how can i pass a filtered value to a custom tag? +1 from me. I just asked a similar question here: "Template tag does not like parameters with filters ({% with foo as bar %} question)" I was not sure what to Google for, that is

data import and auto-incrementing id columns

2010-07-20 Thread Mike Dewhirst
The data I want to import is in Paradox tables and that can be easily exported in any format. However, I believe the id columns in Paradox are gunna have to be used to re-establish relationships (1:n and n:m) in PostgreSQL. How is this going to work when django models specify auto-incrementin

Possible to create models programatically?

2010-07-20 Thread Andy
I have N models that are identical except the model names (i.e. they all have the same attributes, methods): MyModel0, MyModel1, MyModel2, ... Normally I'd need to type out the model definitions for those N models by hand inside models.py. Is there a way to generate the N model definitions progr

Send email attachment from memory buffer

2010-07-20 Thread Michael Hipp
I will be sending pdfs generated from django and would like to email them but without writing them to the filesystem. I can generate the pdf to a buffer but django.core.mail seems to only handle attachments that are specified as a filename. Is it possible to give it a file-like object instead?

Re: Possible to create models programatically?

2010-07-20 Thread Doug
I have a similar issue, with a bunch of very similar apps that I need in separate tables that all have the same base structure. I keep the common models in a file called models_base.py and then use execfile in the models.py file for each app. It's basically like a php or c include in that in 'ins

best practice for widget that edits multiple model fields

2010-07-20 Thread Brad Buran
I have a group of fields (date_start, date_end, all_day) that I would like to reuse in several models. I've defined a MultiWidget that displays two split datetime fields plus a checkbox (for the all_day toggle). However, I'm not sure how to get the MultiWidget to set the value of these three fiel

Re: ManyToMany incompatibility between Django 1.1 and 1.2?

2010-07-20 Thread Russell Keith-Magee
Hi Yngve -- I just wanted to let you know that your report has been heard -- I just haven't got a lot of spare cycles at the moment to dig into this problem. Hopefully that situation will improve in the near future. Here's some quick and (possibly) helpful explanatory notes: Django 1.2 started i

Re: Problem validating two forms in a view

2010-07-20 Thread Ivan
http://charlesleifer.com/blog/djangos-inlineformsetfactory-and-you/ might be the one you're looking for. Cheers, Ivan On Wed, Jul 21, 2010 at 7:30 AM, Renne Rocha wrote: >  Hello all, > >  I want to create a page that the user will be able to include one > 'Project', and several 'Ports' (relat