Re: Newbie question: can foreign key fields used as search fields on admin page?

2010-08-25 Thread Dennis Kaarsemaker
On wo, 2010-08-25 at 21:49 -0700, Joe Z wrote: > Is it possible to add 'publisher' into search_fields so that in admin > page books showed can be narrow down by a specific publisher? I tried > it but got the following exception: Not as such, but you can add publisher__name (assuming publisher has

Re: uncomplete internationalization of 'auth' in admin panel

2010-07-29 Thread Dennis Kaarsemaker
On do, 2010-07-29 at 13:43 -0700, bagheera wrote: > Internationalization of 'auth' app in django 1.2 isn't complete. In > user edit form there are user permissions displayed in two windows, > like "auth | permission | Can add permission", etc. I want it all > fully localized, but i can't digg up ri

Re: django_session not in "default" DB

2010-07-29 Thread Dennis Kaarsemaker
On do, 2010-07-29 at 13:03 -0700, Jocelo wrote: > Hi, > > I have two DB configured on my django project... one in oracle and the > other one in MySQL... > My Oracle DB is the default one, and on MySQL I store data that is not > really related to my main application. > > I want to store session da

Re: through/unique_together usage

2010-07-29 Thread Dennis Kaarsemaker
On do, 2010-07-29 at 05:35 -0700, Dave wrote: > In my application I want to enforce a each-image-can-only-be-assigned- > to-a-single-patient So why do you use a ManyToManyField instead of a ForeignKey? -- Dennis K. They've gone to plaid! -- You received this message because you are subscribe

Re: MySQL error -1

2010-07-29 Thread Dennis Kaarsemaker
On wo, 2010-07-28 at 22:25 -0700, shacker wrote: > Well, I think I've got a culprit on this one. I was seeing occasional > "/tmp is out of space" messages from the server lately as well, That is more than likely as mysql will store temporary tables there and your error is one that can be seen if

Re: MySQL error -1

2010-07-28 Thread Dennis Kaarsemaker
On wo, 2010-07-28 at 00:18 -0700, shacker wrote: > On Jul 27, 2:49 pm, Dennis Kaarsemaker wrote: > > Are the tracebacks all the same? Can you share a traceback? > > Sure, here's one (search/replaced to make it generic): > > http://dpaste.com/222645/ > > It'

Re: django storage chinese failed to mysql!!

2010-07-28 Thread Dennis Kaarsemaker
| > | character_set_system | utf8 > | > | character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.1 > \share\chars > ets\ | > +------+---- > -+ > > > 2010/7/28 De

Re: django storage chinese failed to mysql!!

2010-07-27 Thread Dennis Kaarsemaker
On wo, 2010-07-28 at 09:11 +0800, pengbo xue wrote: > hi all, > > I can register from my django web page in english,but it can't storage > chinese to django mysql database. > > please give me advice. thx Check your table definition to see whether the field you try to store is a latin1 or utf8

Re: MySQL error -1

2010-07-27 Thread Dennis Kaarsemaker
On di, 2010-07-27 at 13:49 -0700, shacker wrote: > On Jul 27, 3:10 am, Dennis Kaarsemaker wrote: > > > > > Start with checking/repairing the table that causes this error to be > > thrown. > > All tables analyzed, optimized, and repaired. No errors found. But the &g

Re: MySQL error -1

2010-07-27 Thread Dennis Kaarsemaker
On di, 2010-07-27 at 00:14 -0700, shacker wrote: > One of my Django sites has been throwing occasional 500 errors, I > believe related to mysql: > > OperationalError: (1030, 'Got error -1 from storage engine') > > I'm never able to catch it in the act - I just see the 500 email > reports. This is

Re: errors serving text files using templates and static files

2010-07-27 Thread Dennis Kaarsemaker
pResponseRedirect('/netboot/dynamicmenu.cfg') > > It works but it's a strange workaround. Serving it directly causes > gPXE to break. Any thoughts? > > On Mon, Jul 26, 2010 at 18:04, Dennis Kaarsemaker > wrote: > On ma, 2010-07-26 at 09:21 -0700,

Re: errors serving text files using templates and static files

2010-07-26 Thread Dennis Kaarsemaker
On ma, 2010-07-26 at 09:21 -0700, Josh wrote: > return HttpResponse(menu, mimetype="plain/text") > > What makes Django's text serving different? What can I do to > troubleshoot this issue further? Am I just missing something about > how text files are served? The correct mimetype is tex

Re: DatabaseError: subquery has too many columns

2010-07-25 Thread Dennis Kaarsemaker
On zo, 2010-07-25 at 03:16 -0700, gs794 wrote: > pks = Test.objects.none().values('pk').query > print Test.objects.exclude(pk__in=pks) You're not supposed to do that. Try without the .query, and without the .values('pk'). -- Dennis K. They've gone to plaid! -- You received this message becaus

Re: single point of entry to a webpage

2010-07-24 Thread Dennis Kaarsemaker
On vr, 2010-07-23 at 12:50 -0700, owidjaya wrote: > I was thinking of creating a single point of entry to my webpage > through an app call "core" from there, depending on the url pattern, > it can pass the processing to different apps. how do i do that while > staying in the workflow of the framew

Re: What is the preferred method of returning to the results of a search

2010-07-24 Thread Dennis Kaarsemaker
On za, 2010-07-24 at 10:41 -0700, Erisa wrote: > I have a search view that presents an object_list with the search > result. Each item provides a url to jump to an edit page. After > editing (or deleting), I would like to return to the object_list page > showing the results of the same search so

Re: Field Subclassing, or setter help needed.

2010-07-03 Thread Dennis Kaarsemaker
On za, 2010-07-03 at 10:07 -0400, Sells, Fred wrote: > I need to override the setter behavior of all the fields in all my > models. They all subclass from the same abstract model. > > Specifically if the fields already contains a special character (used > to indicate "Not Applicable") I don' want

Re: Get an ordered queryset from a FK relation

2010-07-02 Thread Dennis Kaarsemaker
On vr, 2010-07-02 at 16:10 -0700, eka (Esteban) wrote: > I have an Entry model with a FK to User, what I want is to get a list > of Users ordered by its Entry quantity. Can I achieve that using > QuerySets? queryset.annotate(Count('entry')).order_by('entry__count') See http://docs.djangoproject.

Re: Django for system administration apps

2010-07-02 Thread Dennis Kaarsemaker
On vr, 2010-07-02 at 07:08 -0700, PieterB wrote: > > On Jul 2, 3:57 pm, Dennis Kaarsemaker wrote: > > On vr, 2010-07-02 at 06:42 -0700, PieterB wrote: > > > puppet using django as well. > > Without going into detail, how have you made the coupling between the > t

Re: Django for system administration apps

2010-07-02 Thread Dennis Kaarsemaker
On vr, 2010-07-02 at 06:42 -0700, PieterB wrote: > How frequently is Django used to write system administration > applications? I don't know how often others do it, but we use it to manage hundreds of servers by having a central database with django frontend and integrating that with tools like k

Re: Admin Search Engline

2010-07-01 Thread Dennis Kaarsemaker
ChangeList.get_query_set in django/contrib/admin/views/main.py On ma, 2010-06-28 at 11:41 +0200, Massimiliano della Rovere wrote: > Yes that's my idea. > Can you tell me which class/method in the admin files is responsible > for the search engine so that I can extend it? > > On Mon, Jun 28, 2010

Re: OR operator in django view

2010-06-18 Thread Dennis Kaarsemaker
On vr, 2010-06-18 at 14:04 -0700, Nick wrote: > How would I write this conditional statement in a view? > > if not candidate.office_type == "USREP" or "USSEN" or "DJ" or > "ASSOCDJ": > office = '%s' % (candidate.office_type_description) > else: > office = [] > > > As is s

Re: Emailing users with invalid local part email addresses

2010-06-16 Thread Dennis Kaarsemaker
On di, 2010-06-15 at 17:44 +0100, Tom Evans wrote: > I have a bunch of users from one of our subscribers who all have > invalid local parts to their email addresses. > > Eg: > > åsak.østerga...@example.com > jan-åke.hammarstr...@example.com > > Django assumes that all the addresses are valid, a

Re: Validation of dependent form fields

2010-06-14 Thread Dennis Kaarsemaker
On ma, 2010-06-14 at 11:26 -0700, Thomas Allen wrote: > Is there a way to assume one field to be invalid if another is? In the > form below, api_key can never be valid if location is not. The place to implement such checks is in the clean() method of the form, which is called after all the indivi

Re: inclusion tag variable resolving

2010-05-24 Thread Dennis Kaarsemaker
On ma, 2010-05-24 at 13:49 -0700, christian verkerk wrote: > i made an inclusion tag for making an image button of varying widths, > which i call through: > > {% make_button 'click me' item.get_absolute_url %} > > i then resolve the second param in context for the button link, > however i would l

Re: Line continuation in block tag?

2010-05-24 Thread Dennis Kaarsemaker
On ma, 2010-05-24 at 07:15 -0700, Thomas Allen wrote: > Thomas Allen wrote: > > Is that possible in a Django template? If my tag spans more than one > > line, it is rendered as plaintext. > > Is this not possible? Correct. Tags should be on one line. -- Dennis K. They've gone to plaid! -- Yo

Re: API with django

2010-05-24 Thread Dennis Kaarsemaker
On ma, 2010-05-24 at 05:05 +0200, Alexandre González wrote: > I must develop a django app that receives XML and returns XML. > > What's the best way to do this? Create a view that receive the XML and > parse it to return a template with the XML resultant? That would be a good way of doing it. You

Re: Hi

2010-05-08 Thread Dennis Kaarsemaker
On za, 2010-05-08 at 16:04 +0530, Shyam chandran wrote: > How can we display manay to many field in list_display? > pls help. You can't. http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display -- Dennis K. They've gone to plaid! -- You received th

Re: Catching User's First Log in

2010-04-05 Thread Dennis Kaarsemaker
On ma, 2010-04-05 at 20:50 +0100, Wesley Childs wrote: > I'm trying to catch the first time someone logs in so I can present > them with some options. I was wondering whether there is something > readily available in Django for this or whether I'll need to go down > the route of having a boolean f

Re: Newbie Issue: Creating a new django project

2010-04-05 Thread Dennis Kaarsemaker
On ma, 2010-04-05 at 12:38 -0700, Kartik wrote: > python django-admin.py startproject django-test > python: can't open file 'django-admin.py': [Errno 2] No such file or > directory python c:\where\django\lives\django-admin.py startproject myproject (Don't put dashes in your projectname. It shoul

Re: Table in models.py not being created during syncdb

2010-04-03 Thread Dennis Kaarsemaker
On wo, 2010-03-31 at 10:16 -0700, wchildsuk wrote: > I'm using the django app, django-schedule (http://github.com/thauber/ > django-schedule) and am adding an additional table to map users to > calendars (see line 253 on dpaste). When I run syncdb it completely > ignores my table and doesn't thro

Re: dir not working in manage.py runserver

2010-03-27 Thread Dennis Kaarsemaker
On za, 2010-03-27 at 04:13 -0700, serek wrote: > Hi > > When I run manage.py shell and use this code: > > >>> from .page.models import * > >>> p = Page() > >>> dir(p) > > it is work well, but when in views.py I use the same then is no > output? Why? I need something similat to php var_dump o

Re: Default filter value for Admin?

2010-03-27 Thread Dennis Kaarsemaker
On vr, 2010-03-26 at 17:21 -0700, david.schruth wrote: > I'm wondering if there is an easy way to set up a default filter on > the rows of my table: > > 1) at all Yes. > 2) using a foreign class' field Yes. > for example. > > lets say I have a table called >'student' with fields name, gpa

Re: passing more information with formsets

2010-03-17 Thread Dennis Kaarsemaker
On wo, 2010-03-17 at 09:34 +, Alastair Campbell wrote: > On Tue, Mar 16, 2010 at 7:46 PM, Dennis Kaarsemaker wrote: > > Each ModelForm has an instance attribute, so you can use > > {{ form.instance.whatever }} > > Hi Dennis, > > Unfortunately it is not a mode

Re: Django noob - static views or dynamic pages in web application?

2010-03-16 Thread Dennis Kaarsemaker
On di, 2010-03-16 at 15:23 -0700, gvernold wrote: > Just taking my first steps with Django and in fact web frameworks in > general. I understand that in a Django based CMS a URL is passed via a > variable in urls.py which then locates a row in a database containing > the html code to send to a tem

Re: passing more information with formsets

2010-03-16 Thread Dennis Kaarsemaker
On ma, 2010-03-15 at 00:14 +, Alastair Campbell wrote: > Is there a way to loop through the members at the same time? Or some > other way of accessing the matching objects? Each ModelForm has an instance attribute, so you can use {{ form.instance.whatever }} -- Dennis K. The universe tends

Re: unique_together - related Model field.

2010-03-13 Thread Dennis Kaarsemaker
On wo, 2010-03-10 at 12:24 -0800, Daniel S wrote: > However, I can't use 'item.parte' as django gives me an error that I'm > referring to a field that doesnt' exist. > > Is there a way I can use a field of another object in unique_together? No, that is not possible. You will need to make your cl

Re: django+modelform+Foreignkey

2010-03-07 Thread Dennis Kaarsemaker
On za, 2010-03-06 at 23:36 +0200, H.İbrahim Yılmaz wrote: > Hi all, > I have some ModelForms.. This ModelForms based some ForeignKey > included models. When i want to create a ModelForm I got these > ForeignKey fields something like (in a dropdown menu) "BlaBla object". > But i want to get in that

Re: gintare

2010-03-07 Thread Dennis Kaarsemaker
On zo, 2010-03-07 at 01:45 -0800, gintare wrote: > Is it possible in python access name of variable? > I want to convert the name of the variable to the string, not the > value of variable to the string. No, this is not possible. -- Dennis K. The universe tends towards maximum irony. Don't pus

Re: Selecting rows from 4 in one to many relationship, please help

2010-03-07 Thread Dennis Kaarsemaker
On zo, 2010-03-07 at 01:53 -0800, Alexis Selves wrote: > InternalError: current transaction is aborted, commands ignored until > end of transaction block http://docs.djangoproject.com/en/dev/topics/db/transactions/#handling-exceptions-within-postgresql-transactions -- Dennis K. The universe ten

Re: Many-To-Many Relationship with intermediate table

2010-03-07 Thread Dennis Kaarsemaker
On zo, 2010-03-07 at 05:01 -0800, jorge.silva wrote: > Hi there! > > As far as I've read in the Django wiki this is a very common > situation, yet I can't get it right > I've inherited a legacy database which I'm slowly trying to model in > Django to benefit from the free Admin site. As long a

Re: Djamgo cookies

2010-02-21 Thread Dennis Kaarsemaker
On zo, 2010-02-21 at 23:51 +, theikl...@gmail.com wrote: > I have a firewall that immediately expires cookies. [...] How can I > fix this Get a better firewall. Firewalls shouldn't mess with cookies. -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this

Re: formatting results of search

2010-02-21 Thread Dennis Kaarsemaker
On wo, 2010-02-17 at 05:32 -0800, gintare wrote: > @@in *.html > @@using line {{ word|escape }} > > @@i am getting printed answer :(u'moi',) instead of moi. > @@I need only word moi (without any brakets, quatations) be visible in > a webpage. In this case you want word.0|escape values() alway

Re: Union of two query sets?

2010-02-21 Thread Dennis Kaarsemaker
On ma, 2010-02-15 at 18:22 -0800, ydjango wrote: > I have two query sets with two different where clause on same table > and same columns. Is it possible to have their union. > > I tried qryset = qryset1 + qryset2 - It gave me - "+ unsupported > argument" One possible way: queryset = yourmodel.o

Re: Need help to order a query set

2010-02-11 Thread Dennis Kaarsemaker
On do, 2010-02-11 at 03:36 -0800, roomy wrote: > Hi... I was wondering if someone could tell me how can I represent > this mysql statement in django . "order by first_name='Yash', > first_name" http://docs.djangoproject.com/en/dev/ref/models/querysets/#extra-select-none-where-none-params-none-

Re: Dynamic Model

2010-02-11 Thread Dennis Kaarsemaker
On do, 2010-02-11 at 15:51 +0330, Sameer Rahmani wrote: > is it possible to build a dynamic model in run-time in version 1.1 ? Not sure if it's possible, but you can try messing around with __new__ from django.db import models.base import ModelBase, Model YourModel = ModelBase.__new__(ModelBase,

Re: ANN: django-admin-tools 0.1.0 released

2010-02-11 Thread Dennis Kaarsemaker
On wo, 2010-02-10 at 09:56 +0100, David Jean Louis wrote: > I'm happy to announce the availability of the first public release of > django-admin-tools. > > Django-admin-tools is a collection of extensions/tools for the > default > django administration interface, it includes: > * a full featu

Re: Customized filter for Django Admin

2010-02-11 Thread Dennis Kaarsemaker
On di, 2010-02-09 at 08:52 +0200, Derek wrote: > Can the filter list for the Region (as shown above in the RegionAdmin > class) be altered in some way such that it only shows those countries > that have regions? i.e. it will not show the complete list of all > Countrys, but only that subset which

Re: mysql master-master setup

2010-02-07 Thread Dennis Kaarsemaker
On ma, 2010-02-08 at 00:04 +0100, Henrik Genssen wrote: > what is the best way to setup a master-master replication using mysql > with django? Not to do it :) > Has anyone any experiences with this? I did not use it with django, but I have use master-master (or even rings with more than 2). It'

Re: Getting endless redirects when accessing root url

2010-02-07 Thread Dennis Kaarsemaker
On za, 2010-02-06 at 07:52 -0800, Jan wrote: > urlpatterns = patterns('', > (r'^/$', flatpage, { 'url' : 'home/' } ), ^/$ should be ^$ -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Dj

Re: Is there a way to access a field's verbose_name from a object_list generic view template?

2010-02-06 Thread Dennis Kaarsemaker
On do, 2010-02-04 at 11:01 -0800, Eric Chamberlain wrote: > I'm using the object_list generic view and it seems there should be a > way to pull the field verbose_name from the model, without having to > hard code the name in the template. model_class_or_instance._meta.verbose_name unicode(model

Re: When does syncd create new tables

2010-02-06 Thread Dennis Kaarsemaker
On do, 2010-02-04 at 11:31 -0800, Joakim Hove wrote: >c) I tried to recreate the tables with "./manage.py syncdb" - > but to no avail, nothing happened? syncdb only creates new tables and does not modify the schema of existing ones. > Any tips on what I am doing wrong greatly appreciated

Re: Trouble setting a form field's value in clean()

2009-11-16 Thread Dennis Kaarsemaker
On Mon, Nov 16, 2009 at 5:12 PM, Adam Stein wrote: > Running Django v1.1.1 on Apache v2.2.8 with Firefox v3.5.4. > > I have a very simplified and unreal example below to demonstrate what's > happening. > >8 -- > >    def clean(self): >        cleaned = self.cleaned_data > >        if not cleaned.h

Re: Confirm email by matching on form

2009-11-15 Thread Dennis Kaarsemaker
On zo, 2009-11-15 at 13:38 -0800, pjrhar...@gmail.com wrote: > Also, I have an even simpler suggestion. Don't make the user confirm > their email. I'm getting fed up with seeing this on forms all over the > web when it serves no purpose at all. You confirm a password because > you can't read it ba

Re: Anything like RoR's render :partial?

2009-11-15 Thread Dennis Kaarsemaker
On zo, 2009-11-15 at 10:08 -0800, apramanik wrote: > Sure in most cases, but is there a way to fake setting the context of > the included template? If I'm iterating over a set of comments and > include "comment.html", can I specify which comment to render? {% for comment in comments %} {% inclu

Re: Redirect

2009-11-15 Thread Dennis Kaarsemaker
On zo, 2009-11-15 at 09:35 -0800, Zeynel wrote: > how do i redirect www.swimswith.com to www.swimswith.com/admin/ In your urlpatterns: ('^$', lambda *args: HttpResponseRedirect('/admin/')) Or make your webserver do this, e.g. in apache: RewriteEngine On RewriteRule ^/$ /admin/ [R,L] -- Dennis

Re: Anything like RoR's render :partial?

2009-11-15 Thread Dennis Kaarsemaker
On zo, 2009-11-15 at 09:26 -0800, apramanik wrote: > I'm migrating to Django from Ruby on Rails. In the template language > for Django, I've been looking for something similar to RoR's > render :partial but can't find anything. It allows you write a > template for a snippet of code rather than an

Re: Questions about ContentType generic relations

2009-11-15 Thread Dennis Kaarsemaker
On zo, 2009-11-15 at 00:13 -0800, Continuation wrote: > I checked out the doc (http://docs.djangoproject.com/en/dev/topics/db/ > queries/) and can't find reference to it. Can you explain its usage a > bit more or point me to the relevant section of the doc? http://docs.djangoproject.com/en/dev/to

Re: ManyToOne to auth.models.User

2009-11-15 Thread Dennis Kaarsemaker
On za, 2009-11-14 at 15:53 -0800, TiNo wrote: > In my apps, Users of the app participate in a certain Year. I would > like a Year to continue a ManyToOne relationship with a User. As > creating a ForeignKey on a User is not possible, what would be the > best way to do this? I don't need a full-blo

Re: submit form

2009-07-12 Thread Dennis Kaarsemaker
re there any better ways? Thanks :) One possibiliry: Then in your view, check the value of request.POST['submit'] -- Met vriendelijke groet, Dennis Kaarsemaker --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Re: Run the Django Site in Apache

2009-07-11 Thread Dennis Kaarsemaker
On Sat, Jul 11, 2009 at 10:17 PM, Kannan wrote: > > Hi Friends... >   I am new to the Django.Just learning about the Django.I have > created a django application & run it runs only django server. > How can i run the django site in the Apache server. > Pls help me to solve this problem.

Re: index.html

2007-07-02 Thread Dennis Kaarsemaker
On ma, 2007-07-02 at 12:49 -0500, Carl Karsten wrote: > how do I set a default anything for when a user hits http://foo.com they get > index.html or any other file? I can see having a static file that does a > redirect - wondering if there isn't a better way. If your root is served by django,

Re: Using ManyToManyFields fails when trying to use django's DB api without the rest of django

2007-07-01 Thread Dennis Kaarsemaker
On zo, 2007-07-01 at 12:50 +1000, Malcolm Tredinnick wrote: > The pragmatic solution here is 'don't do that' -- fully import the > files containing model definitions with foreign relations *before* you > try to use the relations in code. The actual code of my program is fortunately sane enough t