Re: inline model's choices field empty in admin

2009-06-02 Thread Daniel Roseman
On Jun 2, 4:53 pm, ryan wrote: > This additional model, which uses the same choices is emptying the > choices dropdown of both User with inline UserProfile and UserProfile > itself.  Add it prior to UserProfile in models.py of your test app: > > class Person(models.Model): >     sales_team = mode

Re: Search in one table, order by a field in another table

2009-06-02 Thread Daniel Roseman
On Jun 2, 3:04 pm, Larry wrote: > Hi, > > Here is what I want to do: > > I have one table A with two columns: user_id, msg_id (ManyTOMany) > and other table B with two column: msg_id, msg_time > > Now I want to search for msg_id's of a certain user_id in table A, and > display the msgs > ordered

Re: Django deployment

2009-06-03 Thread Daniel Roseman
On Jun 3, 9:16 am, vishy wrote: > Hi, > > I am developing an application on windows. I decided to upload it on > webfaction n see how deployment goes. The issues I faced was with > paths given - > for templates - I had given absolute path of directory on windows, > for database(using sqlite) - ju

Re: Managers to aggregate child object values?

2009-06-03 Thread Daniel Roseman
On Jun 3, 12:28 am, Streamweaver wrote: > I'm pretty new to Django still and I know much is still escaping me. > In particular I'm having trouble still with how to query subsets of > related objects. > > In this case I have two Models. > > class Project(models.Model): >     title = models.CharFie

Re: Newb - how to remember the main course while we select the dessert

2009-06-04 Thread Daniel Roseman
On Jun 4, 3:19 pm, adelaide_mike wrote: > My latest problem can be illustrated thus: > > In the first form we select the main course - spam or eggs.  In the > next form we select the dessert - ice cream or mud cake, and in the > third form we select the after-dimmer drink - tea or coffee. > > How

Re: decoupling urlconfs

2009-06-04 Thread Daniel Roseman
On Jun 4, 4:45 pm, Ross wrote: > I've been working my way through the Django tutorial and everything > has gone fine until I came across the part near the end of section 3 > about decoupling the urlconfs. I did as follows: I copied urls.py into > my polls directory (C:\mysite\polls\urls.py). It n

Re: Noobie question about getting form data to save to the database

2009-06-05 Thread Daniel Roseman
> On Jun 4, 7:47 pm, Streamweaver wrote: > > > You need to call form.save() after you validate the form. > On Jun 5, 8:08 am, Andy Dietler wrote: > When I add that line I get the following error: > > 'AddShow' object has no attribute 'save' Because you've used a plain Form, not a ModelForm. I

Re: Newbie - record parent ID in child data entered by ModelForm

2009-06-05 Thread Daniel Roseman
On Jun 5, 5:33 am, adelaide_mike wrote: > Another "in principle" question.  My Street model is the parent of my > Property model, many to one via foreign key. > > User selects the street and I store it in request.session. User then > gets to enter the property details in this form: > > class Prop

Re: multiple modelforms for model

2009-06-05 Thread Daniel Roseman
On Jun 5, 12:08 am, adrian wrote: > I need to show Telephone and Address modelforms in the middle of > another big form, > so I decided to organize the big form into smaller modelforms and > display each in a separate fieldset. > > This works well until the next time I clear the DB and run syncdb

Re: select size box error

2009-06-05 Thread Daniel Roseman
On May 30, 3:40 pm, Jesse wrote: > I have three drop down select boxes, which I have to expand for web > visibility reasons with the size='' option.  If I select one from each > box I receive no errors, but if I leave one or more boxes without a > selection I receive an error. > >   >     {% for

Re: syncdb no such table: auth_group

2009-06-05 Thread Daniel Roseman
On Jun 5, 8:42 am, Wim Feijen wrote: > Hello, > > python manage.py syncdb failed for me, saying: there is no such table > auth_group. On closer examination, the error stack mentioned one of my > models: timewriting. > > After commenting 5 lines of code: tada... syncdb worked! > > However, I do no

Re: How to import this module

2009-06-05 Thread Daniel Roseman
On Jun 5, 3:51 pm, David wrote: > Hello, > > In my project "mysite" directory I have "middleware.py". This > "middleware.py" has only one class "SiteLogin" and this class has only > one method "process_request". > > Now I need to import this "process_request" into "urls.py" in the > "mysite" dire

Re: How to import this module

2009-06-05 Thread Daniel Roseman
On Jun 5, 4:47 pm, David wrote: > Thanks DR. I did put  'mysite.middleware.SiteLogin' into > MIDDLEWARE_CLASSES  in settings.py already, however I still get > > Exception Value: name 'process_request' is not defined Please post the full traceback. -- DR. --~--~-~--~~~

Re: How to import this module

2009-06-05 Thread Daniel Roseman
On Jun 5, 4:58 pm, David wrote: > Middleware class: > > MIDDLEWARE_CLASSES = ( >     'django.middleware.common.CommonMiddleware', >     'django.contrib.sessions.middleware.SessionMiddleware', >     'django.contrib.auth.middleware.AuthenticationMiddleware', >     'mysite.middleware.SiteLogin', > )

Re: How to import this module

2009-06-05 Thread Daniel Roseman
On Jun 5, 5:17 pm, David wrote: > I am trying to set up a user login page. A user needs to login first > before he/she can do anything. > > I refered: "http://superjared.com/entry/requiring-login-entire-django- > powered-site/" > > "Then put myproject.middleware.SiteLogin in your MIDDLEWARE_CLASS

Re: query help (distinct)

2009-06-05 Thread Daniel Roseman
On Jun 5, 6:56 pm, "eric.frederich" wrote: > How can I get distinct content_types from a model like this?... > > In sqlite I did the following and it worked... > sqlite> select distinct content_type_id from booking_managedasset; > > class ManagedAsset(models.Model): >     content_type   = models.

Re: Bulk get

2009-06-06 Thread Daniel Roseman
On Jun 6, 4:13 pm, Andrew Fong wrote: > Was hoping not to have to loop back through it -- but I guess I'll > just have to suck it up and do it. Thanks. > If you've got the order already in model_pk_list, you can use the order_by parameter to .extra() to get the results in that order straight f

Re: Type Error str is not callable in base.py

2009-06-07 Thread Daniel Roseman
On Jun 7, 9:33 am, grElement wrote: > Yeah, I couldn't figure it out either since the error message is not > so helpful and it seems that this is actually a django bug that they > are currently working on, but according to the documentation of the > error reporting bug it should be coming from my

Re: Getting radio boxes with ModelForm

2009-06-08 Thread Daniel Roseman
On Jun 8, 8:23 pm, Andy Dietler wrote: > I'm trying to make one of the fields in my model display radio buttons > with the options 1-5. I can't find a way to do this with a model form > and I can't get anything I find in documentation to work properly. > > What I have below results in me getting

Re: "manage.py install" not supported?

2009-06-08 Thread Daniel Roseman
On Jun 8, 6:12 pm, Bo Zhao wrote: > sorry all, i find it..in the 1.0 version, the subcommand install is removed. > but my question is how to automatically import a model without edit the > INSTALLED_APPS? > > On Mon, Jun 8, 2009 at 1:08 PM, Bo Zhao wrote: > > Hi all, > > > a quick and mightbe

Re: Callable objects inside a context

2009-06-09 Thread Daniel Roseman
On Jun 9, 5:23 am, EricR86 wrote: > Hello, > > I have a small issue in terms callable objects inside of contexts. I'm > having trouble figuring out how to have the call evaluated everytime > the context is used/rendered. An example: > > some_context = { >     'random': random(), > > } > > def som

Re: Django Tutorial 3 for beginners: What's wrong with the detail.html?

2009-06-09 Thread Daniel Roseman
On Jun 9, 11:21 am, Jipe wrote: > Hi all, > I 'm trying to use the Django Tutorial 3 for beginners. > I've met some problems. > Until you have to work with the template and index.html, it's ok > But when i try to make appear detail.html who is in the same template > directory as index.html, no wa

Re: Newb - Link users_extra_data table to built-in Users table - how?

2009-06-09 Thread Daniel Roseman
On Jun 9, 10:07 pm, adelaide_mike wrote: > Hi > I need to store additional info about my users.  The following in > models.py raises a name error due to User.  Have tried auth_users and > Users as well.  No joy. > > class   User_settings(models.Model): >                 user = models.ForeignKey(U

Re: problem using ajax in django

2009-06-10 Thread Daniel Roseman
On Jun 10, 10:50 am, newbie wrote: > Hi, > >          I have written a small javascript ajax code in my django > application. Its working fine in the development environment. But when > i use the same code in the same django application running on apache > and also on  a different url(if it matte

Re: is my DateTimeField in the past?

2009-06-10 Thread Daniel Roseman
On Jun 7, 10:46 pm, Mozey wrote: > Here is my two attempts at trying to test if my DateTimeField is in > the past or the future. > > # first attempt > def past(self): >         return self.scheduled_time < datetime.now() > > # It complained that i cannot compare a datetime to a string, hence my >

Re: problem with password reset

2009-06-10 Thread Daniel Roseman
On Jun 10, 1:22 pm, Kenneth Gonsalves wrote: > hi, > > [django trunk rev 10413] > > I am having a problem with password_reset. I get the message saying that a > mail has been sent, but I do not receive the mail. A check with my mail log > shows the mail is being sent from 'webmas...@localhost' an

Re: Update an object with a dictionary

2009-06-10 Thread Daniel Roseman
On Jun 10, 5:27 pm, Paolo Corti wrote: > Hi > is it possible to update an object with a dictionary? > > I tried something like this: > myobject.save(force_update=True, **my_dict) > > getting an error, though: > TypeError at ... > save() got an unexpected keyword argument 'myfieldname' > > I would

Re: how to custom Admin list_filter queryset?

2009-06-11 Thread Daniel Roseman
On Jun 11, 10:06 am, mydjango wrote: > how to custom Admin list_filter queryset? http://catb.org/esr/faqs/smart-questions.html -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: ManyToMany Question

2009-06-11 Thread Daniel Roseman
On Jun 11, 1:06 pm, LeeRisq wrote: > Programming with Django is unfortunately my job on the side right now, > so limited time for coding and testing. I know I could answer this > question myself by tinkering around, but don't have time. > > When you have a generic ManyToMany field specified betwe

Re: stringformat to get first 3 characters?

2009-06-11 Thread Daniel Roseman
On Jun 11, 3:50 pm, Frank Peterson wrote: > I need to use the stringformat filter on a variable in a template but > I just want it to grab the first 3 characters of the variable. > > {{ object.caption|lower|truncatewords:"1"|stringformat:"3s" }} > > Doesnt seem to work. Use slice (because Python

Re: Newbie question on ContentTypes and Generic Relations

2009-06-13 Thread Daniel Roseman
On Jun 12, 8:54 pm, Rana wrote: > Hi, > > I am trying to modify a blog and article model that will both display > data from a related products model. I read that the way I should do > this is through the ContentTypes framework and generic foreign > relations. I would be grateful for some guidance

Re: form instance to update an object

2009-06-15 Thread Daniel Roseman
On Jun 15, 3:20 pm, Genis Pujol Hamelink wrote: > Hi list, > > I am trying to create a view to update objects in the db: > > http://dpaste.com/55546/ > > but when posting the data, form.is_valid() fails because the object already > exists in the db. Is there a way to validate a form using an exis

Re: Sometimes datetime sometimes date?

2009-06-15 Thread Daniel Roseman
On Jun 16, 3:34 am, Streamweaver wrote: > sqlite3 > > I changed the method and it seems to be working now. > > The code I'm using is: > > def all_last_updated(self): >         d = [self.last_updated, self.activity_set.latest > ().last_updated] >         d.sort() >         d.reverse() >         re

Re: ModelForm, foreignkey, and hidden fields is null

2009-06-15 Thread Daniel Roseman
On Jun 16, 1:12 am, k-dj wrote: > I'm just starting to use django and have run into a problem I have not > been able to solve. > > I have a model Item which stores, among other things, user_id. > Then I have a ModelForm. I want user_id to be a hidden field. After > searching around the web, I fou

Re: form instance to update an object

2009-06-15 Thread Daniel Roseman
On Jun 15, 4:23 pm, Genis Pujol Hamelink wrote: > yes, but what if it's a new object and not an existing one? How do I test > this? The request method will be POST, so form will be form = > MyForm(request.POST)... so if form.pk exists in the db how do I tell it's > editing an existing object? > >

Re: form instance to update an object

2009-06-16 Thread Daniel Roseman
On Jun 16, 9:48 am, Genis Pujol Hamelink wrote: > well, if you retrieve an object via GET modify something and then submit the > new data you will create a POST request and I was wondering if I could test > wether the object being saved was an existing one or not... > > greetings, > > Genis > OK,

Re: urls spanning different apps

2009-06-17 Thread Daniel Roseman
On Jun 17, 7:39 am, "C. Feldmann" wrote: > Good morning, > > I was wondering how to implement the following without having to > hardcode each url. > I have different apps like i.e. books, authors, magazines, etc. > Normally I would call upon default views by using something > like:http://localho

Re: How do I get a field value instead of in an admin selectbox?

2009-06-17 Thread Daniel Roseman
On Jun 17, 3:52 am, DaveB wrote: > I have what must be a common problem: there are three master files, > and a transaction in my admin site involves selecting an item from > each of these files. The field in the Transaction table is a foreign > key pointer to the master file's record. The default

Re: order by count of related object

2009-06-17 Thread Daniel Roseman
On Jun 17, 1:12 pm, R C wrote: > Hi, > > I would like to be able to select objects and order them by the count > of a related field > > For example, I have 2 models: > > class Author(models.Model) >     name = models.Charfield(max_length=20) > > class Article(models.Model) >     author = models.F

Re: Why why why not write a search module for Django user?

2009-06-18 Thread Daniel Roseman
On Jun 18, 9:39 am, Shuge Lee wrote: > Search is used in most of CMS, > for avoid re-invent the wheel,  please provider a search engine module. http://haystacksearch.org/ Django is not a CMS. -- DR. --~--~-~--~~~---~--~~ You received this message because you ar

Re: Conditionally bypassing Django form validation

2009-06-18 Thread Daniel Roseman
On Jun 18, 8:02 pm, chefsmart wrote: > Hi, > Now consider the following view: - > > def edit_diploma(request, did): >     diploma_to_edit = Diploma.objects.get(id=did) >     if request.method == 'POST': >         form = EditDiplomaForm(request.POST) >         if form.is_valid(): >             di

Re: Beginners question: select box with very much options

2009-06-18 Thread Daniel Roseman
On Jun 18, 4:37 pm, Mathias Waack wrote: > Hello django experts, > > let me first note I'm a beginner in both django and web-development at all. > > I have a form with some select boxes containing several million options. Now > I'd like to have something like the search field in wikipedia, where

Re: Is it possible to override the method used to call Django’s admin delete confirmation page?

2009-06-18 Thread Daniel Roseman
On Jun 18, 9:41 pm, "huu...@gmail.com" wrote: > On Django's admin pages, I'd like to perform an action when the > administrator clicks the Delete button for an object.  In other words, > I'd like to execute some code prior to arriving on the "Are you sure?" > delete confirmation page. > > I reali

Re: Preset foreign key in Model Form

2009-06-19 Thread Daniel Roseman
On Jun 19, 1:36 am, adelaide_mike wrote: > Try again.  I am new to Django and the web, so I do not know all the > right vocabulary.  Sorry. > > I need my ModelForm to be displayed, for creation of a new record, > with a date field and a foreign key (pointing to the Source table) > selector list a

Re: How to invoke hasNoProfanities?

2009-09-12 Thread Daniel Roseman
On Sep 11, 10:40 pm, Brandon wrote: > Uh, where? I see the definition in settings.py, but I can certainly > enter any of the words on the profanities list in: > django.conf.global_settings.py into a text field and it will not throw > an exception. > I actually think that this is a left-over sett

Re: Make a bold row in a table

2009-09-12 Thread Daniel Roseman
On Sep 12, 3:12 pm, adelaide_mike wrote: > Django 1.0.2   In the following template I intend to make rows that > have an empty second column bold.  Hence trying 2 in row.  My syntax > is wrong due to inexperience with Python, and possibly my methodology > also. > > {% extends "base.html" %} > {%

Re: How to invoke hasNoProfanities?

2009-09-12 Thread Daniel Roseman
On Sep 12, 5:26 pm, Angel Cruz wrote: > I use the contribs.comments module, and in its clean_comment method: > > if settings.COMMENTS_ALLOW_PROFANITIES == False: >             bad_words = [w for w in settings.PROFANITIES_LIST if w in > comment.lower()] >             if bad_words: >              

Re: Can I dereference a field in the output of a filter?

2009-09-12 Thread Daniel Roseman
On Sep 12, 8:08 pm, "W.P. McNeill" wrote: > I have a view that renders a table.  The "table" object is a list > rows, which are themselves lists of model objects.  These objects have > a parameter called label. > > Inside the template > > {{ object.label }} > > render's an objects label and > > {

Re: Query with left join?

2009-09-12 Thread Daniel Roseman
On Sep 12, 9:53 pm, tom wrote: > Hi, > > i want to produce a left-join query with the django orm. Can anybody > help howto do the following query? > > SELECT S.value, D.value from data as S left join data as D on > S.entry_id=D.entry_id; > > Cheers tom What's the point of this query? What are yo

Re: Query with left join?

2009-09-13 Thread Daniel Roseman
On 2009/9/13, tom wrote: > > I have a model to save measurement data. Every datarow has a > identifier(CharField) and a value(FloatField) and a entry(ForeignKey). > For example: > > Entry Identifier value > 1s1 100 > 1d1 180 > 1q5 300 > 2

Re: Date Field in ModelForm

2009-09-13 Thread Daniel Roseman
On Sep 9, 12:07 pm, mettwoch wrote: > Here is the definition of the field: > >     date_due       = models.DateField(auto_now_add=True) I'd guess that the problem is the auto_now_add. When that's set, the field is not editable (because the date can only be set at creation). So the field is by de

Re: python manage.py syncdb error (L@@K)

2009-09-14 Thread Daniel Roseman
On Sep 14, 3:27 pm, about2flip wrote: > Hi: > > I am using learn django in 24 hours and I am following this example on > models. >   File "E:\djproj\ifriends\..\ifriends\People\models.py", line 8 >     def_str_(self): >                   ^ > SyntaxError: invalid syntax > > E:\djproj\ifriends> >

Re: Django ForeignKey to_field vs. db_column

2009-09-14 Thread Daniel Roseman
On Sep 14, 7:19 pm, Artur Ergashev wrote: > I'm working on some models for a legacy database structure, and am > having a road_block with Foreign Keys and non-conventional names. > > As I understand it, if in my model I have something like: > > something = ForeignKey(something) > > then django wi

Re: How to organize django projects on a productive server?

2009-09-15 Thread Daniel Roseman
On Sep 15, 8:49 pm, orschiro wrote: > Hello Léon Dignòn, > > you told that your projects lie beneath /var/www.. > > So the reason for that is that you might use Apache? > > As I remember (I'm using nginx instead of Apache) this is the default > directory. > It's a very bad idea to put your Djang

Re: passing parameters to formset

2009-09-15 Thread Daniel Roseman
On Sep 15, 6:22 pm, Michael Stevens wrote: > Hi. > > I'm creating a formset of forms using formset_factory. > > It's all working nicely, but I'd like to pass some values into the > forms to use as the choices for one of the fields. > > Is there a way to do this? As far as I can tell the formset_f

Re: views help with category_list for a blgo

2009-09-15 Thread Daniel Roseman
On Sep 15, 5:56 pm, ChrisR wrote: > Hello, > > I am building a blog/cms for my site.  I am using django's date_based > urls as well as object_detail for the individual posts. > > On my base, I have a for loop for categories in the blog.  I don't > like the way I have made the category_list work,

Re: How to organize django projects on a productive server?

2009-09-15 Thread Daniel Roseman
On Sep 15, 9:08 pm, orschiro wrote: > Hello Daniel, > > so the projects could be as well on the users home path? > > It makes more sense for me to put them on the home path than anywhere > else. As long as the web server process has the relevant permissions for those files, yes. -- DR. --~--~---

Re: HELP ME

2009-09-15 Thread Daniel Roseman
On Sep 15, 9:48 pm, alivad wrote: > hi all: > > I have the following code: > >     . >     formamig = forms.ModelChoiceField(label = "Tipo de visa", > queryset=Formamig.objects.all()) >     empresa = forms.CharField(max_length=60, required=False) > >     def clean(self): >         cleaned_dat

Re: Query with left join?

2009-09-15 Thread Daniel Roseman
On Sep 15, 6:22 am, tom wrote: > Hi Daniel, > > i don't want to presentate the data. i want to produce graphs with > this data. so it's not a presentation problem. i know that i can use > python to get the data in correct order and style, but it's a huge > amount of data and python would be very

Re: views help with category_list for a blgo

2009-09-15 Thread Daniel Roseman
On Sep 16, 4:35 am, ChrisR wrote: > I appreciate the help you gave DR, however, I am still a bit lost. > Any more suggestions or guidance with custom tags? > > I've been looking at the custom tags documentation... Well, currently you're relying on the extra_context parameter to your generic view

Re: Separate a project into 2 - both need to access the same models

2009-09-15 Thread Daniel Roseman
On Sep 16, 6:45 am, Merrick wrote: > I have a project that I am thinking of breaking up into 2 sites/ > projects. The goal is to be able to make changes to one site/project > without affecting the other one. Here is an example of what each would > do: > > mydomain.com > - > -

Re: Mutually exclusive fields in model validation

2009-09-15 Thread Daniel Roseman
On Sep 15, 11:19 pm, Sonal Breed wrote: > Thanks a lot Cliff, I implemented it in a similar manner, just wanted > to know if we > have anything like validation rules a la Access. > > Thanks again, > Sincerely, > Sonal. Not yet. Honza Kral's Google Summer of Code project for model validation is d

Re: Django ORM - Table Changes

2009-09-16 Thread Daniel Roseman
On Sep 16, 2:56 pm, Thomas wrote: > Thanks.  I haven't heard of Django Evolution.  Just searched for it on > Google; it sounds exactly like what I'm looking for.  In the meantime, > I've found 'python manage.py inspectdb ' which helps a > lot.  It seems to general model classes by inspecting the

Re: UnicodeEncodeError in models

2009-09-16 Thread Daniel Roseman
On Sep 16, 6:50 pm, "Gabriel ." wrote: > Hello, > > I have this method defined in a model: > >     def __repr__(self): >         return ugettext_lazy("%(file)s (Component: %(component)s - > Release: %(release)s)") % { >             'file': self.filename, >             'component': self.component.

Re: How to refer to a data item?

2009-09-17 Thread Daniel Roseman
On Sep 17, 1:48 pm, adelaide_mike wrote: > Hello > I, a newbie to Django and Python, have a model thus: > > class Person(model.Models): >     first_name = models.CharField(max_length=32) >     last_name = models.CharField(max_length=32) > > In my view.py can do this, to illustrate my question: >

Re: Embedding A List in urlpatterns

2009-09-17 Thread Daniel Roseman
On Sep 17, 4:10 pm, Thomas wrote: > Hello, > > I'm learning Django and have some questions regarding passing data to > urlpatterns.  Right now, I have something like this in my urls.py: > > urlpatterns = patterns('', >     (r'^$', index), >     (r'^list_jobs/', list_jobs), > ) > > This works fi

Re: queryset union

2009-09-17 Thread Daniel Roseman
On Sep 17, 3:39 pm, blumenkraft wrote: > Hi, > > I have two querysets: > x = models.Advertisement.objects.filter(company__name__search = > "test") > y = models.Advertisement.objects.filter(contact__phone__istartswith = > "8495") > > Is there any simple way to get union (using SQL UNION clause) of

Re: queryset union

2009-09-17 Thread Daniel Roseman
On Sep 17, 5:05 pm, blumenkraft wrote: > Did you mean or(|) instead of and(&)? Yes, sorry. > I need SQL UNION for efficiency reasons (using UNION instead of SQL > generated by > models.Advertisement.objects.filter( Q(company__name__search="test") | > Q(contact__phone__istartswith="8495") is 60x

Re: ModelForm refuses to save instance

2009-09-18 Thread Daniel Roseman
On Sep 18, 1:01 pm, Tom Evans wrote: > Hi all. I have a model form to update two attributes on a UserProfile. > > The form is simple: > > class UserProfileSetRememberMeForm(forms.ModelForm): > DURATION_CHOICES = ( > ( 0, 'Default (2 weeks)'), > ( 1 * 7 * 24 * 60 * 60, '1 week'), >

Re: Manager is not accessible via model instances

2009-09-18 Thread Daniel Roseman
On Sep 18, 4:34 pm, Oleg Oltar wrote: > Hi! > > I have following model: > > class UserProfile(models.Model): >     """ >     User profile model, cintains a Foreign Key, which links it to the >     user profile. >     """ >     about = models.TextField(blank=True) >     user = models.ForeignKey(Us

Re: Django error

2009-09-20 Thread Daniel Roseman
On Sep 20, 7:47 am, zweb wrote: > When I try to download a file through django in IE , I get > > [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]     response = > func(request, response), referer:http://www.com > [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1]   File "/home/ > pmc/

Re: Order_by on greatgrandparent.name

2009-09-20 Thread Daniel Roseman
On Sep 20, 4:24 am, adelaide_mike wrote: > I have a multi-table model, each table related to the next by a one to > many foreign key. > > I wish to do: > > q = Child.objects.filter(date__gte=startdate).order_by > ('parent.grandparent.greatgrandparent__name') > > This raises an exception no such c

Re: passenger_wsgi import error

2009-09-20 Thread Daniel Roseman
On Sep 20, 2:33 am, "neri...@gmail.com" wrote: > I'm trying to use passenger_wsgi on Dreamhost and keeep getting 'An > error occurred importing your passenger_wsgi.py'. I think I've located > the syntax that is causing the problem but I don't know how to resolve > it and Dreamhost doesn't offer a

Re: mod_python to mod_wsgi

2009-09-20 Thread Daniel Roseman
On Sep 20, 7:57 pm, When ideas fail wrote: > Hello, I've recently updated my setup to use mod_wsgi instead of > mod_python. I'm having some problems with my urls. The home page loads > fine but none of my other urls seems to work (404 errors). They worked > before with mod_python. Do i need to in

Re: Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-20 Thread Daniel Roseman
On Sep 20, 6:54 pm, Parag Shah wrote: > Hello, > > I have a UserProfile Model object which has the > django.contrib.auth.models.User as it's ForeignKey. > > There is a register function in the view module, which goes like this: > > def register(request): >   if request.method == 'POST': >       u

Re: About using django-tinymce

2009-09-21 Thread Daniel Roseman
On Sep 21, 5:22 am, taijirobot wrote: > Hi, guys, > > I'm learning django recently and I am trying to add a rich text editor > to the places where long formated text like blog post are needed (the > site is running on local machine with the default django server). > > I tried to use django-tinymc

Re: Breakpoints in NetBeans

2009-09-21 Thread Daniel Roseman
On Sep 21, 8:00 am, Kevin Bache wrote: > Hi Everyone, > I'm a bit of a Django noob so please forgive me if my hope here is > swimmingly optimistic: > > I'd like to be able to set breakpoints in my django project which would be > triggered by my browser's requests to the integrated Django developm

Re: nested block definitions

2009-09-21 Thread Daniel Roseman
On Sep 21, 4:25 pm, Michael Feingold wrote: > I am somewhat confused about the semantics for nested block > definitions.Let me explain: > {% block %} tag serves two purposes a) define a hole (along with the > default value) to be filled later and b) define the content to replace > the current val

Re: URL Parameter is not found, 404 error

2009-09-21 Thread Daniel Roseman
On Sep 22, 2:31 am, Malcolm MacKinnon wrote: > Thanks, Karen. With your help, I manged to fix it. Note that - quite apart from your original problem - you've got a serious inefficiency in this view. You iterate through every customer to find a matching customer number which, once you get more th

Re: About using django-tinymce

2009-09-22 Thread Daniel Roseman
On 2009/9/22, taijirobot wrote: > Thank you very much. The problem was solved after I changed the > MEDIA_URL setting. > > But now I have a new question, it is about the display of the rich > text. > > I used code like this to display it: > > {{ post.title }} > {{ post.timestamp|date }} > {{ pos

Re: About using django-tinymce

2009-09-22 Thread Daniel Roseman
On Sep 22, 7:17 am, taijirobot wrote: > well, guys, I've solved this problem, but in a bad way. > > Since I'm running the site locally with the default django server, the > MEDIA_URL became a confusing thing to me. Luckily I have an Apache > server running on my machine, so I just set the MEDIA_U

Re: Records doesn't sometimes get upated

2009-09-22 Thread Daniel Roseman
On Sep 22, 9:48 am, Szymon wrote: > On 21 Wrz, 22:47, Javier Guerra wrote: > > > only if you include it in the parameter list: > > Oh, yes. I forget about self in my example, but in function that makes > problem there is of course self in parameter list. I suspect the problem isn't quite what y

Re: Comments and objects

2009-09-22 Thread Daniel Roseman
On Sep 22, 2:07 pm, Rodney Topor wrote: > Suppose a user posts a comment about a particular object, using > django.contrib.comments, as described in Practical Django Projects. > How can one get access to this object in a template such as > posted.html, so that one can include a link directly back

Re: passing information from a form instance to a field in that form

2009-09-22 Thread Daniel Roseman
On Sep 22, 8:59 pm, Jim wrote: > Hello, > > I have a widget that makes suckerfish menus (the kind of menu that is > written in css and where if you hover your mouse over a menu item any > subitems appear). > > I have some data that can be displayed according to three dimensions. > (For instance,

Re: dJango updating fields which are not being set

2009-09-22 Thread Daniel Roseman
On Sep 22, 8:59 pm, PlanetUnknown wrote: > Thanks Tom. > > But with this approach - > > > foo = Foo.objects.get(pk=foo_id) > > foo.field = new_value > > foo.save() > > There is an extra DB call, first the the data, and then another one to > save it. > If you have the primary_key with you, only on

Re: limit_choices_to & get_sql()

2009-09-22 Thread Daniel Roseman
On Sep 22, 10:16 pm, Nicolas Steinmetz wrote: > Hello, > > I would like to present only a subset of a given models. But so far, > in the admin, I have no value whereas there should be some. > > I tried several syntax but did not find the right one. > > Here are my implicated (and simplified) mode

Re: HTML / CSS question

2009-09-23 Thread Daniel Roseman
On Sep 23, 2:54 pm, Joshua Russo wrote: > I want to apply style to a block of text in the middle of a sentance without > effecting the flow. I've been using what feels like a serious hack by using > tags with a class property. My big fear is that the tags will > disappear from the list of suppor

Re: equivalent of getattr in a django template

2009-09-23 Thread Daniel Roseman
On Sep 23, 6:05 pm, Chris Withers wrote: > Hi All, > > I have this view function: > > def index(request,model,pk=None): > >      return list_detail.object_list( >          request, >          queryset=model.objects.all(), >          paginate_by=10, >          template_name='index.html', >        

Re: Parse URLs to integers

2009-09-23 Thread Daniel Roseman
On Sep 23, 5:24 pm, IanSR wrote: > Is there some trick to parse > > http://www.example.com/foo/42 > > such that "42" becomes an integer parameter to the view function, > instead of a string? > > Right now I have to do: > > from my.app.views import foo > > urlpatterns = patterns('', > (r'foo/(

Re: Limiting queryset on ModelAdmin based on date field

2009-09-24 Thread Daniel Roseman
On Sep 24, 6:07 am, Alvaro Mouriño wrote: > Hi list. > > I'm developing a news application that handles articles, about 10 new > articles each day. The site administrator every morning selects from a > drop-down-list the ones that hit the front page. As time goes by this > list grows bigger and b

Re: Django templated: iterating through fields in a database record

2009-09-24 Thread Daniel Roseman
On Sep 24, 9:50 am, Paul Lundberg wrote: > Thanks, I think I will have to do that, I just thought that there > might be an easy way to do this that I missed! > > Paul Lundberg There's various information about fields in a model's ._meta class. For instance, Model._meta.fields will give you all

Re: is this a sane way to show total number of objects in pagination?

2009-09-25 Thread Daniel Roseman
On Sep 25, 9:08 am, Jani Tiainen wrote: > Chris Withers kirjoitti: > > > Brian McKeever wrote: > >> .count is definitely the way to go. Although, I would probably pass it > >> to your template instead of determining it there. > > > What difference does it make? > > len(qs) evaluates queryset - th

Re: Django 1.0 cannot handle ManyToOne inheritance in two apps

2009-09-25 Thread Daniel Roseman
On Sep 25, 3:30 am, luciferleo wrote: > Hi, I am using Django 1.0 > Suppose I have two models in one file: > > class BaseModel(models.Model): >     # attrs >     creator = models.ForeignKey('User', related_name='%(class) > s_creator_set') > > class User(BaseModel): >     # attrs > > That's perfec

Re: starting a new site with django

2009-09-26 Thread Daniel Roseman
On Sep 25, 11:30 pm, Ronen Gal wrote: > Hi, > > I would like to build a website which sells videos (music lessons). > The site would include ~50 videos, 150MB each. > I need some kind of shopping cart, and the ability to recieve payment. > I also need user accounts, so I can learn my users flavou

Re: django-trunk/django directory problem

2009-09-27 Thread Daniel Roseman
On Sep 27, 4:48 am, Malcolm MacKinnon wrote: > Thanks, but I don't understand. Will removal cause problems with django > project/app on python path. It's simlinked to the python site-packages. > The file 'django' inside your django-trunk/django directory is actually a symlink to the parent direc

Re: admin list_display

2009-09-27 Thread Daniel Roseman
On Sep 26, 12:53 pm, paulh wrote: > Using the admin list_display and a callable with its allow_tags > property set to True you can plant a link for each object on the > changle_list display page of the admin. Is there some way of making > this link dynamic without having to extend the > ModelAdmi

Re: Exiting view to continue urls.py

2009-09-29 Thread Daniel Roseman
On Sep 29, 2:04 pm, sunn wrote: > Dear Django users, > > I am trying to create a simple redirect app (useful when rewriting a > page that was previously not written in Django or when switching > domains). > > The app would just collect all URLs not found so I put it at the end > of urls.py > > (r

Re: Subclassing a model to change field attributes?

2009-09-29 Thread Daniel Roseman
On Sep 29, 6:53 pm, ringemup wrote: > I have two models that are essentially identical except that for one > of them a couple of the fields can be blank/null that are required in > the other.  It seems silly to maintain two full implementations in > parallel, so I'd like to just make one model a

Re: FF3 src error in django admin calendar

2009-09-30 Thread Daniel Roseman
On Sep 29, 11:45 pm, Ron W wrote: > I've been getting thrown 500 errors from someone using the admin from > what looks like Mac Firefox 3.5 with the Huffington Post's Firefox > extension (why on earth..), but its looking for /img/admin/ > icon_calendar.gif/ which isn't from TinyMCE its the Django

Re: Send a parameter from a template to another template

2009-09-30 Thread Daniel Roseman
On Sep 30, 11:23 am, NMarcu wrote: > Hello, > >    I need to send a value from a template to another template. > In my first template I have something like this: > td>Edit > The result will be: "/edit/admin" > I need to use the value: "admin" in another template. > I have in my urls.py: > >  url(

<    3   4   5   6   7   8   9   10   11   12   >