ModelMultipleChoiceField and plus sign

2010-04-07 Thread Asim Yuksel
I have a field called peopleid. The default admin page displays this as a dropdown list and shows a green plus sign near it. Instead of dropdown, I want to use MultipleChoiceField. But if I define this field. I dont see the plus sign? How can I make it appear near the ModelMultipleChoiceField?

url pattern needed

2010-04-07 Thread ydjango
I have an ajax request coming in like this http://localhost:8000/board/getnames?age=31=1 I cannot change it to http://localhost:8000/board/getnames/31/1 1) what would be the url pattern to use in urls.py? 2) what would be view method - def getname(request, age = None, sex = None): -- You

Re: set up database engine

2010-04-07 Thread yangyang
I mean the tutorial only tells you "edit settings" but doesn't tell you how. Excuse me if this is obvious to most of people. On Apr 7, 11:17 pm, yangyang wrote: > how exactly set up the database engine as SQLight? The tutorial > doesn't seem to tell us... > > Thanks! -- You

set up database engine

2010-04-07 Thread yangyang
how exactly set up the database engine as SQLight? The tutorial doesn't seem to tell us... Thanks! -- 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

Re: URL Patterns for Nested Catagories.

2010-04-07 Thread Streamweaver
Thanks again. Just following up with my model to show how I'm implementing based on the advice above. Note I call my categories model Topics instead but you get the picture. class Topic(models.Model): ''' Topics form sections and categories of posts to enable topical based

Re: URL Patterns for Nested Catagories.

2010-04-07 Thread Streamweaver
Big thanks for the reply. I already have a custom save method on the Catagory for slugs so it'll be easy enough to create a path. I may not understand the suggested implementation very well but it sounds like I may not have to do a split at all if I store the sluggified path then I think all I

Re: URL Patterns for Nested Catagories.

2010-04-07 Thread Tim Shaffer
Oh, check out the Category class from django-simplecms. It implements the first method. Specifically, check out the save() method that builds the path based on all the parent categories if it doesn't exist. http://code.google.com/p/django-simplecms/source/browse/trunk/simplecms/cms/models.py#47

Re: URL Patterns for Nested Catagories.

2010-04-07 Thread Tim Shaffer
> I suppose I could do something like r'^(?P.*)$' and then parse path in > the view but this could wreak havoc with other URLs. Yes, that's the way to do it. You can prevent it from clashing with other URLs by prefixing it with something like categories/ so the URL would be:

URL Patterns for Nested Catagories.

2010-04-07 Thread Streamweaver
I'm trying to setup a Django based blog for myself and I'd like to do wordpress like nested catagories. The model itself is fine and there are some good posts about how to do such things around (i.e. http://swixel.net/2009/01/01/django-nested-categories-blogging-like-wordpress-again/) The thing

Re: url template tag taking a long time

2010-04-07 Thread Brian Neal
On Apr 6, 11:53 pm, Russell Keith-Magee wrote: > On Wed, Apr 7, 2010 at 12:08 PM, Brian Neal wrote: > > I am on trunk, somewhere around revision 127xx and just updated to > > 12936. A couple of my views render this one particular template, which > > used

Re: Error when following the tutorial

2010-04-07 Thread Shawn Milochik
Try to do ./manage.py shell and import your poll model. Once you can do that, you will have figured out the solution to this problem as a by-product. I don't expect it to work first try, but it should get you moving in the right direction. Shawn On Apr 7, 2010, at 5:21 PM, TheNational22

Re: Error when following the tutorial

2010-04-07 Thread TheNational22
sorry, that should've read home/kevin/crossen On Apr 7, 4:57 pm, TheNational22 wrote: > Yes /home/crossen/crossen has the init and so does polls > > On Apr 7, 4:55 pm, Shawn Milochik wrote: > > > > > On Apr 7, 2010, at 4:53 PM, TheNational22

Re: Error when following the tutorial

2010-04-07 Thread TheNational22
Yes /home/crossen/crossen has the init and so does polls On Apr 7, 4:55 pm, Shawn Milochik wrote: > On Apr 7, 2010, at 4:53 PM, TheNational22 wrote: > > > I have added /home/crossen/crossen to the python path, and I am still > > getting the errors > > Okay, but do the

Re: Error when following the tutorial

2010-04-07 Thread Shawn Milochik
On Apr 7, 2010, at 4:53 PM, TheNational22 wrote: > I have added /home/crossen/crossen to the python path, and I am still > getting the errors Okay, but do the directories you've added to the path contain __init__.py files? (zero-byte is fine, they just have to be there) -- You received this

Re: Error when following the tutorial

2010-04-07 Thread TheNational22
I have added /home/crossen/crossen to the python path, and I am still getting the errors On Apr 7, 4:26 pm, Shawn Milochik wrote: > Off of the top of my head that looks correct. Perhaps there's a problem with > your PYTHONPATH. > > Try to echo $PYTHONPATH and see what you

another many-to-many filtering question

2010-04-07 Thread Jim N
Hi All, I have a many-to-many relationship of User to Question through Asking. I want to get Questions that a given User has not asked yet. That is, Questions where there is no Asking record for a given User. I have the User's id. Models look like: class Question(models.Model): text =

Re: Double arrays in models django

2010-04-07 Thread Bill Freeman
You need one matrix table, having a row for each matrix. You need one matrix_row table, having a row for each row of any matrix, mostly containing a foreign key on the matrix table, showing of which matrix the row is part, plus it's row number in that table. And you need one matrix_row_values

Re: Error when following the tutorial

2010-04-07 Thread Shawn Milochik
Off of the top of my head that looks correct. Perhaps there's a problem with your PYTHONPATH. Try to echo $PYTHONPATH and see what you get. See if anything in your home directory is in there, and whether the fact that you have a subdirectory with a name identical to it's parent directory

Re: Double arrays in models django

2010-04-07 Thread zimberlman
I have now 2.21 at night, I live in Siberia. city of Tyumen. so I will read the answers in 6 hours 8 only in the morning when I wake up. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Double arrays in models django

2010-04-07 Thread zimberlman
No, no. I need to store the matrix and dual array is ideal for this would come up. The problem is that the matrix will grow in size, thousands of entries only on i, and where that same number of j. create table is not an option. only if the matrix transform and drive the table. and my question

Re: Error when following the tutorial

2010-04-07 Thread TheNational22
On Apr 7, 4:09 pm, Shawn Milochik wrote: > Your poll app is not in INSTALLED_APPS properly. > > What does INSTALLED_APPS look like in your settings.py? > > What does your directory structure look like, starting with the directory in > which you ran startproject? > > Shawn

Inline for model causes problem during save

2010-04-07 Thread onorua
Hello colleagues, I have the models.py: class User(models.Model): LastName = models.CharField(max_length=50, verbose_name = "Фамилия") FirstName = models.CharField(max_length=50, verbose_name = "Имя") MidleName = models.CharField(max_length=50, verbose_name = "Отчество") class

Re: Noticed some strange behaviour of request.GET.get()

2010-04-07 Thread Bill Freeman
String concatenate, format, comparison, indexing a dictionary*, all work with mixed types, unless the conversion from unicode to byte string can't be done with the current codec when forced to bytestring, in which case you get a suitable exception. Besides, this wouldn't explain why the value of

Re: Urgent Help Needed On Python/Django ModelChoiceFields

2010-04-07 Thread Bill Freeman
Well, where are things happening? Do you make a new request for each click, or do you want the changes to appear without a browser reload? If the former, the ability to customize seems to imply a model representing a choice, with a foreign key on the same model, allowing it to specify of which

Re: Error when following the tutorial

2010-04-07 Thread Shawn Milochik
Your poll app is not in INSTALLED_APPS properly. What does INSTALLED_APPS look like in your settings.py? What does your directory structure look like, starting with the directory in which you ran startproject? Shawn -- You received this message because you are subscribed to the Google

Error when following the tutorial

2010-04-07 Thread TheNational22
I am following the django tutorial here. I have followed it step by step. I am using sqlite3 as to not have to set up a DB. When I get to python manage.py sql polls, it returns "Error: App with labsl polls could not be found. Are you sure your installed apps setting is correct?" I have a polls dir

CSRF error while working through tutorial part 4

2010-04-07 Thread Gang Fu
Following the instruction, my settings.py has ... MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.csrf.middleware.CsrfMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',

Re: Double arrays in models django

2010-04-07 Thread pmains
If there is no Django model field for this, then one option would be to create your own model field (http://docs.djangoproject.com/en/dev/ howto/custom-model-fields/). Of course, it would not be compatible with most SQL Database types. Of course, it may be easier to just rethink your data model.

Re: PK and FK questions

2010-04-07 Thread Peter Herndon
On Apr 7, 2010, at 11:45 AM, ojayred wrote: > Hello All, > > I am new to Django and thinking about migrating to Django from our > existing web environment. I had a couple of questions that I would > like help in answering them. Your insight is greatly appreciated. > Thank you. > > 1)

Re: How to concatenate a list of Q objects?

2010-04-07 Thread Vinicius Mendes
If you want to mix AND and OR, you will have to do this manually: q = (q1 | q2) & q3 __ Vinícius Mendes Solucione Sistemas http://solucione.info/ On Wed, Apr 7, 2010 at 3:56 PM, Daniel wrote: > Thanks alot guys. If I can be honest, I'm having a

Re: Best solution to this problem?

2010-04-07 Thread Marcos Marín
Personally I like 2 best, it seems more flexible in case you later decide to show different kinds of links or other information (like a note that says the profile is viewable only to friends, etc.) On Wed, Apr 7, 2010 at 14:02, mtnpaul wrote: > I have a logged in user.

Best solution to this problem?

2010-04-07 Thread mtnpaul
I have a logged in user. The user does a search for other uses on the system. The other users can have various type(s) of privacy set for their profiles. Privacy levels are Public, Friend, Community (think Pinax Tribe), and Private. I want to display a list of the users, and depending on the

Re: Noticed some strange behaviour of request.GET.get()

2010-04-07 Thread Daniel Roseman
On Apr 7, 9:40 am, Alexey Vlasov wrote: > Hi. > > There's a simple code in urls.py: > == > def ls (request): >     import os > >     out_html = '' >     home_path = '/home/www/test-django' >     # subdir_path = request.GET.get ('subdir') >     subdir_path =

Re: How to concatenate a list of Q objects?

2010-04-07 Thread Daniel
Thanks alot guys. If I can be honest, I'm having a little trouble digesting just this one line: q = q | f if q else f That line of code only allows (q1 | q2 | q3), right? It will not allow mixing "AND" as well as "OR" (i.e., q1 & q2 | q3)? Thanks! On Apr 7, 1:26 pm, Vinicius Mendes

Re: Urgent Help Needed On Python/Django ModelChoiceFields

2010-04-07 Thread pedjk
Thanks Bill. I'll clarify. Basically what I want to do is give each option under the choice field a function. So once the user has selected an option under the drop down box, that would initiate a script which would generate a set of links (buttons) at the bottom of the page to take the user to

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Merrick
Found the problem, thanks again for all of the help. It turns out you have to define the extra field above def __init__(self, *args, **kw) as in: forms.py class SomeForm(ModelForm): checkbox = forms.BooleanField(required=False, widget=forms.CheckboxInput(), label='some label')

Re: Noticed some strange behaviour of request.GET.get()

2010-04-07 Thread Nuno Maltez
The only difference I can see is that request.GET.get ('subdir') will return an unicode string, u"public_html", instead of a normal string, 'public_html'. If it works with the byte string, try changing the line to subdir_path = str(request.GET.get('subdir')) Nuno 2010/4/7 Alexey Vlasov

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Daniel Roseman
On Apr 7, 6:19 pm, Merrick wrote: > I appreciate all of the help, I was actually showing both Daniel and > Raj that their suggestions have been tried to no result. To answer > your question, look up at Raj's suggestion. My code before and after > trying the suggestions above,

Re: PK and FK questions

2010-04-07 Thread ojayred
For responses to 1 and 3. Is there somewhere I can look? I guess I will have to test these capabilities along with unique_together to resolve the Multiple PK issue. For 2, I will have to add them as suggested. For 4. Sorry, I couldn't understand. Can you explain it again. :) I have a test

Re: Noticed some strange behaviour of request.GET.get()

2010-04-07 Thread Alexey Vlasov
Hi Bill Freeman. 1. I don't know. Actually I'm not really a django-programmer, I'm only busy with debugging. But IMHO, in this case it doesn't really matter where the code is, it should work in urls.py too. 2. subdir_path u'http' On Wed, Apr 07, 2010 at 10:16:52AM -0400, Bill Freeman wrote: >

Re: How to concatenate a list of Q objects?

2010-04-07 Thread Vinicius Mendes
On Wed, Apr 7, 2010 at 2:00 PM, Tom Evans wrote: > On Wed, Apr 7, 2010 at 5:39 PM, Daniel wrote: > > Hi, > > > > Thank you for your help everyone. I know that I need to learn python > > better, and I did read those articles. What is still a bit

Re: Urgent Help Needed On Python/Django ModelChoiceFields

2010-04-07 Thread Bill Freeman
Since it's urgent, I'll give an opinion despite not fully understanding your description of the problem. If it's going to be so far removed from what the admin app does by default, I'd go with a custom view outside of the admin, which you can customize to your heart's content. That is, when it's

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Merrick
I appreciate all of the help, I was actually showing both Daniel and Raj that their suggestions have been tried to no result. To answer your question, look up at Raj's suggestion. My code before and after trying the suggestions above, is to have message defined outside of meta. Do you have a

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Tom Evans
On Wed, Apr 7, 2010 at 5:30 PM, Merrick wrote: > Thank you. > > I'll be more specific, here is what I have: > > views.py > - > ... > if request.method == 'POST': >    some_form = SomeForm(data = request.POST, request=request, > instance=somemodel) >    ... >    if

Re: How to concatenate a list of Q objects?

2010-04-07 Thread Tom Evans
On Wed, Apr 7, 2010 at 5:39 PM, Daniel wrote: > Hi, > > Thank you for your help everyone.  I know that I need to learn python > better, and I did read those articles.  What is still a bit unclear to > me, though, is how could I add an "OR" or "AND" separator between Q >

Re: How to concatenate a list of Q objects?

2010-04-07 Thread Daniel
Hi, Thank you for your help everyone. I know that I need to learn python better, and I did read those articles. What is still a bit unclear to me, though, is how could I add an "OR" or "AND" separator between Q objects? So I have a list of qobjects like [qObj1, qObj2, qObj3]. What I want is

Urgent Help Needed On Python/Django ModelChoiceFields

2010-04-07 Thread pedjk
Ok, I'm quite new to Python and Django so this might actually have a simple solution. I'm coding for a form using Django and I have a ModelChoiceField. Now what I want to do is make the options for this field customizable. So if you choose an option, a set of links would be generated allowing you

formset issue

2010-04-07 Thread Emanuel
I've send this post this morning: Hi I have a formset and I'm passing initial data: DeletionFormset = formset_factory(deletionForm, extra=0) formset = DeletionFormset(initial=make_initial_data(instance)) The initial data arrives to the constructor fine. When the construct bilds the

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Merrick
Thank you. I'll be more specific, here is what I have: views.py - ... if request.method == 'POST': some_form = SomeForm(data = request.POST, request=request, instance=somemodel) ... if some_form.is_valid(): some_form_update = some_form.save(commit=False)

RE: Re: PK and FK questions

2010-04-07 Thread Henrik Genssen
Hi, >> 1) Considering, there is no support for Multiple Primary keys, how >> would Django react if my tables have multiple primary keys and I tried >> to update or delete a record? I am just curious. sorry, I do not know... >> 2) I read somewhere that each table must have one primary key? Some

Re: PK and FK questions

2010-04-07 Thread Marcos Marín
Hi, I'm not too experienced with django myself so I will let someone else answer the rest of your questions. But for 2, wouldn't it be fairly simple to create primary keys for these tables? worst case scenario you just add a column that is a auto_incremented int and run a script to set it for

Re: DB Adapter for HTML5 Client Database Storage?

2010-04-07 Thread Andy McKay
Porting the Django ORM to Javascript would be great, but quite a lot of work. Go for it! In the meantime I'm playing around (as noted in Daniels post) using the wrapper around lawnchair, which in turn stores stuff in the client side database if present, and to be honest that's enough for me ;)

Re: Deployment with Apache. Help !

2010-04-07 Thread Pep
Thanks for your answers. Well, it's working now. But I don't understand why. I just add a LocationMatch with a regular expression (CSS, png, etc.). But the location still not working :=° Any idea ? On 7 avr, 17:36, Nadae Ivar Badio wrote: > hi Pep: > > Do you give

PK and FK questions

2010-04-07 Thread ojayred
Hello All, I am new to Django and thinking about migrating to Django from our existing web environment. I had a couple of questions that I would like help in answering them. Your insight is greatly appreciated. Thank you. 1) Considering, there is no support for Multiple Primary keys, how would

Re: Deployment with Apache. Help !

2010-04-07 Thread Nadae Ivar Badio
hi Pep: Do you give permissions to apache to acces to your css directory? Pep wrote: Hi everybody ! I didn't find the answer. I deployed my django project on a webserver with apache. First, I started with Debug = True and the website worked fine. So, I decided to do it with Debug = False.

Re: Deployment with Apache. Help !

2010-04-07 Thread Johan Sommerfeld
I had a similar problem when I went from "manage.py runserver" It was because I had some debugging prints within the code. Could it be that? /J On 7 apr 2010, at 17.09, Pep wrote: > Hi everybody ! > > I didn't find the answer. I deployed my django project on a webserver > with apache. First,

Re: Deployment with Apache. Help !

2010-04-07 Thread andreas schmid
thats because you are serving your static media with django on debug=True but you don't serve it over apache on debug=False http://docs.djangoproject.com/en/dev/howto/static-files/ http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#serving-media-files Pep wrote: > Hi everybody ! >

Deployment with Apache. Help !

2010-04-07 Thread Pep
Hi everybody ! I didn't find the answer. I deployed my django project on a webserver with apache. First, I started with Debug = True and the website worked fine. So, I decided to do it with Debug = False. I could see my project but not my CSS and other medias. In the httpd.conf I just put the

Re: Custom QuerySet method that has an instance.save() error

2010-04-07 Thread Tom M
Ok, I definitely did this before posting, but deleting all .pyc files in the django path (again) did fix it this time (as suggested somewhere). How confusing is pdb to show you a .py source code file, with no apparent problem, when the mismatch occurred in a .pyc for a previous and different .py

Re: Noticed some strange behaviour of request.GET.get()

2010-04-07 Thread Bill Freeman
1. Why is this view code in urls.py? 2. What is the value of subdir_path in the trace back? (There's a little arrow you can click to see the variable values fro the frame.) 2010/4/7 Alexey Vlasov : > Hi. > > There's a simple code in urls.py: > == > def ls

Forcing a specific language

2010-04-07 Thread Daniel Baron
Hi all, is it possible to force a specific language (I am talking about real languages, i18n) while rendering a template? I have an application which allows the user to choose a language and I set a default language in the settings. But now I want to render only one single page forcing a

Noticed some strange behaviour of request.GET.get()

2010-04-07 Thread Alexey Vlasov
Hi. There's a simple code in urls.py: == def ls (request): import os out_html = '' home_path = '/home/www/test-django' # subdir_path = request.GET.get ('subdir') subdir_path = 'public_html' for root, dirs, files in os.walk (os.path.join (home_path,

Re: Newbie: New user creation with forms

2010-04-07 Thread Nicola Noonan
yes i followed that tutorial and can't even get that one working! On Wed, Apr 7, 2010 at 12:31 PM, Daniel Roseman wrote: > On Apr 7, 12:13 pm, Nicola Noonan wrote: > > I want to create a user with a form and i want that user to be able to > >

Re: Newbie: New user creation with forms

2010-04-07 Thread Daniel Roseman
On Apr 7, 12:13 pm, Nicola Noonan wrote: > I want to create a user with a form and i want that user to be able to > submit data, see i'm building a website and it's a gossip site, i need to > let other users log on and insert data such as gossip, news, articles. Im > not

Re: Newbie: New user creation with forms

2010-04-07 Thread Nicola Noonan
I want to create a user with a form and i want that user to be able to submit data, see i'm building a website and it's a gossip site, i need to let other users log on and insert data such as gossip, news, articles. Im not sure where to begin, i have a rough idea about the forms but its actually

Re: inner join operation on legacy tables?

2010-04-07 Thread Daniel Roseman
On Apr 6, 7:26 pm, "jani.mono...@gmail.com" wrote: > > The generated model from inspectdb is only a best guess, but there's > > nothing to stop you editing it. If your field really is a foreign key, > > Not really a foreign key,both tables have a string field ID which is >

Re: DB Adapter for HTML5 Client Database Storage?

2010-04-07 Thread Russell Keith-Magee
On Wed, Apr 7, 2010 at 3:45 PM, Victor Hooi wrote: > heya, > > This is a bit of random musing, but I was wondering, how big a project > is it to write a DB adapter for the Client-side Client-side Database > Storage API in HTML5? > > That is, there are already efforts to

formset issue

2010-04-07 Thread Emanuel
Hi I have a formset and I'm passing initial data: DeletionFormset = formset_factory(deletionForm, extra=0) formset = DeletionFormset(initial=make_initial_data(instance)) The initial data arrives to the constructor fine. When the construct bilds the forms it overrides a ChoiceField with a

Re: DB Adapter for HTML5 Client Database Storage?

2010-04-07 Thread Daniel Hilton
On 7 April 2010 08:45, Victor Hooi wrote: > heya, > > This is a bit of random musing, but I was wondering, how big a project > is it to write a DB adapter for the Client-side Client-side Database > Storage API in HTML5? > > That is, there are already efforts to integrate in

DB Adapter for HTML5 Client Database Storage?

2010-04-07 Thread Victor Hooi
heya, This is a bit of random musing, but I was wondering, how big a project is it to write a DB adapter for the Client-side Client-side Database Storage API in HTML5? That is, there are already efforts to integrate in things like CouchDB and MongoDB models, surely using HTML5's client-side

Double arrays in models django

2010-04-07 Thread zimberlman
Hi, I need help. I know that in PostgreSQL, there is a type of data as arrays, and double. But I was unpleasantly surprised why there is no such models in django. The question is how do I get out of this situation? I need to keep a two-dimensional matrix, and two-dimensional array would be ideal

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread Daniel Roseman
On Apr 7, 4:05 am, Merrick wrote: > I added a checkbox form field to my template, and I even tried to add > it in my forms.py and then in my views.py I check for it like so: > > if form.cleaned_data['checkbox_field']: >   code to send email... > > But when I submit the form I

Re: how to add a field to a model form when the field is not in the model

2010-04-07 Thread raj
On Apr 7, 8:05 am, Merrick wrote: > How should I go about adding a field to a model form > when the field is not part of the model? Define a Custom ModelForm by specifying model in Meta and declare the required addnl field there. (check-box means boolean, right?). Now set