Add db tables on-the-fly
Hi, It is a method to add tables to a model without having to manually launch the syncdb command in a shell? If yes can you give me tips ? else :-( thank you for your helps ! MickaelC --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Book translation (es) finished
Manuel: En el ticket #54 me preguntan: "Marcelo, ¿Tenes todavía presente en cuál/cuales capítulos encontraste esto que nos reportas?." Contestales que yo lo empecé a ver en el Capítulo 4. No sé si después habrá más casos, pero calculo que sí. Marcelo Barbero --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to validate for duplicate users?
ok, just wanted to make sure it wasn't something that User.save() or whatever would for me. I thought since User defines 'username' and sets it as unique, then it would validate that and possibly raise an Error for clients (like Forms) to catch. I'll impl that in my subclasses form. Thanks. On Sun, Jun 22, 2008 at 4:24 PM, chefsmart <[EMAIL PROTECTED]> wrote: > > Override the default save method of the model. In you custom method, > do User.objects.get(username=desired_username). If a user does not > exist, you will get an ObjectDoesNotExist exception. Create the user > _if_ you get the exception. > > On Jun 22, 8:24 am, ristretto.rb <[EMAIL PROTECTED]> wrote: >> I have a form like this >> >> What is the best way to validate for an already existing User when >> using the django.contrib.auth.models.User and the new forms >> authentication system? >> >> Overiding Form.clean(), and adding some uniqueness validation code >> works, but binds the form to the DB. There's not much way around >> that, I'm guessing. But is there a better approach? >> >> Details to question below--> >> >> class NewAccountForm(forms.Form): >> username = forms.EmailField() >> password = forms.CharField(widget=forms.PasswordInput) >> >> I have it all working fine from a view like this >> >> from django.contrib.auth.models import User >> import logging as log >> >> def create_account(request): >> if request.method == 'GET': >> form = NewAccountForm() >> elif request.method == 'POST': >> form = NewAccountForm(request.POST) >> if form.is_valid(): >> data = form.cleaned_data >> log.debug("\n".join(["%s=%s" % (k,v) for k,v in data.items()])) >> # Create the account >> user = User(username=data['username'], >> email=data['username'], password=data['password']) >> user.save() >> return render_to_response('registration/login.html', {}, >> context_instance=RequestContext(request) ) >> >> # Either initial GET or Validation errors - return to account page >> return render_to_response('registration/createaccount.html', >> {'form': form }, context_instance=RequestContext(request) ) >> >> When I try to create a user that already exists (username exists in >> the DB), I get this error >> >> IntegrityError at /accounts/createaccount/ >> (1062, "Duplicate entry '[EMAIL PROTECTED]' for key 2") > > --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
auth context processor setup
Hello, Is there anything I need to do to enable the auth context processor other than adding "django.core.context_processors.auth" to TEMPLATE_CONTEXT_PROCESSORS in my settings.py? I'd like to be able to access the 'auth user' object in my various templates, which from what I understand this processor is supposed to be injecting it, but it doesn't seem to be working. my settings.py file contains: TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", ) and in my template I'm using: {{user}} Is there anything else I need to get this to work? Any suggestions? -Matt --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: help - limit_choices_to
On Sat, Jun 21, 2008 at 9:23 PM, M.Ganesh <[EMAIL PROTECTED]> wrote: > > Hi All, > > This question might have been answered so may times, but I am unable to > glean the information I am looking for from the 260 odd entries that > turn up while searching the mailing-list archives. So here I ask again > > #my models > class entity(models.Model): >name = models.Charfield() > > class address(models.Model): >entity = models.FK(entity) #entites can > have multiple addresses >street_address = models.TextField(...) > > class despatch(models.Model): >sent_to = models.FK(entity, related_name = 'receiver') >address = models.FK(address) >sent_by = models.FK(entity, related_name = 'sender') > > Now when I show a form to enter 'despatch' data, after the user selects > the sent_to 'sent_to' address, I want to show only the addresses of that > entity in the 'address' selection. How do I do it? > > Note : I don't know java scripts, AJAX etc yet. If the above can be > achieved only using these, then a small code snippet will help me > start > I have not had to do this myself, so have no code snippet to share. It does seem like a commonly-discussed thing, but in a quick Google search I didn't find anything that matched exactly. This page: http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/ discusses doing exactly what you want with jQuery and Ajax...and PHP. So not quite what you are looking for. But this page: http://www.packtpub.com/article/enhancing-the-user-interface-with-ajax discusses adding jQuery to a Django app and doing other cool stuff with it. So probably you can glean bits of information from both and put it together to do what you are looking for. I do believe you need to learn a little Javascript/Ajax to do this. Karen --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to validate for duplicate users?
Override the default save method of the model. In you custom method, do User.objects.get(username=desired_username). If a user does not exist, you will get an ObjectDoesNotExist exception. Create the user _if_ you get the exception. On Jun 22, 8:24 am, ristretto.rb <[EMAIL PROTECTED]> wrote: > I have a form like this > > What is the best way to validate for an already existing User when > using the django.contrib.auth.models.User and the new forms > authentication system? > > Overiding Form.clean(), and adding some uniqueness validation code > works, but binds the form to the DB. There's not much way around > that, I'm guessing. But is there a better approach? > > Details to question below--> > > class NewAccountForm(forms.Form): > username = forms.EmailField() > password = forms.CharField(widget=forms.PasswordInput) > > I have it all working fine from a view like this > > from django.contrib.auth.models import User > import logging as log > > def create_account(request): > if request.method == 'GET': > form = NewAccountForm() > elif request.method == 'POST': > form = NewAccountForm(request.POST) > if form.is_valid(): > data = form.cleaned_data > log.debug("\n".join(["%s=%s" % (k,v) for k,v in data.items()])) > # Create the account > user = User(username=data['username'], > email=data['username'], password=data['password']) > user.save() > return render_to_response('registration/login.html', {}, > context_instance=RequestContext(request) ) > > # Either initial GET or Validation errors - return to account page > return render_to_response('registration/createaccount.html', > {'form': form }, context_instance=RequestContext(request) ) > > When I try to create a user that already exists (username exists in > the DB), I get this error > > IntegrityError at /accounts/createaccount/ > (1062, "Duplicate entry '[EMAIL PROTECTED]' for key 2") --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Automatic Update of template
On Sat, Jun 21, 2008 at 9:13 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Let me give more details.. > > I am trying to write a web-based multi-protocol client. There is an > opensource messenger Pidgin. Pidgin also comes with a dbus interface > with which, you can talk to pidgin, and do all the stuff provided by > pidin through scripts. Pidgin has signal handling system. For certain > events, corresponding signals will be raised. Through dbus, I am > registering a python function (message_received) as a callback > function which listens to "message received" signal. This function > will be called when ever a new message is received on Pidgin. Now I > have to do **something** inside the message_received function which > will render the the received message on my Template. > > Is there an automatic way of updating my template from this view? > > Right now, the way I am doing is, I am using Ajax.PeriodicalUpdater, > and polling every second for new messages. This is very inefficient > and I think this is not a scalable solution. With out continuous > updating, if I can update the template from message_received callback > function, only when message is received, that will be great. > > Could someone throw some light in this? Even some hints will be > great. > > Check out this thread: http://groups.google.com/group/django-users/browse_thread/thread/8e77990e483648d9/cf3c2ad88f8bcd7c and the stuff it links to. Initial question was how Django supports the kind of approach you are looking for (Comet) and the answer was Django neither supports nor prevents you from doing it. I think there's mention of a couple of different external projects that were looking to do something in this area, but I have no need for this approach myself so have no idea whether these projects have prospered or fallen by the wayside. Karen --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on apache and mod_python.... and problems
Hi, > The summary of error messages is this: > >> AttributeError: 'module' object has no attribute 'blog' > > I've made sure that /papastudio/blog has __init.py__, and that it's > listed in INSTALLED_APPS (which is logical since the site actually > works if I ./manage.py runserver). Did you follow the mod_python deploy instructions? There are a few things that may be happening. 1. The file needs to be '__init__.py', not '__init.py__', but I think that is probably just a typo in this email. 2. Make sure you have __init__.py in both `/papastudio/` and `/ papastudio/blog/`. 3. Is the base import (depending on what the entry in your INSTALLED_APPS looks like, if its `papastudio.blog` then it would be `papastudio`) in the Python path for your mod_python deploy? You will probably need to explicitly add it like in the instructions linked above. Your deploy will look something like this: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE papastudio.settings PythonDebug Off PythonPath "['/path/to/papastudio'] + sys.path" > > I've left the site in debug mode, so that I can see what's going on, > but the errors are the same if I set debug to False. > Thats because they are being caught by mod_python, and not by Django. To turn it off change `PythonDebug On` to `PythonDebug Off` in your mod_python config file. Best of luck, Will --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on apache and mod_python.... and problems
On Sat, Jun 21, 2008 at 9:02 PM, foxbunny <[EMAIL PROTECTED]> wrote: > > Hi, list, > > I'm trying to deploy a very simple Django app, and it's driving me > crazy. I've followed the docs and set up Apache with mod_python. Then > I uploaded the app, did syncdb, and everything works when I ./ > manage.py runserver on the remote host, but httpd won't serve it. I'm > using Django trunk rev 7722, and python 2.5.2 on Arch Linux, > mod_python is 3.3.1, and Apache is 2.2.8. > > You can see the error messages if you go to: > > http://blog.papa-studio.com/ > > > The summary of error messages is this: > > > AttributeError: 'module' object has no attribute 'blog' > > I've made sure that /papastudio/blog has __init.py__, and that it's > listed in INSTALLED_APPS (which is logical since the site actually > works if I ./manage.py runserver). > > I've left the site in debug mode, so that I can see what's going on, > but the errors are the same if I set debug to False. > > > Any ideas? > I'm assuming you have papastudio.blog listed in INSTALLED_APPS? Does apache have read access to the whole tree under /papastudio, including blog? It seems apache can read /papastudio, otherwise you'd get an 'ImportError: No module named papastudio'. Instead it can't find blog underneath it, which might mean it doesn't have read access to the blog subdirectory. Or else it's looking in the wrong place, in which case it'll help if you post where the code resides in the file system and the specifics of how you have configured Apache. Karen --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to validate for duplicate users?
I have a form like this What is the best way to validate for an already existing User when using the django.contrib.auth.models.User and the new forms authentication system? Overiding Form.clean(), and adding some uniqueness validation code works, but binds the form to the DB. There's not much way around that, I'm guessing. But is there a better approach? Details to question below--> class NewAccountForm(forms.Form): username = forms.EmailField() password = forms.CharField(widget=forms.PasswordInput) I have it all working fine from a view like this from django.contrib.auth.models import User import logging as log def create_account(request): if request.method == 'GET': form = NewAccountForm() elif request.method == 'POST': form = NewAccountForm(request.POST) if form.is_valid(): data = form.cleaned_data log.debug("\n".join(["%s=%s" % (k,v) for k,v in data.items()])) # Create the account user = User(username=data['username'], email=data['username'], password=data['password']) user.save() return render_to_response('registration/login.html', {}, context_instance=RequestContext(request) ) # Either initial GET or Validation errors - return to account page return render_to_response('registration/createaccount.html', {'form': form }, context_instance=RequestContext(request) ) When I try to create a user that already exists (username exists in the DB), I get this error IntegrityError at /accounts/createaccount/ (1062, "Duplicate entry '[EMAIL PROTECTED]' for key 2") --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to execute method in template?
On Jun 22, 2008, at 11:00 AM, Kenneth McDonald wrote: > > Notice the call on "greeting.key()". However, unless I'm missing > something, there is no way to actually invoke a method from within a > Django template. Hi Kenneth, Leaving the parentheses off after greeting.key will actually result in the method call you're looking for. The way Django's templates work, a dotted-notation attribute like that can be interpreted as a dictionary lookup, data attribute, a method call and list index – the template parser will try all of those, in that order. So long as the method doesn't require arguments, it will get called as expected. http://www.djangoproject.com/documentation/templates/#variables Eric --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to execute method in template?
Is there a way to execute a method in a template? I'm just learning the Google App Engine, and would like to be able to insert the key value for an entity along with the data for that entity: So, I want something similar to this: {% for greeting in greetings %} {% if greeting.author %} {{ greeting.author.nickname }} wrote: {% else %} An anonymous person wrote: {% endif %} {{ greeting.content|escape }} {{ greeting.key() }} {% endfor %} Notice the call on "greeting.key()". However, unless I'm missing something, there is no way to actually invoke a method from within a Django template. What's my best option--build up the output within the Python code? Use some trick of which I'm not aware? All suggestions welcome. Thanks, Ken McDonald --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
help - limit_choices_to
Hi All, This question might have been answered so may times, but I am unable to glean the information I am looking for from the 260 odd entries that turn up while searching the mailing-list archives. So here I ask again #my models class entity(models.Model): name = models.Charfield() class address(models.Model): entity = models.FK(entity) #entites can have multiple addresses street_address = models.TextField(...) class despatch(models.Model): sent_to = models.FK(entity, related_name = 'receiver') address = models.FK(address) sent_by = models.FK(entity, related_name = 'sender') Now when I show a form to enter 'despatch' data, after the user selects the sent_to 'sent_to' address, I want to show only the addresses of that entity in the 'address' selection. How do I do it? Note : I don't know java scripts, AJAX etc yet. If the above can be achieved only using these, then a small code snippet will help me start Thanks in advance Regards Ganesh --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Automatic Update of template
Let me give more details.. I am trying to write a web-based multi-protocol client. There is an opensource messenger Pidgin. Pidgin also comes with a dbus interface with which, you can talk to pidgin, and do all the stuff provided by pidin through scripts. Pidgin has signal handling system. For certain events, corresponding signals will be raised. Through dbus, I am registering a python function (message_received) as a callback function which listens to "message received" signal. This function will be called when ever a new message is received on Pidgin. Now I have to do **something** inside the message_received function which will render the the received message on my Template. Is there an automatic way of updating my template from this view? Right now, the way I am doing is, I am using Ajax.PeriodicalUpdater, and polling every second for new messages. This is very inefficient and I think this is not a scalable solution. With out continuous updating, if I can update the template from message_received callback function, only when message is received, that will be great. Could someone throw some light in this? Even some hints will be great. Signal Handling inside a Django View def message_received(account, sender, message, conversation, flags): # here I should do something to make this message popup in my # template. I think I cannot use the render_to_response directly here # this function is not called by a Httprequest class SignalListner(threading.Thread): run(self): import dbus, gobject from dbus.mainloop.glib import DBusGMainLoop dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) bus = dbus.SessionBus() bus.add_signal_receiver(my_func, dbus_interface="im.pidgin.purple.PurpleInterface", signal_name="ReceivedImMsg") loop = gobject.MainLoop() loop.run() SignalListner().run() - end of view --- Thanks a lot -Priyank On Jun 20, 7:55 am, "Norman Harman" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > > I am writing a web based chat client in Django framework. When ever I > > receive a message, I get that in a python function which is in the > > same file as my views. Can I directly pass this data to the template > > (by using response_to_render ) toupdatethe template? Could someone > > suggest a way to automaticallyupdatemessages in the site from python > > code. > > are you talking about > this?http://www.djangoproject.com/documentation/authentication/#messages > > or something else? > > If the function takes no parameters and returns a string, you can pass > it in the context and call it like a variable. > > {{ myfunction }} > > I believe this will call the function each time it is used. I'd > probably do something like this instead. > > def my_view(request): > extra = dict() > extra["message"] = myfunction(args, and, stuff) > return render_to_response("mytemplate", extra) > > seehttp://www.djangoproject.com/documentation/shortcuts/#render-to-response > > -- > Norman J. Harman Jr. > Senior Web Specialist, Austin American-Statesman > ___ > You've got fun! Check out Austin360.com for all the entertainment > info you need to live it up in the big city! --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django on apache and mod_python.... and problems
Hi, list, I'm trying to deploy a very simple Django app, and it's driving me crazy. I've followed the docs and set up Apache with mod_python. Then I uploaded the app, did syncdb, and everything works when I ./ manage.py runserver on the remote host, but httpd won't serve it. I'm using Django trunk rev 7722, and python 2.5.2 on Arch Linux, mod_python is 3.3.1, and Apache is 2.2.8. You can see the error messages if you go to: http://blog.papa-studio.com/ The summary of error messages is this: > AttributeError: 'module' object has no attribute 'blog' I've made sure that /papastudio/blog has __init.py__, and that it's listed in INSTALLED_APPS (which is logical since the site actually works if I ./manage.py runserver). I've left the site in debug mode, so that I can see what's going on, but the errors are the same if I set debug to False. Any ideas? --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: blankiing an ImageField
Amit Ramon wrote: > * Carl Karsten <[EMAIL PROTECTED]> [2008-05-25 17:25 -0500]: >> In the admin UI, is there any way to blank out a foo = >> model.ImageField(...) ? >> >> Carl K > > > foo = model.ImageFields(..., editable=False) > No. (unless I am missing some unexpected use of editable) If I have set a value, (path/name of image file) and want to clear it (so empty, Null, '', whatever the default value is) Carl K --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: method="POST" form problems. Help required
That clears everything. Thanks a lot. -Priyank On Jun 21, 4:46 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sat, Jun 21, 2008 at 7:36 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > > > > Atlast, I found the bug, login.html inherits from base page. So, the > > form mentioned in the above code is nested inside a GET form. > > > Now I get one doubt. Can't we nest the forms? Does nesting of forms > > make sense in any context? > > No, forms cannot be nested. > Fromhttp://www.w3.org/TR/html401/interact/forms.html:"A form can contain text > and markup (paragraphs, lists, etc.) in addition to form controls." No > mention of other forms. Fromhttp://www.w3.org/MarkUp/html3/forms.html: > "Note you are not allowed to nest FORM elements!" > > Karen --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: method="POST" form problems. Help required
On Sat, Jun 21, 2008 at 7:36 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Atlast, I found the bug, login.html inherits from base page. So, the > form mentioned in the above code is nested inside a GET form. > > Now I get one doubt. Can't we nest the forms? Does nesting of forms > make sense in any context? > No, forms cannot be nested. From http://www.w3.org/TR/html401/interact/forms.html: "A form can contain text and markup (paragraphs, lists, etc.) in addition to form controls." No mention of other forms. From http://www.w3.org/MarkUp/html3/forms.html: "Note you are not allowed to nest FORM elements!" Karen --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: model inheritance and admin (qs-rf & nf-a)
regarding Model Inheritance and the admin I've checked out the newforms-admin branch now. Its wonderful! Lots of great solutions. As of the other day its only a few revisions away from the trunk. (the trunk is being merged into newforms-admin) with Model inheritance the pointer field (to the parent class' table) is visible in the admin, and that's the field that is causing validation errors and problems when creating and re-editing the model (which uses two tables). I made only one minor change to hide the pointer field: Index: django/db/models/base.py === --- django/db/models/base.py(revision 7709) +++ django/db/models/base.py(working copy) @@ -102,7 +102,7 @@ else: attr_name = '%s_ptr' % base._meta.module_name field = OneToOneField(base, name=attr_name, -auto_created=True, parent_link=True) +auto_created=True, parent_link=True, editable=False) new_class.add_to_class(attr_name, field) new_class._meta.parents[base] = field else: and so far I have had no problems creating parent models, various child models, again more parent models, again more child models. editing has worked. I'm new around here and don't have any tests and I'm trying to get up to speed on too many things right now, but this is very good news to me. If I don't find any other errors or issues then I'll post this patch to the original ticket. newforms-admin looks very close to trunk mergeable. the main issues I would guess have more to do with disrupting everybody else because it involves some code rewriting. but its well worth it. nice job guys ! On 19 Jun., 22:01, felix <[EMAIL PROTECTED]> wrote: > I second that. I've just spent the day quite happily refactoring my > app to use niftymodelinheritance... and the admin doesn't work. > whoops. > > I think this should be stated in the docs for sure. > > On Jun 2, 4:44 pm, ekellner <[EMAIL PROTECTED]> wrote: > > > Isnewforms-adminany closer to being merged? This group's archives > > says that it's quite stable and has been for some time, but I don't > > have the impression that the merge is going to be easy or soon. > > > > It does seem to me that the doc should mention that Admin doesn't > > > currently > > > supportmodelinheritance(care to open a ticket/provide a patch?). > > > (Done, #7349. I didn't realize that the web docs were synthesized > > from .txt in source) > > > Elizabeth --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: method="POST" form problems. Help required
Atlast, I found the bug, login.html inherits from base page. So, the form mentioned in the above code is nested inside a GET form. Now I get one doubt. Can't we nest the forms? Does nesting of forms make sense in any context? On Jun 21, 4:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Yeah.. That is one bug. But that is not the reason. Because, execution > is not going inside the if condition. > > request.method is GET instead of POST. So anything inside the if > condition shouldn't matter. Any other bugs? I am so much tired of this > mysterious looking bug > > Thanks, > Priyank. > > On Jun 21, 4:06 pm, Jeff FW <[EMAIL PROTECTED]> wrote: > > > Looks like you forgot a return statement in the if statement. Not > > sure if that would cause what you're seeing, but it certainly couldn't > > help. > > > -Jeff > > > On Jun 21, 6:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > > > I forgot to post the problem. After clicking the 'Login' button, > > > Httprequest is submitted with method GET instead of POST. When I tried > > > to view the local variables, I am getting the form variables in GET > > > data and I am getting POST data as No data. > > > > Sorry for the trouble. > > > > Thanks, > > > Priyank > > > > On Jun 21, 3:41 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > wrote: > > > > > Hi, > > > > > I am having problems with POST. I am aware of this newbie > > > > mistakehttp://code.djangoproject.com/wiki/NewbieMistakes#POSTtoviewslosesPOS... > > > > > Could someone help me out. > > > > > -- > > > > My view is > > > > > lass LoginForm( forms.Form): > > > > loginName = forms.CharField() > > > > password = forms.CharField(widget=forms.PasswordInput) > > > > > def base_page(request): > > > > if request.method == 'POST': > > > > render_to_response('logged_in.html', locals()) > > > > else: > > > > loginForm = LoginForm() > > > > return render_to_response('login.html', locals()) > > > > > - > > > > My urls.py is > > > > > (r'^login/$', base_page), > > > > > > > > > login.html > > > > > > > > > > > > > {{loginForm.as_table}} > > > > > > > > > > > > > > > > > I am not sure where I am doing the mistake. Everything looks right for > > > > me. Could some one help me out of this. > > > > > Thanks, > > > > Priyank --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: method="POST" form problems. Help required
Yeah.. That is one bug. But that is not the reason. Because, execution is not going inside the if condition. request.method is GET instead of POST. So anything inside the if condition shouldn't matter. Any other bugs? I am so much tired of this mysterious looking bug Thanks, Priyank. On Jun 21, 4:06 pm, Jeff FW <[EMAIL PROTECTED]> wrote: > Looks like you forgot a return statement in the if statement. Not > sure if that would cause what you're seeing, but it certainly couldn't > help. > > -Jeff > > On Jun 21, 6:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > I forgot to post the problem. After clicking the 'Login' button, > > Httprequest is submitted with method GET instead of POST. When I tried > > to view the local variables, I am getting the form variables in GET > > data and I am getting POST data as No data. > > > Sorry for the trouble. > > > Thanks, > > Priyank > > > On Jun 21, 3:41 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > > > Hi, > > > > I am having problems with POST. I am aware of this newbie > > > mistakehttp://code.djangoproject.com/wiki/NewbieMistakes#POSTtoviewslosesPOS... > > > > Could someone help me out. > > > > -- > > > My view is > > > > lass LoginForm( forms.Form): > > > loginName = forms.CharField() > > > password = forms.CharField(widget=forms.PasswordInput) > > > > def base_page(request): > > > if request.method == 'POST': > > > render_to_response('logged_in.html', locals()) > > > else: > > > loginForm = LoginForm() > > > return render_to_response('login.html', locals()) > > > > - > > > My urls.py is > > > > (r'^login/$', base_page), > > > > > > > login.html > > > > > > > > > > {{loginForm.as_table}} > > > > > > > > > > > > > I am not sure where I am doing the mistake. Everything looks right for > > > me. Could some one help me out of this. > > > > Thanks, > > > Priyank --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: method="POST" form problems. Help required
Looks like you forgot a return statement in the if statement. Not sure if that would cause what you're seeing, but it certainly couldn't help. -Jeff On Jun 21, 6:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I forgot to post the problem. After clicking the 'Login' button, > Httprequest is submitted with method GET instead of POST. When I tried > to view the local variables, I am getting the form variables in GET > data and I am getting POST data as No data. > > Sorry for the trouble. > > Thanks, > Priyank > > On Jun 21, 3:41 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Hi, > > > I am having problems with POST. I am aware of this newbie > > mistakehttp://code.djangoproject.com/wiki/NewbieMistakes#POSTtoviewslosesPOS... > > > Could someone help me out. > > > -- > > My view is > > > lass LoginForm( forms.Form): > > loginName = forms.CharField() > > password = forms.CharField(widget=forms.PasswordInput) > > > def base_page(request): > > if request.method == 'POST': > > render_to_response('logged_in.html', locals()) > > else: > > loginForm = LoginForm() > > return render_to_response('login.html', locals()) > > > - > > My urls.py is > > > (r'^login/$', base_page), > > > > > login.html > > > > > > > {{loginForm.as_table}} > > > > > > > > > I am not sure where I am doing the mistake. Everything looks right for > > me. Could some one help me out of this. > > > Thanks, > > Priyank --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: method="POST" form problems. Help required
I forgot to post the problem. After clicking the 'Login' button, Httprequest is submitted with method GET instead of POST. When I tried to view the local variables, I am getting the form variables in GET data and I am getting POST data as No data. Sorry for the trouble. Thanks, Priyank On Jun 21, 3:41 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I am having problems with POST. I am aware of this newbie > mistakehttp://code.djangoproject.com/wiki/NewbieMistakes#POSTtoviewslosesPOS... > > Could someone help me out. > > -- > My view is > > lass LoginForm( forms.Form): > loginName = forms.CharField() > password = forms.CharField(widget=forms.PasswordInput) > > def base_page(request): > if request.method == 'POST': > render_to_response('logged_in.html', locals()) > else: > loginForm = LoginForm() > return render_to_response('login.html', locals()) > > - > My urls.py is > > (r'^login/$', base_page), > > > login.html > > > > {{loginForm.as_table}} > > > > > I am not sure where I am doing the mistake. Everything looks right for > me. Could some one help me out of this. > > Thanks, > Priyank --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
method="POST" form problems. Help required
Hi, I am having problems with POST. I am aware of this newbie mistake http://code.djangoproject.com/wiki/NewbieMistakes#POSTtoviewslosesPOSTdata Could someone help me out. -- My view is lass LoginForm( forms.Form): loginName = forms.CharField() password = forms.CharField(widget=forms.PasswordInput) def base_page(request): if request.method == 'POST': render_to_response('logged_in.html', locals()) else: loginForm = LoginForm() return render_to_response('login.html', locals()) - My urls.py is (r'^login/$', base_page), login.html {{loginForm.as_table}} I am not sure where I am doing the mistake. Everything looks right for me. Could some one help me out of this. Thanks, Priyank --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Just switched to trunk - Special unicode handling is making me less than happy
I'm having to add calls that look like this to my code so that stuff doesn't blow up when passing model strings to other libraries: oldsteadylib.func( smart_str(str) ) # forcing unicode back to bytestring Ouch. Ugly. Reminds me of the bad old days of working with strings in C++. >From what I read, in Python 3, the default character encoding will be UTF-8 and this should obviate the need for writing conversions and using other ugly syntax to differentiate between string encodings. In the meantime, is there a configuration setting that I can use to disable unicode for django until I want to deal with special unicode syntax, if ever? I've also read that you can change your system wide encoding from ASCII to UTF-8 by changing the setencoding() in /usr/lib/python2.5/site.py. Would anyone recommend this approach? Again, my goal is to keep the strings in my code clean from special conversions. --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: very heavy problem with edit_inline
Yes, I think it is incorrect. It should be set on some field that the user can type in and which must not be blank. Then, when that field is left blank, the admin will actually delete the address. I recommend setting core=True on the indirizzo field. -- Scott On Sat, Jun 21, 2008 at 2:39 PM, Alessandro Ronchi < [EMAIL PROTECTED]> wrote: > 2008/6/21, Scott Moonen <[EMAIL PROTECTED]>: > > Alessandro, see the documentation for the "core" model field option: > > http://www.djangoproject.com/documentation/model-api/#core > > > > You should set core=True on some field that must otherwise be present in > an > > address. Looks like "indirizzo" is such a field. > > I've set core=True on my impresa field (the one with edit_inline= > True). Is it wrong? > > -- > Alessandro Ronchi > Skype: aronchi > http://www.alessandroronchi.net > > SOASI Soc.Coop. - www.soasi.com > Sviluppo Software e Sistemi Open Source > Sede: Via Poggiali 2/bis, 47100 Forlì (FC) > Tel.: +39 0543 798985 - Fax: +39 0543 579928 > > Rispetta l'ambiente: se non ti è necessario, non stampare questa mail > > > > -- http://scott.andstuff.org/ | http://truthadorned.org/ --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: very heavy problem with edit_inline
2008/6/21, Scott Moonen <[EMAIL PROTECTED]>: > Alessandro, see the documentation for the "core" model field option: > http://www.djangoproject.com/documentation/model-api/#core > > You should set core=True on some field that must otherwise be present in an > address. Looks like "indirizzo" is such a field. I've set core=True on my impresa field (the one with edit_inline= True). Is it wrong? -- Alessandro Ronchi Skype: aronchi http://www.alessandroronchi.net SOASI Soc.Coop. - www.soasi.com Sviluppo Software e Sistemi Open Source Sede: Via Poggiali 2/bis, 47100 Forlì (FC) Tel.: +39 0543 798985 - Fax: +39 0543 579928 Rispetta l'ambiente: se non ti è necessario, non stampare questa mail --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why PostgreSQL?
I, apparently, need to learn to actually look at code before opening my mouth. I had never actually used the dumpdata command (I usually just used the database server's dump feature), so I didn't realize that it doesn't actually dump just straight SQL. Of course, had I thought about it (instead of just babbling), I would have realized that would be a very naive way of doing things. I should have known to expect better from Django :-) So, sorry for wasting your time. I still think having a command-line flag for turning checks off (with nice, big warnings on it) might be a help, but I'll be quiet. And yes, ordering the tables certainly couldn't hurt, and would be quite nice. I would submit a patch, but clearly, I need to actually have a clue as to what I'm taking about first. -Jeff On Jun 21, 10:59 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Sat, Jun 21, 2008 at 10:19 PM, Jeff FW <[EMAIL PROTECTED]> wrote: > > > On Jun 21, 12:46 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> > > wrote: > >> AFAICT, that's the same idea suggested on #3615. The discussion on > >> that ticket describes why it's not the final solution. > > > Ah, I didn't see that ticket link there. Good call. Assuming the > > data in a dumpfile is correct (which, of course, I know you can't), it > > is a valid solution. Meaning, maybe it could be a command-line flag > > for the loaddata command. If I *know* my data is valid, (say I just > > dumped it from a working database using foreign keys), then why not > > let me disable the checks when I load in the data? Running the script > > linked in the ticket afterwards would certainly be an improvement, but > > not essential in all cases. > > The problem is that the cost of being wrong is so high. I might be > absolutely sure that I don't have any problems in my data, but I could > be wrong. If I'm right, there's no problem, but if I'm wrong, I can > get the database into an invalid state, and the first time I'll know > about it is when everything goes to hell because I try to follow an > invalid reference. > > > As for ordering the tables in the dumpfile: I agree that it might not > > be a general solution, as couldn't there be cycles in the foreign > > keys? Or is that not allowed? > > Cycles are certainly both possible and allowed. Hence the problems > with finding a general solution based on model ordering. > > > Anyway, it's certainly a better quickfix for AmanKow's situation than > > editing the dumpfile and rearranging the order of tables. > > Completely aside from the 'it might help some MySQL fixture loading" > angle, there's a cosmetic angle - at the moment, fixtures are dumped > in dictionary order - which is to say, no order at all. Sorting > fixture output (both by model, and internally by key) would make the > dumped output much nicer to spelunk through manually. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
user login problem
So the problem is, that I can't login regular users, who has is_staff field set to false. If it is set to true, everything is fine. So now what I have: default login function (django.contrib.auth.views.login) and the view which renders the page after login has django.contrib.auth.decorators.login_required decorator. And it works without decorator, just manually checking if user is authenticated. So what could be wrong with that decorator, maybe I missed something. Thanks in advance;) --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: User Profile in Admin interface (using trunk)
On Sat, Jun 21, 2008 at 02:46, ristretto <[EMAIL PROTECTED]> wrote: > > Was there any solution to this? I'm looking through the tickets, > wiki, docs, web, and now the source trying to figure out how to get my > profile data saved along with a User in the admin. Anyone have that > working? My situation is the same as this poster's, except I don't > get any error; I just get no profile record created. I never got any suggestions, so I moved to a different solution (using my own form in "application space"); it was not optimal, but it worked well enough for my particular case. I am not yet that familiar with newforms-admin, but I assume it would allow for solving things like this, right? Anyway, it would be interesting to hear if there is some form of solution for this even before newforms-admin. I cannot imagine that we are the only two people that have stumbled upon the problem... :-) Cheers, johan -- Johan Liseborn --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Thanks!!!!!!!!!!!!!!!!!
+1 --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Thanks!!!!!!!!!!!!!!!!!
+1 --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why PostgreSQL?
On Sat, Jun 21, 2008 at 10:19 PM, Jeff FW <[EMAIL PROTECTED]> wrote: > > On Jun 21, 12:46 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: >> AFAICT, that's the same idea suggested on #3615. The discussion on >> that ticket describes why it's not the final solution. >> > Ah, I didn't see that ticket link there. Good call. Assuming the > data in a dumpfile is correct (which, of course, I know you can't), it > is a valid solution. Meaning, maybe it could be a command-line flag > for the loaddata command. If I *know* my data is valid, (say I just > dumped it from a working database using foreign keys), then why not > let me disable the checks when I load in the data? Running the script > linked in the ticket afterwards would certainly be an improvement, but > not essential in all cases. The problem is that the cost of being wrong is so high. I might be absolutely sure that I don't have any problems in my data, but I could be wrong. If I'm right, there's no problem, but if I'm wrong, I can get the database into an invalid state, and the first time I'll know about it is when everything goes to hell because I try to follow an invalid reference. > As for ordering the tables in the dumpfile: I agree that it might not > be a general solution, as couldn't there be cycles in the foreign > keys? Or is that not allowed? Cycles are certainly both possible and allowed. Hence the problems with finding a general solution based on model ordering. > Anyway, it's certainly a better quickfix for AmanKow's situation than > editing the dumpfile and rearranging the order of tables. Completely aside from the 'it might help some MySQL fixture loading" angle, there's a cosmetic angle - at the moment, fixtures are dumped in dictionary order - which is to say, no order at all. Sorting fixture output (both by model, and internally by key) would make the dumped output much nicer to spelunk through manually. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: flatpage for 404
On Sat, Jun 21, 2008 at 8:19 AM, mark <[EMAIL PROTECTED]> wrote: > > I think I found an acceptable solution now. > > I added the following to the files in my project directory... > urls.py: > ... > handler404 = 'mysite.views.page_not_found' > handler500 = 'mysite.views.server_error' > > views.py: > from django.contrib.flatpages.views import flatpage > ... > def page_not_found(request): >return flatpage(request, '/404/') > > def server_error(request): >return flatpage(request, '/500/') > > I also created two flatpages '/404/' and '/500/'. > > The only thing I do not like about the solution is that when I open a > page e.g. http://localhost:8080/crap/ Django comes up with the /404/ > page but the browser shows the 'http://localhost:8080/crap/' url. > So return an HttpRedirect to your 404 url from your page_not_found function instead of returning the flatpage directly. Wouldn't that fix it? Karen --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: TemplateDoesNotExist at /admin/
On Sat, Jun 21, 2008 at 9:22 AM, sggottlieb <[EMAIL PROTECTED]> wrote: > Thanks Karen! That was the issue. > Glad that was it, and it sounds like you could fix the symptom. To get a real fix implemented it would be helpful for you to post details of your system (new install, upgrade from an earlier OS X, whether a Macports version of Python had been installed, how you installed Django and what version) to that ticket (http://code.djangoproject.com/ticket/7414). I don't think we have a good handle yet on what set of circumstances, exactly, causes this to happen. Just several reports on this group of people hitting it and manually fixing it by copying over directories themselves. It would be nice if we could do something to fix the root problem, but first someone has to understand when and why it is happening. (A similar problem on Windows turned out to result from one and only one variant of 'python setup.py install' and 'setup.py install' neglecting to copy the installation data files, so it could be something very subtle that triggers the problem.) Thanks, Karen --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why PostgreSQL?
On Jun 21, 12:46 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Fri, Jun 20, 2008 at 9:14 PM, Jeff FW <[EMAIL PROTECTED]> wrote: > > > I haven't yet used Django's dumpdata and loaddata, but I've used > > mysqldump about a million times. (That's mostly what we use at my > > job, though I've been slowly pushing us towards postgres.) Try > > adding: > > > /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, > > FOREIGN_KEY_CHECKS=0 */; > > > at the top of the file, and: > > > /*!40014 SET [EMAIL PROTECTED] */; > > > at the bottom. That *should* do it. Sorry if I'm suggesting > > something you've tried already. > > AFAICT, that's the same idea suggested on #3615. The discussion on > that ticket describes why it's not the final solution. > > Yours, > Russ Magee %-) Ah, I didn't see that ticket link there. Good call. Assuming the data in a dumpfile is correct (which, of course, I know you can't), it is a valid solution. Meaning, maybe it could be a command-line flag for the loaddata command. If I *know* my data is valid, (say I just dumped it from a working database using foreign keys), then why not let me disable the checks when I load in the data? Running the script linked in the ticket afterwards would certainly be an improvement, but not essential in all cases. As for ordering the tables in the dumpfile: I agree that it might not be a general solution, as couldn't there be cycles in the foreign keys? Or is that not allowed? Anyway, it's certainly a better quickfix for AmanKow's situation than editing the dumpfile and rearranging the order of tables. -Jeff --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
session logout not being deleted
I've noticed a couple posts on this subject, but I don't understand what's going on. Can someone please explain. The docs say "When a user logs in, Django adds a row to the django_session database table. Django updates this row each time the session data changes. If the user logs out manually, Django deletes the row. But if the user does not log out, the row never gets deleted." I'm using the following: django.contrib.auth.views.login django.contrib.auth.views.logout When I login through that first view, the session is created in the DB. When I logout with that other view, the record is still in the DB. Why? If I now log in as another user, the session that wasn't delete is used as this new user's session. Does this have something to do with support AJAX requests? Or is it too prevent memory leakiness through stale sessions lingering around? Or, have I misconfigured something? Please explain Now, of course, the user may never actually call that logout view, so it might stay in the DB anyway. But, certainly if another user comes along and logs into my app from the same computer, it shouldn't be remembering the session. I don't even want the same user to be remembering the session they had last time they logged in. I don't mind running a session clearly script each day. Do I have a subclass login and put a session.delete or something in there before each login? --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: very heavy problem with edit_inline
Alessandro, see the documentation for the "core" model field option: http://www.djangoproject.com/documentation/model-api/#core You should set core=True on some field that must otherwise be present in an address. Looks like "indirizzo" is such a field. -- Scott On Sat, Jun 21, 2008 at 7:37 AM, Alessandro Ronchi < [EMAIL PROTECTED]> wrote: > I am trying to let admin users edit related field in one single page. > > I have a company model that has many addresses, so I've decided to use > a Company model and an Address model with foreignkey(Company, > edit_inline=models.STACKED) > It works correcly until I've edit the company: IT DELETES ALL MY > ASSOCIATED ADDRESSES if I click on Save() of my company. > > How can I avoid this? > Is there a solution? > > Anyone uses edit_inline without problems? > > class Impresa(models.Model): >codice = models.CharField(max_length=10,blank=False, primary_key=True) >utente = models.ForeignKey(User, blank=True, null=True, unique=True) >ragione_sociale = models.CharField(max_length=100) > > class Indirizzo(models.Model): >impresa = models.ForeignKey(Impresa)#, edit_inline=models.STACKED, > core=True, related_name="indirizzi") >tipologia= models.CharField(max_length=2, blank=True, null=True, > choices=TIPO_INDIRIZZO) >indirizzo = models.CharField(max_length=100) >cap = models.CharField(max_length=10, blank=True, null=True) >citta = models.CharField(max_length=100, blank=True, null=True) >provincia = models.CharField(max_length=2, blank=True, null=True, > choices=PROVINCE, default='FC') > > > -- > Alessandro Ronchi > Skype: aronchi > http://www.alessandroronchi.net > > SOASI Soc.Coop. - www.soasi.com > Sviluppo Software e Sistemi Open Source > Sede: Via Poggiali 2/bis, 47100 Forlì (FC) > Tel.: +39 0543 798985 - Fax: +39 0543 579928 > > Rispetta l'ambiente: se non ti è necessario, non stampare questa mail > > > > -- http://scott.andstuff.org/ | http://truthadorned.org/ --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: TemplateDoesNotExist at /admin/
Thanks Karen! That was the issue. --Seth On Jun 21, 12:49 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > 2008/6/20 sggottlieb <[EMAIL PROTECTED]>: > > > > > Hello all, > > > I am running 0.96 and and was breezing through the tutorials until I > > hit the part where you enable the admin site (http:// > >www.djangoproject.com/documentation/0.96/tutorial02/). > > > I get this error message: > > > TemplateDoesNotExist at /admin/ > > admin/login.html > > Request Method: GET > > Request URL:http://localhost:8000/admin/ > > Exception Type: TemplateDoesNotExist > > Exception Value:admin/login.html > > Exception Location: /Library/Python/2.5/site-packages/django/template/ > > loader.py in find_template_source, line 72 > > Template-loader postmortem > > > Django tried loading these templates, in this order: > > >* Using loader > > django.template.loaders.filesystem.load_template_source: > >* Using loader > > django.template.loaders.app_directories.load_template_source: > > > Traceback (innermost last) > > [snipped] > > > I don't even know where to start to look for the templates for the > > admin. I looked under site packages: > > > /Library/Python/2.5/site-packages/django/contrib/admin > > > But got nothing. Does anyone have any hints where I should be > > looking? Did I miss a setup step? > > Looks like you're on a Mac? Is it Max OS X 10.5? If so then I think you > are hitting this: > > http://code.djangoproject.com/ticket/7414 > > Django code expects its data (templates, css, etc.) files to be in the same > file tree as the code, but it seems setup on Mac OS X 10.5 places them in a > completely different place. > > If this is what you are hitting then somehow you need to get the admin's > 'templates' and 'media' trees from wherever they've been placed (there's a > likely path in that ticket, or you could just copy them from the un-tarred > tarfile) over to inside the same tree as the Django Python code, looks like > that is: > > /Library/Python/2.5/site-packages/django/contrib/admin > > in your case. > > Karen --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Extending the method that is called the first time a model is deployed.
try `class_prepared` or `post_syncdb` signals On Jun 21, 3:43 pm, mwebs <[EMAIL PROTECTED]> wrote: > I want to register a specific model(not an object of the model, the > model itself) in another model. > This should be done the first time the model is deployed with syncdb. > > So what I need is the function that is called the first time a model > is deployed, so that I can extend this function and register the model > in my App-Model: > pseudoCode: > > class Category(models.Model) > . > def __deploy__(): > super(self, Category).__deploy__() > app = App(object_name = self.__class__.name) > app.save() > > Has anyone an idea which method is used for deploying a model? > > Thank you, Toni --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: flatpage for 404
I think I found an acceptable solution now. I added the following to the files in my project directory... urls.py: ... handler404 = 'mysite.views.page_not_found' handler500 = 'mysite.views.server_error' views.py: from django.contrib.flatpages.views import flatpage ... def page_not_found(request): return flatpage(request, '/404/') def server_error(request): return flatpage(request, '/500/') I also created two flatpages '/404/' and '/500/'. The only thing I do not like about the solution is that when I open a page e.g. http://localhost:8080/crap/ Django comes up with the /404/ page but the browser shows the 'http://localhost:8080/crap/' url. Cheets, Mark --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: CSS not working in exe
For my frePPle project, I have been using py2exe to package a standalone django application. See here for my manage.py script: http://frepple.svn.sourceforge.net/viewvc/frepple/trunk/contrib/installer/manage.py?revision=640&view=markup Here's a patch for the django code to make also the django commands work with the zip-file created by py2exe: http://code.djangoproject.com/ticket/5825 unfortunately not marked for the 1.0 release :-( Johan On 20 jun, 19:10, Molly <[EMAIL PROTECTED]> wrote: > Thanks for that tip, Chris! I have been wondering about that actually. > > I think I am going to switch to Apache, because I have been having a > lot of trouble with the exe. > > Thanks for the help, I aprreciate it :) > > Molly > > On Jun 20, 10:56 am, chris vigelius <[EMAIL PROTECTED]> > wrote: > > > > > Hi Molly, > > > please consider using dpaste.com or similar for posting long code examples. > > Not only does this reduce list traffic, but you'll get syntax coloring and > > readable formatting, too... > > > On to your question: > > I must admit I never used py2exe, so my advice may be misguided, but > > shouldn't > > this list > > > > data_files = [(".", [r"C:\dev\incidents\db.sqlite3"]), > > > (r".\templates\admin", > > > glob.glob(r"C:\Python25\Lib\site-packages > > > \django\contrib\admin\templates\admin\*.*")), > > > (r".\templates\admin\auth\user", > > > glob.glob(r"C:\Python25\Libsite- > > > packages\django\contrib\admin\templates\admin\auth\user\*.*")), > > > -~--~~~~--~~--~--~--- > > > somehow refer to C:\dev\incidents\media\, where you seem to store your > > actual > > media files? If this "data_files" property does what I think it does, then > > you import admin media from site-packages, but not your own media files. And > > btw, there's a backslash missing in the third line, too. > > > hth, > > chris- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Thanks!!!!!!!!!!!!!!!!!
I saw this an I had no other chance than to join the THANKS-Post. Django is a revolution for all the webdeveloppers that had a undesirable life under the lordship of all these php-frameworks. I LOVE DJANGO, and python too. Poetry pure! THANK YOU DJANGO-PEOPLE --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: user profile is not getting saved in admin
2008/6/21 ristretto <[EMAIL PROTECTED]>: >> > I have looked through the docs and search the group and web. Seems other's >> > are asking the question, but I haven't seen an answer yet. I have the same problem, but with every edit_inline foreign key. -- Alessandro Ronchi Skype: aronchi http://www.alessandroronchi.net SOASI Soc.Coop. - www.soasi.com Sviluppo Software e Sistemi Open Source Sede: Via Poggiali 2/bis, 47100 Forlì (FC) Tel.: +39 0543 798985 - Fax: +39 0543 579928 Rispetta l'ambiente: se non ti è necessario, non stampare questa mail --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Extending the method that is called the first time a model is deployed.
I want to register a specific model(not an object of the model, the model itself) in another model. This should be done the first time the model is deployed with syncdb. So what I need is the function that is called the first time a model is deployed, so that I can extend this function and register the model in my App-Model: pseudoCode: class Category(models.Model) . def __deploy__(): super(self, Category).__deploy__() app = App(object_name = self.__class__.name) app.save() Has anyone an idea which method is used for deploying a model? Thank you, Toni --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
very heavy problem with edit_inline
I am trying to let admin users edit related field in one single page. I have a company model that has many addresses, so I've decided to use a Company model and an Address model with foreignkey(Company, edit_inline=models.STACKED) It works correcly until I've edit the company: IT DELETES ALL MY ASSOCIATED ADDRESSES if I click on Save() of my company. How can I avoid this? Is there a solution? Anyone uses edit_inline without problems? class Impresa(models.Model): codice = models.CharField(max_length=10,blank=False, primary_key=True) utente = models.ForeignKey(User, blank=True, null=True, unique=True) ragione_sociale = models.CharField(max_length=100) class Indirizzo(models.Model): impresa = models.ForeignKey(Impresa)#, edit_inline=models.STACKED, core=True, related_name="indirizzi") tipologia= models.CharField(max_length=2, blank=True, null=True, choices=TIPO_INDIRIZZO) indirizzo = models.CharField(max_length=100) cap = models.CharField(max_length=10, blank=True, null=True) citta = models.CharField(max_length=100, blank=True, null=True) provincia = models.CharField(max_length=2, blank=True, null=True, choices=PROVINCE, default='FC') -- Alessandro Ronchi Skype: aronchi http://www.alessandroronchi.net SOASI Soc.Coop. - www.soasi.com Sviluppo Software e Sistemi Open Source Sede: Via Poggiali 2/bis, 47100 Forlì (FC) Tel.: +39 0543 798985 - Fax: +39 0543 579928 Rispetta l'ambiente: se non ti è necessario, non stampare questa mail --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: flatpage for 404
> Lookup django.conf.urls.defaults module how handler404 is defined and > override it by assigning your view function in your application hmm, here is what the documentation says: >>>A string representing the full Python import path to the view that should be >>>called if none of the URL patterns match. By default, this is 'django.views.defaults.page_not_found'. That default value should suffice. <<< here is what I tried to do based on your remarks: In my project folder I created a default.py file with the following content: # handler404 = 'django.views.defaults.page_not_found' handler404 = 'django.contrib.flatpages.flatpage:404' Unfortunately django does not even notice this configuration. Regards, Mark --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Thanks!!!!!!!!!!!!!!!!!
Thanks... I was going mad trying out one PHP framework after another to match each one to a particular project's requirements. I spent more than 4 months doing that -- and I think I'm pretty decent in PHP. The deadline for my project was drawing closer, with the client poking me with a red hot iron rod. I had never got past the interactive shell of python before, but something told me Django was what I needed. In 3 weeks I had rolled out what I definitely couldn't have in 3 months' time if it were done in PHP. Django saved my life. I was broke, still am -- but soon I will have some money in my pocket thanks to Django. THANK YOU THANK YOU THANK YOU. The developers are really magnanimous for not only releasing Django to the community, but for supporting newbies like me in these "forums" and elsewhere. I'm really motivated to give something back. On Jun 21, 9:57 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Fri, Jun 20, 2008 at 10:48 PM, Norman Harman <[EMAIL PROTECTED]> wrote: > > > Django just rocks, thanks. > > On behalf of the core developers, and everyone else that has put their > time and effort into making Django what it is - you're welcome. > > > Lately I've been answering what questions I can on this forum. Which is > > my preferred way of saying "thanks". I wish it was easier to contribute. > > http://www.djangoproject.com/documentation/contributing/ > > gives the full list of ways you can contribute. Answering questions on > the mailing list is one very important item on that list. If anyone > has any suggestions of other ideas, or of ways we can make it easier > to contribute, make a suggestion and we'll see what we can do. > > If you were talking about financial contributions - one of the reasons > for setting up the Django Foundation was to act as a conduit for > accepting donations. I'm make a note to tell Jacob to put some details > up on where to send the cheques :-) > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: upload is working, but how to store the path in the imagefield?
I'm using the code below. This uploads the image file just fine. But, in the database, the table field corresponding to the image field of the model remains empty. Here < image=form.cleaned_data['image'],> is happening before the save_FOO_file so I can understand that nothing gets saved in the database. BUT, what do I need to do to save the path of the uploaded image in the database column corresponding to the model's ImageField. ---Code Begin--- def agencies_proactive_make(request): if request.method == 'POST': form = AgencyProactiveMakeForm(request.POST, request.FILES) if form.is_valid(): new_agency = Agency( short_name=form.cleaned_data['short_name'], name=form.cleaned_data['name'], contact_person=form.cleaned_data['contact_person'], landline=form.cleaned_data['landline'], mobile=form.cleaned_data['mobile'], email=form.cleaned_data['email'], address=form.cleaned_data['address'], state=form.cleaned_data['state'], image=form.cleaned_data['image'], created_by=request.user, is_active=True,) new_agency.save_image_file(image.filename, image.content) new_agency.save() return HttpResponseRedirect('/') else: form = AgencyProactiveMakeForm() variables = RequestContext(request, {'form': form}) return render_to_response('admin/agencies/proactive/ make.html',variables) ---Code End--- On Jun 21, 1:50 pm, Bradley Wright <[EMAIL PROTECTED]> wrote: > It gets saved to your MEDIA_ROOT directory, unless you specify: > > http://www.djangoproject.com/documentation/model-api/#filefield > > image = models.ImageField(upload_to='some/path') > > which will upload the image to that directory under the MEDIA_ROOT > path. > > If you're using a custom form, you also need to pass in request.FILES > like so: > > form = NewForm(request.POST, request.FILES, instance=myobject) > > and ensure that your form has the correct enctype: > > > > > On Jun 21, 3:01 am, chefsmart <[EMAIL PROTECTED]> wrote: > > > > or must we implement this ? it sounds like you were trying to > > > implement this. > > > I was explicitly calling save_FOO_field in my view before calling > > save() on the model, if that's what you mean. > > > On Jun 18, 10:37 pm, felix <[EMAIL PROTECTED]> wrote: > > > > sorry, I can't quite help you. > > > > I'm not able to get ImageField to work at all. > > > > you say save_FOO_field(filename, raw_contents) > > > > it looks like the this method is magically added to the model, right ? > > > > or must we implement this ? it sounds like you were trying to > > > implement this. > > > > did you ever get it ? > > > > I also find it very suspicious that since nothing is being succesfully > > > uploaded, django is still adding more and more _ to the file name. > > > the MEDIA_ROOT is correct, the subfolder is already there and has > > > correct permissions, but no files are making it there. > > > > On Jun 8, 8:08 am, chefsmart <[EMAIL PROTECTED]> wrote: > > > > > Hi, can someone help me with the following please: - > > > > > I have a newform with animagefield. The upload is working fine [using > > > > save_FOO_file(filename, raw_contents)], but I'm not sure what value to > > > > assign to the model'simagefield, or how to assign it. > > > > > The django documentation for save_FOO_file says If a > > > > file with the given filename already exists, Django adds an underscore > > > > to the end of the filename (but before the extension) until the > > > > filename is available. > > > > > How do I know what filename the uploaded file eventually get? How do I > > > > assign this to the model'simagefieldbefore calling save() on the > > > > model? > > > > > 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: flatpage for 404
On 6/21/08, mark <[EMAIL PROTECTED]> wrote: > I do not like the django default behaviour for 404 pages since I do > not want to create a 404.html template. I like my flatpages a lot > especially the default.html template I created earlier. Therefore I > would like django to use my default.html template to display the 404 > and use the '/404/' flatpage which I created. Unfortunately I did not > find out how to configure this behaviour. Lookup django.conf.urls.defaults module how handler404 is defined and override it by assigning your view function in your application HTH, Peter --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
flatpage for 404
Hi there, I do not like the django default behaviour for 404 pages since I do not want to create a 404.html template. I like my flatpages a lot especially the default.html template I created earlier. Therefore I would like django to use my default.html template to display the 404 and use the '/404/' flatpage which I created. Unfortunately I did not find out how to configure this behaviour. I would like the configuration within my project folder and not patch my Django installation. Best Regards, Mark --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: upload is working, but how to store the path in the imagefield?
It gets saved to your MEDIA_ROOT directory, unless you specify: http://www.djangoproject.com/documentation/model-api/#filefield image = models.ImageField(upload_to='some/path') which will upload the image to that directory under the MEDIA_ROOT path. If you're using a custom form, you also need to pass in request.FILES like so: form = NewForm(request.POST, request.FILES, instance=myobject) and ensure that your form has the correct enctype: On Jun 21, 3:01 am, chefsmart <[EMAIL PROTECTED]> wrote: > > or must we implement this ?it sounds like you were trying to > > implement this. > > I was explicitly calling save_FOO_field in my view before calling > save() on the model, if that's what you mean. > > On Jun 18, 10:37 pm, felix <[EMAIL PROTECTED]> wrote: > > > sorry, I can't quite help you. > > > I'm not able to get ImageField to work at all. > > > you say save_FOO_field(filename, raw_contents) > > > it looks like the this method is magically added to the model, right ? > > > or must we implement this ?it sounds like you were trying to > > implement this. > > > did you ever get it ? > > > I also find it very suspicious that since nothing is being succesfully > > uploaded, django is still adding more and more _ to the file name. > > the MEDIA_ROOT is correct, the subfolder is already there and has > > correct permissions, but no files are making it there. > > > On Jun 8, 8:08 am, chefsmart <[EMAIL PROTECTED]> wrote: > > > > Hi, can someone help me with the following please: - > > > > I have a newform with animagefield. The upload is working fine [using > > > save_FOO_file(filename, raw_contents)], but I'm not sure what value to > > > assign to the model'simagefield, or how to assign it. > > > > The django documentation for save_FOO_file says If a > > > file with the given filename already exists, Django adds an underscore > > > to the end of the filename (but before the extension) until the > > > filename is available. > > > > How do I know what filename the uploaded file eventually get? How do I > > > assign this to the model'simagefieldbefore calling save() on the > > > model? > > > > 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Djangodomain.com is down for the hole day
We hosting it there. It has been a big fault in data center, something with networking... Otherwise we are very happy with service... Prompt respond and a lot of help ( for free - what could be better? ) IMHO --- Ernst --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: email this page
On 6/20/08, Support Desk <[EMAIL PROTECTED]> wrote: > submit button. That will send an email containing all the rendered > information. If *all* should mean that you want to send HTML in-line message including related media (images), you have to: 1. compose MIME message having subparts as follows: mixed related my_cid_1: as attachement my_cid_2: as attachement ... alternative text html 2. render HTML part using dedicated template replacing URL of all referred media by URL having CID schema, e.g. ### I am not sure if implementation http://www.djangoproject.com/documentation/email/ is generic enough to compose such message and I am not skilled Pythoneer to know whether there is another library suitable for this task. HTH, Peter --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---