Template Inheritance - best solution

2009-08-28 Thread eeyore
I am working on an app that currently has two main base templates. What I would like to do is to avoid having multiple base templates and having duplicated code withing my templates. For example I might have navigation include in the base template, but on the login screen there is no

Error binding parameter 1 - probably unsupported type.Request Method: POST

2009-08-28 Thread riven
Error binding parameter 1 - probably unsupported type.Request Method: POST Request URL: http://127.0.0.1:8000/save/ Exception Type: InterfaceError Exception Value: Error binding parameter 1 - probably unsupported type. Exception Location: d:\Python26\lib\site-packages\django\db\backends

Re: SOAPLIB issue with django upgrade

2009-08-28 Thread Wombatpm
For the record. SOAPLIB 0.8.1 has a bug in generating the WSDL file for Arrays. > > - > > name="string"/> > > the type declaration should be type="xs:string" The unicode issue is being raised by lxml inside of soaplib. Calls from .NET clients include an xml declaration and an encoding

Re: how to set field value of a form object before render it?

2009-08-28 Thread Karen Tracey
On Fri, Aug 28, 2009 at 10:35 PM, hao he wrote: > hi. > > this following code show what I want to do,but 'red' line is incorrect, > > if request.method == "POST": > form = MyForm(request.POST) > c = form.data["a"] + form.data["b"] > form.data["c"] = c >

Re: create a link from an object - template tag or?

2009-08-28 Thread Karen Tracey
On Fri, Aug 28, 2009 at 10:34 PM, MIL wrote: > > Hi :o) > > I am attempting to create a simpler way to create my links. and I > developed this template tag: > > > class LinkNode(Node): >def __init__(self, object): >self.object = object > >def

how to set field value of a form object before render it?

2009-08-28 Thread hao he
hi. this following code show what I want to do,but 'red' line is incorrect, if request.method == "POST": form = MyForm(request.POST) c = form.data["a"] + form.data["b"] form.data["c"] = c return render_to_response(template_name , {"form": form}) how to modify it?

create a link from an object - template tag or?

2009-08-28 Thread MIL
Hi :o) I am attempting to create a simpler way to create my links. and I developed this template tag: class LinkNode(Node): def __init__(self, object): self.object = object def render(self, context): model_name = self.object.get_model_name()

Re: archive_week argument error

2009-08-28 Thread Karen Tracey
On Fri, Aug 28, 2009 at 8:13 PM, Eric Montgomery wrote: > > I'm experiencing a really odd problem with the archive_week generic > view. > > I am trying to call it like I do a bunch of other generic views > throughout my app, but archive_week seem to not like the arguments I'm

Re: Temporary session directory

2009-08-28 Thread Russell Keith-Magee
On Sat, Aug 29, 2009 at 1:13 AM, John Barham wrote: > > I'd like to store per-session files so need a way to reliably create a > per-session temp directory.  Is it reasonable to use the > session.session_key to generate a unique name? It's a reasonable candidate. It's unique

subprocess.Popen in django production - are file descriptors closed?

2009-08-28 Thread aaron smith
Hey All, quick question. I have a small snippet of code that runs a ruby script, which I read the stdout when it's done. But, I'm not getting the stdout when it's in django production. Here's my python snippet: def generate_license(paymentForm,dsaPrivFile): name =

Serve dynamic info pages in the admin tool

2009-08-28 Thread Wim De Houwer
Hi All, I'm new to this list and maybe i'm asking a question which might have passed here already, but i couldn't find a answer on the archives. I have a Model which holds a list of people : This is the most important info out of that model: class Members(models.Model): MemberId =

MultiWidget Help

2009-08-28 Thread Rob Broadhead
I have a MultiWidget class shown below that combines a selec and textfield widget. I want to return only the value of the textinput though. I have done a lot of Googling and have the compress-decompress methods competely confused in my head so my question is "How does one create a multiwidget and

archive_week argument error

2009-08-28 Thread Eric Montgomery
I'm experiencing a really odd problem with the archive_week generic view. I am trying to call it like I do a bunch of other generic views throughout my app, but archive_week seem to not like the arguments I'm giving it. Here is my code: return archive_week(request, year

Re: Session problem?

2009-08-28 Thread David
Hi Angel, Thanks so much for your prompt reply. Appreciated. Reading your script, I can see that you use my_id=request.user.id. In my code I used username = request.user.username. (notice my commented code? I just tested request.user.id. The problem exists.) So there is no major difference as

Re: Session problem?

2009-08-28 Thread Angel Cruz
Your implementation is dependent upon session cookies, and I am sure you have a good reason for it. I am as stomped as you are why that is (unless you are like me, who confuses 127.0.0.1:8080 w/ localhost as I open multiple browsers in testing my site...each will have different session cookies).

Remove leading and trailing whitespaces in TinyMCE text area.

2009-08-28 Thread Sonal Breed
Hi all, I have a textfield which I am rendering as a TinyMCE widget. So the value entered in this text field is passed in html format to the server. I want to trim leading and trailing whitespaces from the value. Since the value sent back is always in following format: some value , even though

Re: Custom User Model and the Django Admin Site

2009-08-28 Thread Karen Tracey
On Fri, Aug 28, 2009 at 10:20 AM, Bryan wrote: > > So, my "solution" was to duplicate this logic in my admin class, and > it works just fine now. Anyone have any better ideas? Base your admin class on the UserAdmin class. Inherit whatever you need from it and override

Re: QuerySet without result_cache?

2009-08-28 Thread Sam Tregar
On Thu, Aug 27, 2009 at 8:18 PM, Alex Gaynor wrote: > > On Thu, Aug 27, 2009 at 5:56 PM, Sam Tregar wrote: > > On Thu, Aug 27, 2009 at 5:47 PM, Alex Gaynor > wrote: > >> > >> Instead of iterating over the QuerySet itself, use > >>

Re: Many-to-many column admin interface

2009-08-28 Thread Sven Richter
Yea, i thought about that, but for me this seems like an ugly workaround. Dont misunderstand me, i dont know enough about django and its database internals, but why should i use a third model for something i can access directly? The solution i posted above was exactly what i was looking for and

Re: some teory help (sorry i couldnt find title for that question)

2009-08-28 Thread Chris Babcock
On Fri, 28 Aug 2009 18:03:15 +0300 Mirat Bayrak wrote: > Hi, i am trying to build a site thats like twitter (but not same). > Users can delete or edit their entries in my site but i coulndt find > how can i show options. > > I want to list entries and if an entry is

Re: Session problem?

2009-08-28 Thread David
Hi Angel, Thanks for your reply. I just tested with decorator @login_required. The problem still exists. Following is script for my homepage. # this is the homepage @login_required def my_view(request): if request.session.test_cookie_worked(): #username = request.user.username

Re: Model-level data integrity constraints?

2009-08-28 Thread William
On Aug 20, 9:06 pm, Russell Keith-Magee wrote: > You've pretty much captured the current situation as well as the ways > that you can respond. > > Yes, the current situation is less than ideal, and yes, this is a > feature we want to add - hopefully it will be in v1.2.

Re: Session problem?

2009-08-28 Thread Angel Cruz
How does your view.py look like? I use the decorator @login_required right before each def that I want to ensure is viewable only to the logged-in user. On Fri, Aug 28, 2009 at 12:00 PM, David wrote: > > hello Django community, > > I met this problem and can not find a

Re: Single sign-in

2009-08-28 Thread Chris McCormick
Hi All, My workmate just pointed out that somebody has now done this. Hooray! Chris. On Tue, May 05, 2009 at 05:15:16PM +0100, Chris McCormick wrote: > > Hi All, > > I am sensing a need for a library which allows for a user to sign

Re: Many-to-many column admin interface

2009-08-28 Thread Sven Richter
But i wonder how this would help me further. In the End it doesnt matter for me on which model i define the M2M relation. But i need to access the M2M Table from both models, at least in the view or in the template if not in the admin interface. I am having a hard time finding out how to achieve

Session problem?

2009-08-28 Thread David
hello Django community, I met this problem and can not find a solution. I wonder if any people has met this problem before? Can anybody give a clue or hint how to fix it? For my project, I have enabled sessions and I use contrib.auth.models.User. If one user logins into his/her account, all is

Re: Initial value in admin form based on url parameter

2009-08-28 Thread bhomnick
Actually figured it out by looking at the modeladmin source. If you have, for instance, an object called Payment with a foreign key User, you can just go the url payment/add?user= and the user select field will default to that user. On Aug 28, 11:04 am, bhomnick wrote: > I

Re: some teory help (sorry i couldnt find title for that question)

2009-08-28 Thread Masood Ahmed
On Aug 28, 8:03 pm, Mirat Bayrak wrote: > Hi, i am trying to build a site thats like twitter (but not same). Users can > delete or edit their entries in my site but i coulndt find how can i show > options. > > I want to list entries and if an entry is users (logged user

Re: Many-to-many column admin interface

2009-08-28 Thread Sven Richter
Ah, and google does help or at least django_snippets. I found the solution here: http://www.djangosnippets.org/snippets/1295 The trick is to create a column in both models and in one with the option to not syncdb. Its really simple, just 6 lines at all. Greetings and a nice Weekend Sven On

Re: some teory help (sorry i couldnt find title for that question)

2009-08-28 Thread Masklinn
On 28 Aug 2009, at 17:03 , Mirat Bayrak wrote: > Hi, i am trying to build a site thats like twitter (but not same). > Users can > delete or edit their entries in my site but i coulndt find how can i > show > options. > > I want to list entries and if an entry is users (logged user i mean) >

some teory help (sorry i couldnt find title for that question)

2009-08-28 Thread Mirat Bayrak
Hi, i am trying to build a site thats like twitter (but not same). Users can delete or edit their entries in my site but i coulndt find how can i show options. I want to list entries and if an entry is users (logged user i mean) i want to show edit end delete options. How can i do that?

Re: Many-to-many column admin interface

2009-08-28 Thread patrickk
I could be mistaken ... but why not using a third model. C(models.model): a = models.ForeignKey('A') b = models.ForeignKey('B') when editing either A or B, you could use C as inlines. regards, patrick On 28 Aug., 17:18, Sven Richter wrote: > But i wonder how

Re: 500 error when DEBUG = False but not True

2009-08-28 Thread Tracy Reed
On Fri, Aug 28, 2009 at 08:51:46AM -0400, Karen Tracey spake thusly: > Yes, unless you are running an SMTP server on the same machine you need to > set EMAIL_HOST to point to one, and set whatever other EMAIL_ settings are > required to use the server you point to: Finally, I have some debugging

Temporary session directory

2009-08-28 Thread John Barham
I'd like to store per-session files so need a way to reliably create a per-session temp directory. Is it reasonable to use the session.session_key to generate a unique name? Also, is there a way to have Django automatically run some code to cleanup my session once it has expired? Or do I have

Custom User Model and the Django Admin Site

2009-08-28 Thread Bryan
Hi All, Just a quick query to see if anyone has any ideas on this one. I have a model in my application that inherits from the django User model. In the admin site, without any extra configuration (just using ModelAdmin), I get a standard edit form with the custom model's fields as well as the

Initial value in admin form based on url parameter

2009-08-28 Thread bhomnick
I have a model with a foreign key where I want the select box on the admin add form to default to whatever id is passed in a url parameter. Any ideas how to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: how to get LANGUAGE_CODE variable in flatpage's template

2009-08-28 Thread victor
No one suffered? On 8月28日, 下午1时20分, victor wrote: > i need get LANGUAGE_CODE variable in flatpage's template,but only got > it under Debug status. > when set debug=False,any request to flatpage will got 500 error: > VariableDoesNotExist: Failed lookup for key [LANGUAGE_CODE] in

Re: invalid template tag

2009-08-28 Thread nixon66
Anyone have any suggestions on this. I've tried all recommendations and still getting same Template errors On Aug 27, 7:17 pm, nixon66 wrote: > Still getting the same errors. > > On Aug 27, 7:10 pm, Javier Guerra wrote: > > > On Thu, Aug 27, 2009 at

Re: Execute code after sending a http response?

2009-08-28 Thread Alex Robbins
You'll have to set something in a table and run a cron to send it later. Django-mailer [1] has all of this set up for, along with some other cool features. I've used it in a project before and been happy with it. [1] http://code.google.com/p/django-mailer/ On Aug 28, 1:10 am, Shadow

Re: TemplateSyntaxError at /admin/ Caught an exception while rendering: (1146, "Table 'winzees.django_admin_log' doesn't exist")

2009-08-28 Thread Karen Tracey
On Aug 28, 7:57 am, "s.molinari" wrote: > Hiya! > I tried to access the django admin page and I got that error. How do i > fix it? I am stuck... > I am new at using django as well... just to let you know ;) > > [snip] > Exception Type: TemplateSyntaxError at /admin/

Re: Help with the url template tags

2009-08-28 Thread Fil
For the sake of completeness and in case someone with less regex-fu that Karen, here is the correct urlpatterns: urlpatterns = patterns('', url(r'^$', date_based.archive_index, entry_info_dict,

Admin inlines onetoone related object not saved

2009-08-28 Thread Jean Stebens
Hi there, I have the following models: class A(models.Model): id = models.AutoField(primary_key=True) class B(models.Model): mya = models.OneToOneField(A, primary_key=True) text = models.TextField(default='Init') In admin interface, I have used an inline to include B when

Re: '%d-%m-%Y' format for DateTimefield in django

2009-08-28 Thread Karen Tracey
On Aug 28, 3:19 am, Jigar wrote: > Hi All, > > I am trying to add the '%d-%m-%Y' format in DateTimefield. As django > does not support this format so when I add different date formats, it > gives "invalid date/time" error in django console.This error occurs > because the

Re: show user and date in change_list

2009-08-28 Thread Sandra Django
Thank's Alex, but it don't seem the problem, because I tested with another method name "author" and "pub_date", and returns (None) too. Why? On Thu, Aug 27, 2009 at 5:03 PM, Alex Gaynor wrote: > > On Thu, Aug 27, 2009 at 12:18 PM, Sandra Django >

Re: Django scalability with files

2009-08-28 Thread James Bennett
On Thu, Aug 27, 2009 at 2:22 PM, Rafael Ferreira wrote: > The queue idea is a good one, and you can use Gearman to do that really > easily. Another, even simpler, way to handle this is to use some kind of > shared NFS mount for the storage. All things being equal, scaling a filer

Re: Help with the url template tags

2009-08-28 Thread Fil
I knew it was stupid ! Working now, of course. Thx a lot Karen. On Aug 28, 2:44 pm, Karen Tracey wrote: > On Fri, Aug 28, 2009 at 4:34 AM, Phil wrote: > > > Guys, > > > I have this error in my template when rendering my view: "Caught an > > exception

Re: Many-to-many column admin interface

2009-08-28 Thread Sven Richter
I've opened a bug/feature request at: http://code.djangoproject.com/ticket/11795#comment:2 if someone is interested. Greetings Sven On Fri, Aug 28, 2009 at 6:59 AM, Craig McClanahan wrote: > > On Thu, Aug 27, 2009 at 10:00 AM, Sven Richter > wrote: >

Re: 500 error when DEBUG = False but not True

2009-08-28 Thread Karen Tracey
On Fri, Aug 28, 2009 at 7:01 AM, Tracy Reed wrote: > Do I > have to give django an smtp server address or anything else to enable > it to report errors and tracebacks somewhere? > Yes, unless you are running an SMTP server on the same machine you need to set EMAIL_HOST to

'%d-%m-%Y' format for DateTimefield in django

2009-08-28 Thread Jigar
Hi All, I am trying to add the '%d-%m-%Y' format in DateTimefield. As django does not support this format so when I add different date formats, it gives "invalid date/time" error in django console.This error occurs because the form is not valid(form.is_valid()) as above mentioned date format is

TemplateSyntaxError at /admin/ Caught an exception while rendering: (1146, "Table 'winzees.django_admin_log' doesn't exist")

2009-08-28 Thread s.molinari
Hiya! I tried to access the django admin page and I got that error. How do i fix it? I am stuck... I am new at using django as well... just to let you know ;) Environment: Request Method: GET Request URL: http://127.0.0.1:8000/admin/ Django Version: 1.1 Python Version: 2.6.2 Installed

Re: ugettext() and ugettext_lazy() - error and difference

2009-08-28 Thread Karen Tracey
On Fri, Aug 28, 2009 at 2:49 AM, Léon Dignòn wrote: > > Hi, > > I don't exactly understand the difference between ugettext() and > ugettext_lazy(). I read the documentation and I've read that > ugettext_lazy translates a string on access. Sounds more efficient. > But why

Re: Help with the url template tags

2009-08-28 Thread Karen Tracey
On Fri, Aug 28, 2009 at 4:34 AM, Phil wrote: > > Guys, > > I have this error in my template when rendering my view: "Caught an > exception while rendering: Reverse for 'entry_archive_month' with > arguments '()' and keyword arguments '{'month': 8, 'year': 2009}' not >

Re: Execute code after sending a http response?

2009-08-28 Thread Daniel Roseman
On Aug 28, 10:00 am, Jarek Zgoda wrote: > Wiadomość napisana w dniu 2009-08-28, o godz. 08:10, przez Shadow: > > > Is it possible to execute code after sending the actual http response? > > > For my website, users can optionally give an email address, and if > > they do,

Re: print PDF on windows

2009-08-28 Thread Sam Lai
2009/8/27 mettwoch : > > Apache is running under a system account. A quick test of running > Apache under my user account enabled printing indeed. I'll follow your > suggestion and create a dedicated user with restricted rights to run > Apache under. I'd leave Apache running

Re: Model Theory 101 - Video Sharing App

2009-08-28 Thread thornomad
Hi thanks for the response - I had looked at oembed, but it didn't seem like it would grab the title, description, play count, etc ... which was the information I was going for. There is also a markdown plugin, that seems to work similiar. If I went the route of just posting video (which I may,

Re: 500 error when DEBUG = False but not True

2009-08-28 Thread Tracy Reed
On Fri, Aug 28, 2009 at 11:21:07AM +0200, Daniel Hepper spake thusly: > The stacktrace shows that the 500.html template is missing [1], so go > ahead and create one. You should also make sure that you have > configured the admin email address and settings for sending mail > correctly, so Django

Re: Django test suite does not discover test method "test_string_regex"

2009-08-28 Thread Gregor Müllegger
I discovered that it gets not execute by looking at the coverage statistics. But you're totally right. I had a second method that is called the same. Very embarrassing for me. Sorry. Gregor 2009/8/28 Karen Tracey : > On Thu, Aug 27, 2009 at 2:21 PM, Gregor Müllegger

Re: 500 error when DEBUG = False but not True

2009-08-28 Thread Daniel Hepper
The stacktrace shows that the 500.html template is missing [1], so go ahead and create one. You should also make sure that you have configured the admin email address and settings for sending mail correctly, so Django can send you a traceback by mail when DEBUG = False Cheers, Daniel [1]

Re: Generating slugs

2009-08-28 Thread esatterwh...@wi.rr.com
You might look in to the Autoslug field in django command extensions http://code.google.com/p/django-command-extensions/ the autoslug field is never displayed on a form, but you specify which fields from which to create the slug from. so you can do it how ever you want. I've found it very

Re: 500 error when DEBUG = False but not True

2009-08-28 Thread Jarek Zgoda
Wiadomość napisana w dniu 2009-08-28, o godz. 10:07, przez Tracy Reed: > I appear to have a bit of a heisenbug. When I have debug = True > everything works perfectly. When I have debug = False I get a 500 > error when accessing two views in particular. I'm not sure what makes > those views

Re: Execute code after sending a http response?

2009-08-28 Thread Matthias Kestenholz
On Fri, Aug 28, 2009 at 8:10 AM, Shadow wrote: > > Hi, > > Is it possible to execute code after sending the actual http response? > > For my website, users can optionally give an email address, and if > they do, the site sends a confirmation email. But I was thinking

Help with the url template tags

2009-08-28 Thread Phil
Guys, I have this error in my template when rendering my view: "Caught an exception while rendering: Reverse for 'entry_archive_month' with arguments '()' and keyword arguments '{'month': 8, 'year': 2009}' not found." I've starred at my code for too long and I can't see where the problem lies.

Re: Generating slugs

2009-08-28 Thread Ruben Knol
That is excellent! thanks for pointing this out!! On Fri, Aug 28, 2009 at 11:04 AM, esatterwh...@wi.rr.com < esatterwh...@wi.rr.com> wrote: > > You might look in to the Autoslug field in django command extensions > http://code.google.com/p/django-command-extensions/ > > the autoslug field is

Re: Execute code after sending a http response?

2009-08-28 Thread Jarek Zgoda
Wiadomość napisana w dniu 2009-08-28, o godz. 08:10, przez Shadow: > Is it possible to execute code after sending the actual http response? > > For my website, users can optionally give an email address, and if > they do, the site sends a confirmation email. But I was thinking it's > more

Custom form validation request or user-based

2009-08-28 Thread Enrico Sartorello
Hi, i'm developing a Django application where i need to differentiate the validation of an admin-site model form between different users: some user must respect some particular restrictions (imposed via "clean_*" methods) while others should do what they want without them. The problem arises

Execute code after sending a http response?

2009-08-28 Thread Shadow
Hi, Is it possible to execute code after sending the actual http response? For my website, users can optionally give an email address, and if they do, the site sends a confirmation email. But I was thinking it's more logical to spend time sending the email after the signup confirmation page is

Help with admin inlines

2009-08-28 Thread Léon Dignòn
Hi, I tried to stack two models in the admin interface. Any ideas why I get this error? issubclass() arg 1 must be a class File "C:\Django\myproject\myapp\admin.py" in 22. admin.site.register(Manufacturer, ManufacturerAdmin) admin.py class

Re: Execute code after sending a http response?

2009-08-28 Thread Daniel Roseman
On Aug 28, 7:10 am, Shadow wrote: > Hi, > > Is it possible to execute code after sending the actual http response? > > For my website, users can optionally give an email address, and if > they do, the site sends a confirmation email. But I was thinking it's > more

500 error when DEBUG = False but not True

2009-08-28 Thread Tracy Reed
I appear to have a bit of a heisenbug. When I have debug = True everything works perfectly. When I have debug = False I get a 500 error when accessing two views in particular. I'm not sure what makes those views special or why the app would behave differently depending on whether debug is True or

Help admin edit

2009-08-28 Thread kawate
Suddenly I get admin index.html show 'You don't have permission to edit anything.'. I run this system several months without any problem with admin interface. I can't guess at least the cause of this change. Could anyone help me. Thank you in advance.

how to get LANGUAGE_CODE variable in flatpage's template

2009-08-28 Thread victor
i need get LANGUAGE_CODE variable in flatpage's template,but only got it under Debug status. when set debug=False,any request to flatpage will got 500 error: VariableDoesNotExist: Failed lookup for key [LANGUAGE_CODE] in u'[{}]' when set debug=True,all works. can anyone know how to get it in

Re: Many-to-many column admin interface

2009-08-28 Thread Craig McClanahan
On Thu, Aug 27, 2009 at 10:00 AM, Sven Richter wrote: > I found this thread: > http://stackoverflow.com/questions/660260/django-admin-form-for-many-to-many-relationship > on Stackoverflow, but when i try the suggested TabularInline thing i get the > error: > > has no

variable as a field name in a template?

2009-08-28 Thread Unnamed_Hero
Is it possible provide a variable for a field name in a template? A have a database with a corporations. I want to create some kind of a report generator. Users can choose necessary fields, specify some filters and get a result. I've created a form with checkboxes near field name, have created

Creating a custom widget

2009-08-28 Thread nbv4
I have a Flight model which has a foreignkey field that relates to a route object. I created a custom field to go with my FlightForm that allows me to enter a simple string, which is then, via the clean() method, constructed into a Route object that is attached to the flight. This works fine, but

Re: Admin search error (using auto complete FK widget)

2009-08-28 Thread mr.kschan
Hi, There is solution to use Jannis's widget with Django 1.1. Please read the blog post's comment by Christian Abbott June 24, 2009. The __call__ is deprecated in Django1.1 and you could better update the code to use get_urls() instead. =] I just tried and it works ^^ ks On Aug 28, 12:01 

ugettext() and ugettext_lazy() - error and difference

2009-08-28 Thread Léon Dignòn
Hi, I don't exactly understand the difference between ugettext() and ugettext_lazy(). I read the documentation and I've read that ugettext_lazy translates a string on access. Sounds more efficient. But why do I get this error on that code? from django.db import models from

Re: Admin search error (using auto complete FK widget)

2009-08-28 Thread mr.kschan
Hi, On Aug 26, 9:34 pm, maco wrote: > Jannis Liedel writes about a great widget for FK > fieldshttp://jannisleidel.com/2008/11/autocomplete-form-widget-foreignkey-m... > > I manged to get it to work on one site, but not on others. > > Widget uses admin search