Re: Newbie - question - Django Tutorials 2

2009-08-15 Thread Daniel Roseman
On Aug 15, 11:22 am, salai wrote: > Dear Léon, > > Thankyou. > > hmm.. It is strange.! ( indentation error)! > >  But, after restarting the server, my Polls APP is not in admin area >  loaded. It always happened, when I got an error message. > >  many thanks in advance, > >  regards, >  koko Thi

Re: Is there a way to combine ifequal with ifequal/if?

2009-08-15 Thread Daniel Roseman
On Aug 15, 11:21 am, realfun wrote: > Sigh, seems not better way, sometimes it's ugly also to put them on the > views.py - A/B/C could be the attribute of an element among a list of > elements. Say, A is x.A, B is y.B, C is z.C, then you need to create a tuple > for them on views side, and thus m

Re: ModelForm's is_valid() returns False, but I don't know why.

2009-08-15 Thread Daniel Roseman
On Aug 15, 2:54 am, George Laskowsky wrote: > I have the following code (simplified): > > # models.py > > class Historico(models.Model): >      fechaCreacion =     models.DateTimeField(auto_now_add=True) >      fechaModificacion = models.DateTimeField(auto_now=True) > >     class Meta: >        

Re: How to tidy up data returned by raw sql has u'blahblah'

2009-08-15 Thread Daniel Roseman
On Aug 15, 3:16 pm, adelaide_mike wrote: > OK, and thanks.  I asked the wrong question in that case.  The correct > question might be how do I transfer the data in the returned rows, > which is several columns from various tables, into distinct fields on > a rendered page?  I am assuming that thi

Re: Django in Vista

2009-08-15 Thread Daniel Roseman
On Aug 15, 4:05 pm, Thiago511 wrote: > Hi guys, I am trying to start a Django project in Vista(I am not even > sure I know how to start one!) > here is what I try to do: > > I don't think I even activated Django-admin > > How would I go about doing that? > > The Django website tells me to add dja

Re: are model field choices enumerated in the db?

2009-08-16 Thread Daniel Roseman
On Aug 17, 6:28 am, cerberos wrote: > when the choices attribure is used for a model field are the choices > enumerated in the database? No. -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou

Re: How to extend Auth/User in admin view?

2009-08-17 Thread Daniel Roseman
On Aug 17, 8:06 am, Léon Dignòn wrote: > Hello, > > I use an extended User Model and like to display these fields in the > admin view at Auth/User. Can anybody show me how this works? > > Thanks > > -LD Create your own admin class for your extended User model, inheriting from the one in contrib.

Re: model get_absolute_url strange behaviour

2009-08-18 Thread Daniel Roseman
On Aug 18, 11:08 am, andreas schmid wrote: > hi to all, > > i have a weird problem with my urls. > > my model has a get_absolute_url like this: >    * def get_absolute_url(self): >         return "%s/%s/" %  (self.pub_date.strftime("%Y"), self.slug )* > > and the url conf is this one: >  *(r'^(?P

Re: Get results from query depending on another query

2009-08-18 Thread Daniel Roseman
On Aug 18, 8:28 pm, Chris McComas wrote: > I have a model that has a FK to django.contrib.auth.models Group. I > run a query that gets all the groups that a user is a member of: > > groups = Group.objects.filter(user=request.user) > > Then I want to run a query for that model that gets and entrie

Re: How do you remove a manytomany relationship in django?

2009-08-18 Thread Daniel Roseman
On Aug 18, 9:49 pm, Ray wrote: > I know in the backend, a manytomany relationship is essentially a join > table, but there seems to be no easy way to delete relationships from > it. The only remove option is made only for ForeignKey relationships. > Is there a workaround? Why would django design

Re: How do you remove a manytomany relationship in django?

2009-08-18 Thread Daniel Roseman
On Aug 18, 9:49 pm, Ray wrote: > I know in the backend, a manytomany relationship is essentially a join > table, but there seems to be no easy way to delete relationships from > it. The only remove option is made only for ForeignKey relationships. > Is there a workaround? Why would django design

Re: template syntax

2009-08-19 Thread Daniel Roseman
On Aug 19, 8:55 am, elminio wrote: > You don't understand me. > WQhat I want to achieve is to use student.id as a key in dictionary > (Im talking abous template) > If I use: > > {% for student in students %} > > ... do sth ... > > {{dictionary.student.id }} > > {% endfor %} > > using dictionary

Re: how to access ForeignKey models properties?

2009-08-19 Thread Daniel Roseman
On Aug 18, 10:48 pm, onoxo wrote: > this is my model.py: > > class Event(models.Model): >     title = models.CharField('Event Name', max_length=300) >     photo_set = models.ForeignKey(PhotoSet, blank=True, null=True) > > class PhotoSet(models.Model): >     title = models.CharField(max_length=300

Re: save a form

2009-08-19 Thread Daniel Roseman
On Aug 19, 3:21 pm, luca72 wrote: > Hello i have a POST form (not modelform) how i can save the data in > the db, and if i need to change the data before the save how i can do? > > Thanks If it's not a modelform, what does it mean to save it in the database? It's not associated with any model, b

Re: That model works on doctests but...

2009-08-19 Thread Daniel Roseman
On Aug 19, 4:14 pm, Mirat Bayrak wrote: > http://dpaste.com/82737/< here is models.py , as you see i wrote > doctests for every model and they are working well. But when i try to > create GeneralProperties or AccomodationProperties from admin page, > when i press save button it gives that error :

Re: save a form

2009-08-19 Thread Daniel Roseman
On Aug 19, 3:40 pm, luca72 wrote: > Iis but form.save don't work > That's true. -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegr

Re: How do you remove a manytomany relationship in django?

2009-08-19 Thread Daniel Roseman
On Aug 19, 10:09 pm, Ray wrote: > Hi, > thanks for the fast response! I'm trying to use the remove function > right now just like this sample code: > > # And from the other end>>> p2.article_set.remove(a5) > >>> p2.article_set.all() > [] > >>> a5.publications.all() > > [] > > fromhttp://www.djang

Re: model.save() is correct?

2009-08-20 Thread Daniel Roseman
On Aug 20, 10:37 am, luca72 wrote: > Hello i have made this it works, but i'm sure that there is a short > way to obtain the same result can you tell me how? > > def richiedi(request): >     if request.method == 'POST': >         form = RichiestaForm(request.POST) >         if form.is_valid(): >

Re: model.save() is correct?

2009-08-20 Thread Daniel Roseman
On Aug 20, 1:13 pm, luca72 wrote: > I don't use a modelform because one folder of my form is a > ChoiceField. > Regards > > Luca That really doesn't answer the question. If you want to override a field in a modelform, you can just do so, as is well documented here: http://docs.djangoproject.com/

Re: Multiple template inheritance

2009-08-21 Thread Daniel Roseman
On Aug 21, 12:26 am, Rom wrote: > Hi, > > I'm building a website using app engine. > > I would like to use multiple inheritance but I'm not allow to put > block inside a block. > Here is piece of code which should describe the problem well: > > let's assume a .html file called meta_base.html: > >

Re: Weird reflex in django models when assigning model attribute

2009-08-21 Thread Daniel Roseman
On Aug 21, 2:49 pm, Glenbot wrote: > I ran into something weird in Django and i'm completely stumped. I got > it to work but i'm trying to understand the logic behind it. > > I have the following data model: > > from django.db import models > > class Setting(models.Model): >     name  = models.Ch

Re: Why can't I pass id/key to an object_list? please help

2009-08-21 Thread Daniel Roseman
On Aug 21, 3:15 pm, justin jools wrote: > I'm trying to pass id/key from one list then filter the next. > If I try: > > def show_make(request, key): >     return object_list(request, Product_Model.all(), key) > > I get: > > invalid literal for float(): > agphZXAtc2FtcGxlchgLEhJteWFwcF9wcm9kdWN0X2

Re: newbie help: how to list, list, detail

2009-08-22 Thread Daniel Roseman
On Aug 22, 6:08 pm, justin jools wrote: > how can I show a list then pass the id to next list lookup then > detail? > > basically I'm writing a car product database with make, type and model > tables: > > so first list is Audi, BMW, Ford... the next list is e.g. Audi models: > T100, Quattro, then

Re: Another (hopefully) simple question

2009-08-22 Thread Daniel Roseman
On Aug 22, 6:55 pm, Robb Bossley wrote: > I have one more question to ask of all of you Django gurus - I hope it is > simple, though I think I have pulled most of my hair out trying to get this > down in my mind > > I have a form that displays four lookup values.  I would like to append > these v

Re: newbie help: how to list, list, detail

2009-08-22 Thread Daniel Roseman
On Aug 22, 8:29 pm, justin jools wrote: > key is used in replacement of 'id' in Google app engine (patch) > Essentially this doesnt matter, assume it is id in normal django. > I would just like to know how to do a list, list, detail query. When I > pass the id from first list to query a second li

Re: Another (hopefully) simple question

2009-08-22 Thread Daniel Roseman
On Aug 22, 7:35 pm, Robb Bossley wrote: > Daniel, > > I appreciate the time you took to answer. > > I could do this, but I have a number of views that the user will have the > option of selecting on this resulting page, so I would have to keep passing > it as a GET variable on subsequent requests

Re: TypeError: execute() takes at most 3 arguments (4 given)

2009-08-23 Thread Daniel Roseman
On Aug 22, 9:14 pm, kevin wrote: > cursor.execute("SELECT a,b,c FROM Table_Name WHERE a = %s AND b = %s ", > [string1],[string2]) > > gives me the following error: > > TypeError: execute() takes at most 3 arguments (4 given) > > Where did i go wrong? You have got string1 and string2 in separate

Re: Custom field types and newforms admin

2009-08-23 Thread Daniel Roseman
On Aug 23, 3:44 pm, Hanpan wrote: > Hi, > > I have created a custom field type, which I am using like so: > > image_thumb = ImageWithThumbsField(_('preview image'), > upload_to='uploads/projects') > > But for some reason, when I run syncdb this custom field is being > completely ignored. I tried

Re: register() takes at most 3 arguments (4 given)

2009-08-24 Thread Daniel Roseman
On Aug 24, 12:51 pm, Gungor wrote: > I have a  register() takes at most 3 arguments (4 given) problem with > these codes. > > from randevu.rts.models import Randevu > from django.contrib import admin > from datetime import datetime > > class Admin_Panel(admin.ModelAdmin): >         list_display=(

Re: register() takes at most 3 arguments (4 given)

2009-08-24 Thread Daniel Roseman
On Aug 24, 2:45 pm, Hotmail wrote: > On Pzt, 2009-08-24 at 06:17 -0700, Daniel Roseman wrote: > > > On Aug 24, 12:51 pm, Gungor wrote: > > > I have a  register() takes at most 3 arguments (4 given) problem with > > > these codes. > > > > from ra

Re: problem with u'' in template

2009-08-24 Thread Daniel Roseman
On Aug 24, 4:00 pm, Gustavo Henrique wrote: > Hi! > I'm sending unicode string for template page, whitin a javascript > code, and I have a problem with the char u before string value. > For example: > > > {{ string|safe }} -->// {'fieldLabel': u'Cliente', 'name': u'cliente', > 'value': u''} > >

Re: how to use form_class with generic views?

2009-08-24 Thread Daniel Roseman
On Aug 24, 4:26 pm, BobZ wrote: > I'm having a similar problem actually. > > I'm trying to extend Photologue to offer front-end user upload > capability with generic views and I haven't been able to successfully > render a page yet. > Each of the commented-out "upload_args" are variations I've tr

Re: Python/Django web programmer needed

2009-08-24 Thread Daniel Roseman
On Aug 24, 7:00 pm, Michael wrote: > I own a web based medical recertification company and we are looking > for a Python/Django web programmer to do some work for us.  The site > is written in Python using Django 1.0. We need to switch from using > Paypal to Authorize.net and would like to add co

Re: how to use form_class with generic views?

2009-08-24 Thread Daniel Roseman
On Aug 24, 5:06 pm, BobZ wrote: > The real brain buster is that I get this error whether I'm passing a > form_class or a simple Model in urls.py > > On Aug 24, 11:05 am, BobZ wrote: > > > > > Thanks for the quick response! > > > forms.py > > > from django import forms > > from django.forms impor

Re: Newbie - Model column arithmetic

2009-08-24 Thread Daniel Roseman
On Aug 24, 6:12 pm, Ken wrote: > Apologies if this is in an FAQ somewhere, but I've been unable to find > it... > > As a complete newcomer to Django (and Python, for that matter), I'd > like to present my users with an HTML table that contains columns a, b > and c from my table in the database, a

Re: marksafe

2009-08-25 Thread Daniel Roseman
On Aug 25, 2:07 pm, luca72 wrote: > Hello i have this: > errore = """ >                     { alert('test_js')}; >                     """ > return mark_safe(errore) > I get this error : AttributeError: 'SafeString' object has no > attribute 'status_code' > can you help me to write the correct on

Re: Change my model names - consequences?

2009-08-26 Thread Daniel Roseman
On Aug 26, 9:35 am, adelaide_mike wrote: > After adding a model to my Django 1.0.2 app I would like to change the > names of two models.  Will the syncdb take care of this for me?  I > anticipate I will need to change the table names in PostgreSQL. > > Any caveats?  Any hints?  TIA > > Mike No,

Re: the parameters of the self-defined tags

2009-08-26 Thread Daniel Roseman
On Aug 26, 6:55 am, Apple wrote: > hi , now I want to pass a parameter named user (user is a instance of > User) to the self_defined tags,could I do this ? I think the passed > parameter are all strings , is there a way to get its real type ? > thank you for your replying ! You can use the templ

Re: template tag response None. but why?

2009-08-26 Thread Daniel Roseman
On Aug 26, 12:44 am, MIL wrote: > Hi guys :o) > > Im attempting to create a template tag but I get a strange response. > it returns "None" where I put the {% if blog_detail %} tag > > Here is my template tag > > class BlogNode(Node): >         def __init__(self, user, varname): >                

Re: Coltrane application not appearing on the admin index page

2009-08-26 Thread Daniel Roseman
On Aug 26, 12:11 pm, Gath wrote: > Guys, > > Am going through the practical django book and am trying the weblog > application in Chapter 4, but when i go to test the application on my > cms application (that i created from the same book, from Chapter 2 & > 3) "coltrane" application does not appe

Re: template tag response None. but why?

2009-08-26 Thread Daniel Roseman
On Aug 26, 1:51 pm, MIL wrote: > Okay. Seems logic. But Im not sure what I should do. > > So what would you do? > > Thanks Add return "" at the end of your render() method. -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

Re: Forms for views

2009-08-26 Thread Daniel Roseman
On Aug 26, 4:14 pm, gentlestone wrote: > I'm looking for a support for viewing models in templates. > > Forms is a nice support but it is made for editing objects, not for > viewing objects. I found some attemps on the internet, like using > forms with ReadOnlyWidgets, but I thing it is not the w

Re: Generating slugs

2009-08-27 Thread Daniel Roseman
On Aug 27, 2:55 pm, RubenK wrote: > I've setup my 'prepopulate_fields' so that it should automatically > enter a slug in the admin site, however when I click the 'add' link > it gives me the following error: > > "Key 'slug' not found in Form" > > I've triple checked all my models and database tab

Re: invalid template tag

2009-08-27 Thread Daniel Roseman
On Aug 27, 8:03 pm, nixon66 wrote: > I've just created a template tag as described in the documents, but > keep getting errors. > > In an installed app I created a directory called Templatetags. I > created a blank __init__.py file and a file called mytag. Is the file called just 'mytag' or (as

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 logical to spend time sending th

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, the site sends a confirma

Re: Problem subclassing Widget with value_from_datadict

2009-08-31 Thread Daniel Roseman
On Aug 30, 8:59 pm, Mike Ramirez wrote: > hey, >   I'm trying to write a recaptcha widget using the recaptcha client, the > problem I'm having is that redefining value_from_datadict I get this > error: 'ContactForm' object has no attribute named 'get'.  This happens on > the initial loading of th

Re: Blocks tags inside inclusion template tags are ignored

2009-08-31 Thread Daniel Roseman
On Aug 31, 4:56 am, ips006 wrote: > Is it possible to have block tags inside inclusion template tags > overwrite the block tags in parent templates? > > I have a chunk of html generated by an inclusion tag, and I would like > to assign a CSS file with it. I would like to be able to append to an >

Re: Problem subclassing Widget with value_from_datadict

2009-08-31 Thread Daniel Roseman
On Aug 31, 11:58 am, Mike Ramirez wrote: > On Monday 31 August 2009 02:46:27 am Daniel Roseman wrote: > > > I think you're going to need to post your view code as well. It seems > > that the form is passing itself, rather than its data, to the widget, > > so I&#x

Re: Install going well but problem with syncdb

2009-08-31 Thread Daniel Roseman
On Aug 31, 10:14 pm, Franck Y wrote: > Hello > I had the install going pretty well but when i do > python manage.py syncdb > > i got this error message > > python manage.py syncdb > Traceback (most recent call last): >   File "manage.py", line 11, in ? >     execute_manager(settings) ... >     ra

Re: ValueError: invalid literal for int() with base 10: '42596/img/admin/icon_calendar.gif'

2009-09-01 Thread Daniel Roseman
On Sep 1, 10:35 am, ANIL KARADAĞ wrote: > hello everbody, > > i have en error for a week. i did not resolve and i did not find it's > solution. > > Sometimes system is sent an error: > > File "/usr/lib/python2.5/site-packages/django/db/models/fields/__init__.py", > line 353, in get_db_prep_value

Re: ValueError: invalid literal for int() with base 10: '42596/img/admin/icon_calendar.gif'

2009-09-01 Thread Daniel Roseman
On Sep 1, 12:17 pm, ANIL KARADAĞ wrote: > 2009/9/1 Daniel Roseman > > > On Sep 1, 10:35 am, ANIL KARADAĞ wrote: > > > hello everbody, > > > > i have en error for a week. i did not resolve and i did not find it's > > > solution. > > > >

Re: Custom form validation request or user-based

2009-09-02 Thread Daniel Roseman
On Sep 2, 10:59 am, Matthias Kestenholz wrote: > On Wed, Sep 2, 2009 at 10:38 AM, Enrico > > Sartorello wrote: > >> if you need this only for the administration site you'd hvae other > >> hooks that you could override. Either take a look at the documentation > >> or at django/contrib/admin/option

Re: Naive redirection programming question

2009-09-02 Thread Daniel Roseman
On Sep 3, 3:36 am, Rodney Topor wrote: > Suppose you've just processed posted form data and successfully added > a new item to the database.  Now you return HttpResponseRedirect('/ > items/') (I know, you should use a pattern name not an absolute URL > here) to display the list of items, includin

Re: Template tag for getting CSS/scripts/images

2009-09-06 Thread Daniel Roseman
On Sep 6, 5:51 am, Wiiboy wrote: > I'm considering making a custom template tag that returns a url to a > css file or image file. > > In your opinion, is it a waste of time? Not at all. This is a great way to remove dependencies on hard-coded locations, and makes it easy to move from development

Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Daniel Roseman
On Sep 6, 8:39 am, Joshua Partogi wrote: > Dear all, > > I have a model that has a foreign e.g > > class Foo(models.Model): >   bar = models.ForeignKey(Bar) > > class Bar(models.Model): >   name = models.CharField(max_length=50) > > This is my FooAdmin: > class FooAdmin(admin.ModelAdmin): >   lis

Re: QuerySet method question

2009-09-06 Thread Daniel Roseman
On Sep 6, 7:08 pm, Larry wrote: > Hi everyone, > > I have the following three models: User, Item, User_Item, which are > defined as follows > > def User(models.Model): >     id = models.CharField(primary_key=True) > > def Item(models.Model): >     id = models.CharField(primary_key=True) > > def U

Re: Django for windows XP

2009-09-06 Thread Daniel Roseman
On Sep 7, 5:30 am, vaidyanathan venkataraman wrote: > Hi, > >         I am not able to locate  a Django package to be downloaded for > Windows XP. > > Can anyone please help me in this endeavour? > > --vaidya You don't need one - Django doesn't include any operating system specific code. Just fo

Re: Django windows service

2009-09-06 Thread Daniel Roseman
On Sep 6, 9:16 pm, cootetom wrote: > Hi, > > I'm looking to try and run some python code that has complete access > to the django framework and some existing app models that I have in a > project as a windows service. I have an app that allows a user to set > up an email that should send sometime

Re: formatting dates for DateTimeField()

2009-09-08 Thread Daniel Roseman
On Sep 8, 10:26 am, Gonzillaaa wrote: > Hello I'm importing data into django and using its admin interface to > browse and search for data. > > Each piece of data is timestamped by me at log time. The docs say data > on a DateTimeField() should be a valid datetime.datetime object but I > am uncle

Re: total newb question with custom save()

2009-09-08 Thread Daniel Roseman
On Sep 8, 7:56 pm, Matt wrote: > hey folks, > > I have two models: > ___ > class contentcreator(models.Model): >     name = models.CharField(max_length=50) >     phone = models.CharField(max_length=60, blank=True) >     supervisor = models.CharF

Re: custom methods

2009-09-08 Thread Daniel Roseman
On Sep 8, 7:29 pm, Slammer wrote: > FYI, I'm a beginner,  I'm having trouble with custom methods,  I'm > using an existing database which is used for a fantasy football > site,   the primary data return is a list of players for a particular > team, I've done that fine, but the score for those pla

Re: Trying to get tinyMCE working on an admin page

2009-09-08 Thread Daniel Roseman
On Sep 8, 9:14 pm, DrKen wrote: > Hi, new to Django and tinyMCE. I'm trying to get the tinyMCE HTML > editor working on the admin page, so started out by doing the Django > tutorial, then attempting to modify. I've got the admin page working > with text fields instead of character fields, but don

Re: How to display and update selected fields from a model

2009-09-09 Thread Daniel Roseman
On Sep 9, 7:10 am, Jim Myers wrote: > I have a database model with many fields, some of which I don't want > displayed in a form and others I don't want to be editable.  Is it > possible to do this with a ModelForm?  Or is it even possible with > regular forms? > > Furthermore, I only want the SQ

Re: breadcrumb solution

2009-09-09 Thread Daniel Roseman
On Sep 9, 7:32 am, Mike Dewhirst wrote: > I would like to get breadcrumbs working in a simple way. Could anyone > please help? > > I think I need a singleton with a dict like this ... > > bread = singleton() > > bread.dct['last_title'] = > > Within each view and before doing anything else I want

Re: formatting dates for DateTimeField()

2009-09-09 Thread Daniel Roseman
On Sep 9, 9:21 am, Gonzalo wrote: > How would you store that into the database, what type of field on the > model I mean? should I store the number of seconds + number of days in > seconds? or the datetime.timedelta() object? > > Thanks You can't store a timedelta object in a database. And annoy

Re: Date Field in ModelForm

2009-09-09 Thread Daniel Roseman
On Sep 9, 11:49 am, mettwoch wrote: > Hi, > > I don't understand why the following code produces an error (see > below): > > > > >>> from django import forms > >>> from ishop.bo.models import Document > >>> d = Document.objects.get(pk=8) > >>> print d.date_due > 2009-08-28 > >>> class df(form

Re: Custom template tags

2009-09-09 Thread Daniel Roseman
On Sep 9, 4:00 pm, tdelam wrote: > Hey, > > I would like to know if I should write a custom template tag or if > anyone can give me some direction on how to do the following: > > 1) User visits a page on a web site, example.org/campaign/businessname > 2) I capture "businessname" and fetch the det

Re: foreign key not generated when pointing to a model in another application

2009-09-09 Thread Daniel Roseman
On Sep 9, 5:29 pm, jim wrote: > Am using sqlite3 and django version 1.0 > > class U(models.Model): >     woid = models.ForeignKey('workorder.X') > > In the workorder app I have: > > class X(models.Model): >     woid = models.CharField(max_length=20, primary_key=True) > > When I try : > > python m

Re: retrieving models without importing

2009-09-10 Thread Daniel Roseman
On Sep 10, 7:16 am, nbv4 wrote: > I remember reading about away to use django models without importing, > but google fails me. I want to create a ForeignKey relation to another > model, but I can't import it because that will call an endless loop of > imports. > > I know about doing: > > field =

Re: Template language into JS file

2009-03-25 Thread Daniel Roseman
On Mar 25, 10:45 am, Oumayrita wrote: > Hello Friends, > I have a  drop-down menu for navigation like this > on:http://www.softcomplex.com/products/tigra_menu/ > I need to display dynamically the list of Products Demo from the data > base. > So I need to know how return var to js file?? > And ho

Re: Error when posting a comment

2009-03-25 Thread Daniel Roseman
On Mar 24, 8:58 pm, Tonu Mikk wrote: > I posted this on djangothreadedcomments list some days ago, but did not > get a response.  Perhaps django users can help me out? > > Hello, I am attempting to get threaded comments to work on a shared > bookmarking application.  It seems that I am almost the

Re: Dynamic on-action update form

2009-03-28 Thread Daniel Roseman
On Mar 28, 1:44 pm, Nizan Freedman wrote: > is it possible to make a Django form that hides\shows different fields > by other fields changing? If you write some Javascript, yes. -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: Problem with Field errors

2009-03-28 Thread Daniel Roseman
On Mar 28, 4:14 pm, Jack Orenstein wrote: > My application needs to validate data from a from beyond the   > validation of Fields done by django. So in my form handler, I check   > Form.is_valid, and if that returns true, then I do my own validation.   > In case of errors, I attach an error messa

Re: First Django project - Admin question

2009-03-30 Thread Daniel Roseman
On Mar 30, 10:43 am, PhilE wrote: > Hi All: > > My first Django project is an app to manage a repository of > downloadable software. Individual downloads have a category > (multimedia, internet, office, etc, etc) assigned to them. Releases of > the repository are made at regular intervals and a c

Re: iterating over fields of a model

2009-03-31 Thread Daniel Roseman
On Mar 31, 4:54 pm, Filip Gruszczyński wrote: > I have a user profile class and I would like to iterate over all > defined fields and retrieve their values. For example if I had: > > class UserProfile: >   first_name = CharField(.. >   last_name = CharFiel(.. > > etc. > > I would like to get name

Re: testing with a mock object

2009-03-31 Thread Daniel Roseman
On Mar 31, 7:39 pm, belred wrote: > i have a questions about mock objects.  i currently have a django view > function that calls a 2nd function.  this second function calls > urllib2.urlopen.   i was thinking about adding in a mock object so i > can get some better code coverage in the 2nd functi

Re: Sessions living through HttpResponseRedirect

2009-03-31 Thread Daniel Roseman
On Apr 1, 3:47 am, Joshua K wrote: > Howdy Folks, > > How do I get a session to live through a HttpResponseRedirect?  For > example: > >         form = clientFormCreate(request.POST) >         if form.is_valid(): >             newClient = form.save() >             request.sesson['current_client']

Re: Overriding ModelForm

2009-04-01 Thread Daniel Roseman
On Apr 1, 8:35 am, MrBodjangles wrote: > Hi All, > I know this is something very basic (perhaps even a typo), but the > code below gives an error: > > "    password = models.CharField(widget=PasswordInput()) > TypeError: __init__() got an unexpected keyword argument 'widget' > " > > ( This should

Re: forming email body

2009-04-02 Thread Daniel Roseman
On Apr 2, 2:58 am, Joey Gartin wrote: > Newbie question: > > In a view I am sending out a few emails to users.  The email format is > identical for each user, with the users information being dynamic. > > My question is regarding forming a long email and using it as the body over > and over (in a

Re: Django Tutorial, Part 3

2009-04-02 Thread Daniel Roseman
On Apr 2, 8:35 am, rorocam wrote: > Hello …, > > I have problems with the „Decoupling the URLconfs”. I did, as Django > Tutorial (Part 3) shows me, but it does not work, the browser shows > following error: > > > ImportError at /polls/ > > Import by filename is not supported. > > What is wrong wi

Re: Unique Field Combinations

2009-04-04 Thread Daniel Roseman
On Apr 4, 2:06 pm, Chris wrote: > How would you enforce a unique column constraint on a combination of > fields? > > For example, say I have the model: > > class Company(models.Model): >     name = models.CharField(unique=True) > > class Article(models.Model): >     company = models.ForeignKey(Co

Re: Getting id of item before it recorded (or something else to solve my problem)

2009-04-05 Thread Daniel Roseman
On Apr 5, 11:38 am, MiratCanBayrak wrote: > here, i have a function that used as a upload_to parameter in my > model. But i records my pic as screenshot_None.gif. Becouse id is > appearing when it is recorded. How can i record my images as > screenshot_id.gif ?? thanks for your response > > from

Re: Problem with adding new columns to existing model.

2009-04-05 Thread Daniel Roseman
On Apr 5, 11:26 am, zayatzz wrote: > Hello > > After finishing tutorial im trying to do something for myself. I > created one model and proceeded to create another ones, but then i > realised that i could just add few additional columns to existing > model, but for some reason they dont end up in

Re: Why is mod_python the preferred setup for Django?

2009-04-05 Thread Daniel Roseman
On Apr 5, 12:22 pm, Continuation wrote: > According to > thishttp://docs.djangoproject.com/en/1.0/howto/deployment/modpython/ > "Apache with mod_python currently is the preferred setup for using > Django on a production server." > > What is the advantage of mod_python over mod_wsgi and mod_fcgi?

Re: How can I filter query sets in a django template?

2009-04-05 Thread Daniel Roseman
On Apr 5, 8:49 pm, codecowboy wrote: > I posted a question earlier today about circular imports (http:// > groups.google.com/group/django-users/t/6119e979131c8c25).  I now have > a follow question to that.  I've got the following view logic. > > def portal(request): >     scientist_id = 1 >     s

Re: Deploying django application

2009-04-05 Thread Daniel Roseman
On Apr 5, 10:04 pm, Oleg Oltar wrote: > Hi! > > I am trying to serve my project using server-spawned processes > > I created file .htaccess in my web_root directory which contains: > AddHandler fastcgi-script .fcgi > RewriteEngine On > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^(.*)$ mysi

Re: Django Template Question

2009-04-06 Thread Daniel Roseman
On Apr 6, 6:38 am, codingJoe wrote: > Up front, I'm not the most elegant coder, so please forgive. > >   I have a page that is produced using django templates.   I used the > templates to do the header and footer, but now I'm down into the body > of the page.   Using the data from my template, I

Re: Stuck in Tutorial Part 2: can't find django/contrib/admin/templates

2009-04-07 Thread Daniel Roseman
On Apr 7, 7:42 pm, "ab3...@gmail.com" wrote: > I'm working through the tutorial and got stuck near the end of part 2. > It says: > > "Now copy the template admin/base_site.html from within the default > Django admin template directory (django/contrib/admin/templates) into > an admin subdirectory

Re: Does anyone know how to prepopulate a form with model data

2009-04-09 Thread Daniel Roseman
On Apr 9, 2:55 am, codecowboy wrote: > I want to create a form that allows a user to edit his/her profile.  I > don't want to bind my form to a model because the form will involve > two different models.  Does anyone have any ideas.  I've read chapter > 7 in the Django Book but it only to a simpl

Re: Problem setting up Admin site per chapter 6

2009-04-09 Thread Daniel Roseman
On Apr 9, 1:02 pm, Xpineapple wrote: > Thanks for the reply.  Again, my goal is just to access admin site > successfully. > > Okay, referencing:http://www.djangobook.com/en/1.0/chapter06/ > > My urls.py: > > from django.conf.urls.defaults import * > # Uncomment the next two lines to enable the ad

Re: Running Django admin site using Lighttpd

2009-04-09 Thread Daniel Roseman
On Apr 9, 3:35 pm, Karim Hamdan wrote: > Let me rephrase my question. I followed > thisHowTo > on this group that describes how to run Django using lighty with fcgi, > I can access my project website successfully but I fail

Re: Registration form and Profile form is not saving

2009-04-11 Thread Daniel Roseman
On Apr 11, 3:55 pm, Praveen wrote: > Hi all, i am really fed up and have tried number of way. Please read > my last line which really describe where i am facing problem. > First Attempt. > Problem:Data is saving for register and contact but for profile i get > error > ValueError > Exception Va

Re: Cannot call a custom model method in my view

2009-04-11 Thread Daniel Roseman
On Apr 11, 9:25 pm, codecowboy wrote: > I've read some other posts regarding this issue as well as the > following article:http://www.b-list.org/weblog/2007/nov/03/working-models/. > I cannot seem to get this thing to work.  Thank you in advance for any > help.  Here is my code. > > -- vi

Re: Django admin page hangs in django server - where is web server error log?

2009-04-11 Thread Daniel Roseman
On Apr 11, 8:42 pm, adelein wrote: > Hi, > > Myhttp://localhost:8000/adminpage is hanging in the django server > and I get "Error 320 (net::ERR_INVALID_RESPONSE): Unknown error." > after a while. > > I am running on fedora 7. > > I am following the django tutorial and I am using the latest svn >

Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Daniel Roseman
On Apr 11, 7:57 pm, codecowboy wrote: > Every time that a load a form on my site, I see the following errors. > If I reload the page, they go away and everything works just fine. > Does anyone know why?  Thank you in advance. > > TemplateSyntaxError at /eaccounts/register/ > > Caught an exception

Re: Cannot call a custom model method in my view

2009-04-13 Thread Daniel Roseman
On Apr 11, 11:10 pm, codecowboy wrote: > Thank you Daniel.  I got it working.  That link that you gave me > helped me to figure it out.  I'm curious though, is there ever a > reason in Django to define a method in a model class or would I always > use a custom manager method? It's frequently use

Re: Registration form and Profile form is not saving

2009-04-13 Thread Daniel Roseman
On Apr 13, 5:57 am, Praveen wrote: > How the current user logging-in first while registration.. you mean to > say after successfully registration the user must login automatically. Well, you haven't explained the user flow at all here. But I assume that it's the RegistrationForm that's doing the

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-13 Thread Daniel Roseman
On Apr 13, 7:25 pm, gordyt wrote: > Howdy Folks, > > I have been testing model inheritance using models that have UUIDField > primary keys.  It appears that when you save a new instance of a child > model, the framework is not calling get_db_prep_value() to convert the > UUIDField to a proper for

Re: textarea in ModelForm

2009-04-14 Thread Daniel Roseman
On Apr 14, 8:51 pm, grimmus wrote: > Thanks for the reply Alex, > > I am not really sure how i am supposed to override the default field > type. > > The link talks about MyDateFormField() but is this a method or what ? > > Could you provide an example of how i could put the form field on the > fo

<    1   2   3   4   5   6   7   8   9   10   >