Re: problem on windows apache settings
Great, it works! thanks for help. BTW, the PythonPath is a windows system environment variable. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Meta.unique_together containing a boolean field.
Has anyone used unique_together with a BooleanField? Does unique_together only work for CharFields? Seems like the add manipulator does not enforce the constraint and the change manipulator raises a ProgrammingError exception: ERROR: operator does not exist: boolean ~~* "unknown" due to the sql snippet (in_house is the BooleanField): polls_poll"."in_house" ILIKE 'on' --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Enforcing relationships in the Admin
On 6/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > All, > I have been trying to create a model for a project that I'm starting > with the trunk version of Django(revision 3129 or newer). In the > following example I'm trying to create a model that allows the site > administrator(s) to create locations based on Country, State, and City > then associate them with a Job. In the Admin I can create the Country, > State, and City records/objects with the appropriate relationships. > However when I relate them with the Job class the Admin doesn't > restrict the selections with there respective constraints. For > example, I can create a new job object with the following information: > Country = US, State = Kansas, City = Chicago despite the fact that I > created that object/record with the following relationships: Country = > US, State = Kansas, City = Lawrence. How can I limit the choices in > the Admin interface for Country, State, and City with there appropriate > relationships when I create Job objects? I have spent quite a bit of > time looking/Googleing for a clear example of how to do this, but > haven't had any luck. Could you please look over this example model > and modify it so that it works as desired, and post it back to the > list. It would probably be a good addition to the documentation as > well, so I will submit it as a documentation example, or add it to the > cookbook once things are hashed out. > > Thanks For Your Help! > -Nick > > Example Model: > ## > > from django.db import models > > class Country(models.Model): > name = models.CharField(maxlength=100, core=True, unique=True) > > def __str__(self): > return (self.name) > > class Admin: > pass > > class State(models.Model): > country = models.ForeignKey(Country) > name = models.CharField(maxlength=100, unique=True, core=True) > > def __str__(self): > return (self.name) > > class Admin: > pass > > class City(models.Model): > region = models.ForeignKey(Region) > name = models.CharField(maxlength=100, unique=True, core=True) > > def __str__(self): > return (self.name) > > class Admin: > pass > > class Job(models.Model): > created_on = models.DateTimeField(auto_now_add=True) > country = models.ForeignKey(Country) > region = models.ForeignKey(State) > area = models.ForeignKey(City) > title = models.CharField(maxlength=100) > summary = models.CharField(maxlength=500) > body = models.TextField(blank=True, help_text="Optional") > image = models.URLField(verify_exists=True, blank=True, > help_text="Optional") > file = models.URLField(verify_exists=True, blank=True, > help_text="Optional" ) > > > def __str__(self): > return (self.title) > > class Admin: > pass > > > > > Change your model to only link from Job to City. Then the State and Country values can be inferred from traversing through your model. Because you've got independent links to Country, State and City they don't need to be dependent. Oh, and you should probably standardise on using either Region or State, at the moment you appear to be using the terms interchangeably and it makes your model slightly confusing. Regards, Andy -- >From the desk of Andrew J Todd esq --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Enforcing relationships in the Admin
On Wed, 2006-06-14 at 22:15 -0700, [EMAIL PROTECTED] wrote: > All, > I have been trying to create a model for a project that I'm starting > with the trunk version of Django(revision 3129 or newer). In the > following example I'm trying to create a model that allows the site > administrator(s) to create locations based on Country, State, and City > then associate them with a Job. In the Admin I can create the Country, > State, and City records/objects with the appropriate relationships. > However when I relate them with the Job class the Admin doesn't > restrict the selections with there respective constraints. > For > example, I can create a new job object with the following information: > Country = US, State = Kansas, City = Chicago despite the fact that I > created that object/record with the following relationships: Country = > US, State = Kansas, City = Lawrence. Your model is not really set up to provide this type of data integrity (well, firstly your model is not set up to actually run... you need to replace "Region" with "State", or vice versa, in you example). Instead of duplicating the region and country fields in the Job model, I would keep them purely as a property of the City model. A City instance already carries around with it the information about which region and country it belongs to. I would remove "region" and "country" from the Job model and change the __str__ method on the City model to return something that includes the region and country (after all, a city name is not a unique identifier, but combining it with state + country, where appropriate, helps narrow it down). You can still access region and country easily enough via job.city.state and job.city.country. Regards, Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Enforcing relationships in the Admin
All, I have been trying to create a model for a project that I'm starting with the trunk version of Django(revision 3129 or newer). In the following example I'm trying to create a model that allows the site administrator(s) to create locations based on Country, State, and City then associate them with a Job. In the Admin I can create the Country, State, and City records/objects with the appropriate relationships. However when I relate them with the Job class the Admin doesn't restrict the selections with there respective constraints. For example, I can create a new job object with the following information: Country = US, State = Kansas, City = Chicago despite the fact that I created that object/record with the following relationships: Country = US, State = Kansas, City = Lawrence. How can I limit the choices in the Admin interface for Country, State, and City with there appropriate relationships when I create Job objects? I have spent quite a bit of time looking/Googleing for a clear example of how to do this, but haven't had any luck. Could you please look over this example model and modify it so that it works as desired, and post it back to the list. It would probably be a good addition to the documentation as well, so I will submit it as a documentation example, or add it to the cookbook once things are hashed out. Thanks For Your Help! -Nick Example Model: ## from django.db import models class Country(models.Model): name = models.CharField(maxlength=100, core=True, unique=True) def __str__(self): return (self.name) class Admin: pass class State(models.Model): country = models.ForeignKey(Country) name = models.CharField(maxlength=100, unique=True, core=True) def __str__(self): return (self.name) class Admin: pass class City(models.Model): region = models.ForeignKey(Region) name = models.CharField(maxlength=100, unique=True, core=True) def __str__(self): return (self.name) class Admin: pass class Job(models.Model): created_on = models.DateTimeField(auto_now_add=True) country = models.ForeignKey(Country) region = models.ForeignKey(State) area = models.ForeignKey(City) title = models.CharField(maxlength=100) summary = models.CharField(maxlength=500) body = models.TextField(blank=True, help_text="Optional") image = models.URLField(verify_exists=True, blank=True, help_text="Optional") file = models.URLField(verify_exists=True, blank=True, help_text="Optional" ) def __str__(self): return (self.title) class Admin: pass --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: going crazy: foreignkey-reverse-lookup: tests work,my code fails
On 6/14/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Yeah, sorry about that. We really need to fix this. :-( > > But it's not entirely trivial from what I remember last time I dived in > there. Better to let Guido and company fix relative imports in Python, period. Supposed to happen soon, IIRC :) -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Admin "Page Not Found" Part 2
On 6/14/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > This is entirely expected. Model inheritance does not work at the moment > (you end up with the wrong manager for the derived class, if you care > about the details). It is being worked on. Look through the list > archives if you want more details, there have been a few threads over > the past two weeks. There's also a section on the main page of the Django wiki which lists things like this that are being worked on; model inheritance is pretty clearly listed there, which serves as a gentle reminder that often a glance at the Django wiki can answer a question far more quickly than anything else :) -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: problem on windows apache settings
> I just write hotel.settings or I need to finger out the full > path like'c:\hotel.settings'? Yep, just hotel.settings - if you add your projects folder (the one which the hotel folder is sitting in, eg C:\Django\Projects) to PythonPath, then Django knows where to look. > second:PythonPath "['/path/to/project'] + sys.path" Try something like: PythonPath "[r'C:\Django\Projects'] + sys.path" --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Admin "Page Not Found" Part 2
On Thu, 2006-06-15 at 02:52 +, Bo Shi wrote: > This is a continuation of the following thread: > > http://groups.google.com/group/django-users/browse_thread/thread/13a94a5ac9b5ff8a/f6fbcdd419ddf89e?q=page+not+found&rnum=1#f6fbcdd419ddf89e > > I'm experiencing the same problem; I've fiddled with permissions > (superuser/explicitly setting all permissions, etc) and this does not > seem to be the issue. > > === 404 when I try to edit a question after saving > class Question(models.Model): > question = models.CharField(maxlength = 200) > > class BinaryQuestion(Question): > class Admin: > list_display = ('question',) > > > > === works fine > class Question(models.Model): > question = models.CharField(maxlength = 200) > > class BinaryQuestion(models.Model): # < no inheritance > question = models.CharField(maxlength = 200) > class Admin: > list_display = ('question',) > === > > > I'm quite befuddled. This is entirely expected. Model inheritance does not work at the moment (you end up with the wrong manager for the derived class, if you care about the details). It is being worked on. Look through the list archives if you want more details, there have been a few threads over the past two weeks. Regards, Malcolm > > bs > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
problem on windows apache settings
hi, I read document "How to use Django with mod_python", and puzzled ab two things. first: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings ^^^ -if my project is hotel, then I just write hotel.settings or I need to finger out the full path like'c:\hotel.settings'? second:PythonPath "['/path/to/project'] + sys.path" ^-how can I do in MS windows system? I just need open my ipython and change the pythonpath then the mod_python know the change? is there any examples here? 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 -~--~~~~--~~--~--~---
Admin "Page Not Found" Part 2
This is a continuation of the following thread: http://groups.google.com/group/django-users/browse_thread/thread/13a94a5ac9b5ff8a/f6fbcdd419ddf89e?q=page+not+found&rnum=1#f6fbcdd419ddf89e I'm experiencing the same problem; I've fiddled with permissions (superuser/explicitly setting all permissions, etc) and this does not seem to be the issue. === 404 when I try to edit a question after saving class Question(models.Model): question = models.CharField(maxlength = 200) class BinaryQuestion(Question): class Admin: list_display = ('question',) === works fine class Question(models.Model): question = models.CharField(maxlength = 200) class BinaryQuestion(models.Model): # < no inheritance question = models.CharField(maxlength = 200) class Admin: list_display = ('question',) === I'm quite befuddled. bs --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: The only click to add any class
On Tue, 2006-06-13 at 16:56 +0400, Grigory Fateyev wrote: > Hello! > > We have compositely app 'Address' with lots of classes. Like: Region, > Country, Location and etc. And to fill the only address users need to > click some forms to add one address. It's awfully ;( > > Is it possible to write (Add|Change)Manipulator to commit data from some > forms at that time? To write form with fields from any class and commit > data using only one click? Create your form to collect the data you need. Make the submit button on that form send you to a view method to handle the submission as per normal (see [1]). Then, write a custom manipulator and use it in your form processing function as described in [2]. In that example, where it says "# Send e-mail using new data here...", you would use the Python database API [3] and the data you now have from your form to create your new objects and save them. If your various models are inter-related via ManyToManyField and ForeignKey attributes, you will also want to have a look at the section called "Related objects" in the database API docs to see how to link them together. [1] http://www.djangoproject.com/documentation/forms/ [2] http://www.djangoproject.com/documentation/forms/#custom-forms-and-manipulators [3] http://www.djangoproject.com/documentation/db_api/#creating-objects Regards, Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Using DB module(s) in another app (twisted)
Ok, here is what i had to do to get it to work: In a 'test.py' file: -- from django.conf import settings import settings as mysettings settings.configure(mysettings) from django import db from mainsite.models import Game from django.contrib.auth.models import User - I copied my 'settings.py' file from my django setup to the same dir as the 'test.py' file, and imported it as mysettings - so i could then manually pass it to the settings.configure() method. i then had to put my model.py file into a directory structure which mirrored the django one. I could then also get access to the auth database stuff (User, Groups, etc). Nice! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: HttpResponseSendFile
Sorry, this was supposed to go in the Django developers group... :-| --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HttpResponseSendFile
I noticed http://code.djangoproject.com/ticket/2131 was marked as a wontfix today with the comment, "Django isn't meant to serve static files". I don't want to go reopening the ticket, but couldn't this still be useful functionality? What if I wanted to limit access to a static file to certain users or groups in Django? How would I do this otherwise? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: going crazy: foreignkey-reverse-lookup: tests work,my code fails
On Wed, 2006-06-14 at 20:14 +0200, gabor wrote: > opendev wrote: > > I have exactly the same problem, my django is the latest mr head unter > > Python 2.4(win32) > > ah, sorry, i forgot to post my findings here... > > basically the "problem" was that i specified the imports "relatively". > > example: > > 1. django-admin.py startproject myproject > 2. manage.py startapp myapp > 3. now create a model in myapp. let's call it MyModel > > at this point, when i create a script to work with my models and import > the model, things can go wrong. > > with this import, reverse lookups work: > > from myproject.myapp.models import MyModel > > > > with this import, revers lookups fail: > > from myapp.models import MyModel Yeah, sorry about that. We really need to fix this. :-( But it's not entirely trivial from what I remember last time I dived in there. Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: how to integrate kid template with django
Hi, Simon, Thanks for your help. ~_~. Best regards, roger On 6/14/06, Simon Willison <[EMAIL PROTECTED]> wrote: > > > On 14 Jun 2006, at 12:52, Roger Sun wrote: > > > I don't like the django templates, can i use kid ? > > if can, how can i do then? > > Yes you can. Here's an example: > > from django.http import HttpResponse > import kid > > def index(request): > # Set up any variables you might want to use > template = kid.Template( > file='/path/to/template.kid', > foo='Bar', baz='bling' > ) > return HttpResponse(template.serialize()) > > That's it! Django is designed to completely decouple HTML generation > etc from the views, so it's very easy to use whatever method you want > to generate the content to be sent back in the HttpResponse. > > Hope that helps, > > Simon > > > > -- welcome: http://www.webwork.cn --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: url path in django template
thanks for your help, steven =) however, no change in settings.py was needed to make it work. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Root URI in templates
On 6/14/06, plungerman <[EMAIL PROTECTED]> wrote: > that is precisely what i would like to do. how you access a > variable defined in settings.py from a template tho? i have > not been able to track this bit down. Here's what I have. in settings.py: APP_BASE = "http://www.mysite.org/"; in templatetags directory, somewhere on django's path, is a file sitevars.py from django import template from django.conf import settings register = template.Library() @register.simple_tag def site_base(): return settings.APP_BASE some other utility stuff... in any template, I can use: {% load sitevars %} ... Custom tags are ridiculously easy with simple_tag and inclusion_tag. See http://www.djangoproject.com/documentation/templates_python/#shortcut-for-simple-tags One other thing I picked up in this group, is to use a local_settings.py for stuff like this that will be different for development, test, production servers. You just import it into your settings.py, then you can have different base URIs for each environment. -- Derek --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: syncdb capabilities
On 6/14/06, Adam Blinkinsop <[EMAIL PROTECTED]> wrote: > >From your link, Adrian: "...there's some work being done to add > partially automated database-upgrade functionality." > > How's that coming along? It's being carried out as a Google Summer of Code project; Google is sponsoring a student who's working with a mentor from the Django community to develop this functionality. I'm not sure yet exactly how we're going to handle progress reports for the students doing Summer of Code projects, but once we work it out we'll be sure to let everyone know. I've just taken over from Jacob (literally earlier this week) on overseeing our Summer of Code students and mentors and I'm still getting up to speed on all of it myself. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: syncdb capabilities
>From your link, Adrian: "...there's some work being done to add partially automated database-upgrade functionality." How's that coming along? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How to have different fields 'editable' in the AddManipulator vs the ChangeManipulator
First, I am stuck using django 0.91 because I make extensive use of model inheritance and how it works in 0.91. I am wondering how to do something with AddManipulators vs ChangeManipulators. The basic issue is that I have a bunch of models that have some fields only settable on create vs settable at anytime. The reason for this is that I am representing objects from another service using the django framework to provide a better experience when manipulating that other (non-web based) service. Some fields on the object, such as its 'name' are only settable on create. Fine, so in my models I define those fields as 'editable = False' (they should not be editable on a page that displays a form generated from that object's ChangeManipulator.) Now, in my "create_object" view I thought I was clever by augmenting the AddManipulator I get back from the module to add in the form fields that should only be present on 'create' of this object: -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # @login_required def client_create(request, eng_id): """The view that is used to create a client object. It is pretty simple. The biggest trick is that we add to the django provided AddManipulator the fields on the client object that are only settable on create. We also properly flag the fields that are required on create. """ engine = engineinstances.get_object(pk = eng_id) manipulator = clients.AddManipulator() # We need to add the fields to the manipulator that are only valid when # creating a new client object. (ie: settable on create), and we must # the ones that are required as required (ie: required on create) # manipulator.fields.extend([ formfields.TextField(field_name="name", is_required = True, length=30, maxlength = 1024), formfields.TextField(field_name="dhcp_client_identifier",length=30, maxlength = 1024), formfields.TextField(field_name="hardware_address",length=30, maxlength = 1024), ]) if request.POST: # If data was POSTed, we're trying to create a new Client. new_data = request.POST.copy() new_data['gecko_engine_instance'] = engine.id new_data['gecko_locally_modified'] = 'c' # If dhcp_client_identifier is not set but hardware address is then # derive the dhcp_client_identifier from the hardware address # if new_data['dhcp_client_identifier'] == "": dhcid = mac_to_dhcid(new_data['hardware_address']) new_data['dhcp_client_identifier'] = dhcid print "Post is: %s\nNew data is: %s" % (str(request.POST), str(new_data)) errors = manipulator.get_validation_errors(new_data) if not errors: # No errors. This means we can save the data! manipulator.do_html2python(new_data) new_obj = manipulator.save(new_data) # Redirect to the object's "edit" page. Always use a redirect # after POST data, so that reloads don't accidently create # duplicate entries, and so users don't see the confusing # "Repost POST data?" alert box in their browsers. return HttpResponseRedirect(new_obj.get_absolute_url()) else: print "client create had errors: %s" % errors else: # No POST, so we want a brand new form without any data or errors. errors = {} new_data = {} # Create the FormWrapper, template, context, response. form = formfields.FormWrapper(manipulator, new_data, errors) t = template_loader.get_template('dcs/client_create') c = Context(request, { 'engine' : engine, 'form': form, 'obj_type': Client.__name__, }) return HttpResponse(t.render(c)) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The bits where I do: new_data['gecko_engine_instance'] = engine.id new_data['gecko_locally_modified'] = 'c' is because I am creating a new object, and setting one field (that is a ForeignKey) to the object it points to. The other field is also set to indicate that I hae 'created' this object locally. These two fields are marked 'editable = True' because that was the only way to get them INTO the new object. This is rather hackish though. The issue is that this does not work. Since the 'name', 'dhcp_client_identifier', and 'hardware_address' fields are not marked as "editable" in the object model, they are NOT copied from the data in the HTML form. It was annoying to find out that 'editable' had this somewhat obscure meaning. Now, I could mark them 'editable' and then things would work here. However, in the "change" form where you can modify an object I
Directing URL's to Load Django Projects
My question may be outside the scope of Django and more related to .htaccess then anything else, but I thought I might give it a shot here just in case: I am sure many of you have read the amazing tutorial from Jeff Croft on setting up Django on Dreamhost: http://www2.jeffcroft.com/2006/may/11/django-dreamhost/. In the tutorial we are directed to setup a subdomain for the Django application server. "This way", Jeff says, "you can play with Django all you like without affecting your production site." This makes perfect sense to me - installing Django to django.mydomain.com is a great way to have the web framework setup independently and available to use for multiple sites. Later in the tutorial we setup .htaccess on django.mydomain.com using apache's mod_rewrite module to pass all requests to our website through django.fcgi, therefore making all URLs on our subdomain routed to Django. Like so: RewriteEngine On RewriteBase / RewriteRule ^(media/.*)$ - [L] RewriteRule ^(admin_media/.*)$ - [L] RewriteRule ^(django\.fcgi/.*)$ - [L] RewriteRule ^(.*)$ django.fcgi/$1 [L] This also works great, I'm able to setup my urls.py file and load installed applications like django.mydomain.com/admin or django.mydomain.com/blog ... I even have a homepage setup that loads correctly when I go to django.mydomain.com. My question is, how do I get www.mydomain.com to point to my Django files properly - in other words how can I get www.mydomain.com load the same homepage I get when I go to django.mydomain.com? My project is stored at /mydomain.com/django/django_projects/myproject/ Any help on this would be greatly appreciated, 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 -~--~~~~--~~--~--~---
Re: Admin widgets - where are they invoked?
Thanks for the pointer James - the one place I hadn't looked ;) A great implementation - turns out that just like the admin templates, I can create a "widget" template directory and override or include new templates. Also neat that the code falls back on a fields superclass if a template doesn't exist. -Phil On 14/06/06, James Bennett <[EMAIL PROTECTED]> wrote: > > On 6/14/06, Phil Powell <[EMAIL PROTECTED]> wrote: > > I'm playing around with extending field types, but I've hit a bit of a > > wall when trying to create custom "widgets" for use in the admin. Can > > anyone shed any light on how templates in > > django/contrib/admin/templates/widget/ are invoked? > > They're pulled in by the 'field_widget' templatetag (in > django/contrib/admin/templatetags/admin_modify.py). > > -- > "May the forces of evil become confused on the way to your house." > -- George Carlin > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: howto Django + lighttpd + Windows?
On 6/14/06, mamcxyz <[EMAIL PROTECTED]> wrote: > > Yes I know... is for that I try the install onto windows. > > Is rare, why then RoR can be installed with lighttp on windows? I think they might use Cygwin to do it. Nothing stopping you from doing the same, of course. Jay P. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ftp not allowed for django uner modpython with DEBUG
On 6/14/06, Brett Parker <[EMAIL PROTECTED]> wrote: > I assume this is a windows box, then... linux will let you overwrite the > file nicely. Unfortunately I never found a way to do it without shutting > down the server accessing the file in windows. This util can show what is locking files on Windows: http://www.dr-hoiby.com/WhoLockMe/index.php --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: London/UK Django developer wanted
On Jun 14, 2006, at 11:59 AM, Frankie Robertson wrote: > Just to let you know, > http://code.djangoproject.com/wiki/DevelopersForHire is the correct > place for posting this and scouting for available developers. Well... that's *a* correct place, but posting jobs to this list is perfectly OK. Jacob --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: howto Django + lighttpd + Windows?
Yes I know... is for that I try the install onto windows. Is rare, why then RoR can be installed with lighttp on windows? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Controlling Display of Foreign Key Input Fieldsets in Admin
Thanks Luke, it took me a while but now I understand... http://code.djangoproject.com/wiki/NewAdminChanges#Adminconvertedtoseparatetemplates --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ImageField upload not working in django.views.generic.create_update.update_object?
On 6/14/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 6/14/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > My new thread on Django-dev (which unforuntately doesn't seem to be > > getting much response) > > Err, what's the subject? I'm on both lists and haven't seen it... "Improved FileField ideas?" Jay P. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ImageField upload not working in django.views.generic.create_update.update_object?
On 6/14/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > My new thread on Django-dev (which unforuntately doesn't seem to be > getting much response) Err, what's the subject? I'm on both lists and haven't seen it... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ftp not allowed for django uner modpython with DEBUG
On Tue, Jun 13, 2006 at 05:58:41AM -0700, [EMAIL PROTECTED] wrote: > > hello, > > I have a running site installed with apache mod_python, and the DEBUG = > True > in settings.py > > I thougth I could FTP views or template modifications and see the > change in real time, > in fact, I am not even allowed to modify (by ftp ing a new version) any > file in the app directory. > > The answer is file locked or something similar. > when doing modifications in localhost I think it worked. I assume this is a windows box, then... linux will let you overwrite the file nicely. Unfortunately I never found a way to do it without shutting down the server accessing the file in windows. Cheers, -- Brett Parker --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: going crazy: foreignkey-reverse-lookup: tests work,my code fails
On Wed, Jun 14, 2006 at 10:51:02AM -0700, Rick wrote: > > I'm having a similar (but not identical) problem. > > In my app I have Rate's that belong to a Rateset, and Card's that use a > Rateset. So both Rate and Card have a foreign key connection to > Rateset. > > My application needs a list of "active" rates (those rates that are in > use by an active Card). Here is my query: > > Rate.objects.filter(rateset__card__active_exact=True).distinct().values('countryfrom') ^ should be __ surely? Cheers, -- Brett Parker --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: going crazy: foreignkey-reverse-lookup: tests work,my code fails
opendev wrote: > I have exactly the same problem, my django is the latest mr head unter > Python 2.4(win32) ah, sorry, i forgot to post my findings here... basically the "problem" was that i specified the imports "relatively". example: 1. django-admin.py startproject myproject 2. manage.py startapp myapp 3. now create a model in myapp. let's call it MyModel at this point, when i create a script to work with my models and import the model, things can go wrong. with this import, reverse lookups work: from myproject.myapp.models import MyModel with this import, revers lookups fail: from myapp.models import MyModel so basically, when importing, also specify the project-name. in more detail here: http://groups.google.com/group/django-developers/browse_thread/thread/51ebb62cc40ff3f7 for me this: 1. seems to be a bug in django 2. only happens with my own scripts. if i am running the django app using the development server, both kind of imports work ok. gabor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: FastCGI watcher?
Derek Hoy wrote: > These cover use of daemon-monitoring demons: > > http://www.linuxdevcenter.com/lpt/a/1708 > http://ivory.idyll.org/articles/basic-supervisor.html > Thanks! > And this is cool :) > http://www.truepathtechnologies.com/gcal.html > Or fun -- at least :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: FastCGI watcher?
Ivan Sagalaev wrote: > Gábor Farkas wrote: >> ! someone also uses fastcgi :-) >> > This used to be the first thing in Google by "django fastcgi" :-). >> we do not have this problem on our system (at least we think so :-) > This is good to hear :-). I have the problem on my virtual hosting where > don't actually know what exactly has happened. So may be this was me > making something stupid in /etc/rc.d script to start this up. However I > have it deployed on another server where things go less unpredictably so > I'll watch it. >> , and >> unfortunately do not know the solution. the RoR world seems to simply >> periodically probe the fastcgi processes (open a tcpip connection to him >> and check if it responds), and kill&spawn it if it does not respond. >> > Is there any working script of this kind? Or is it some kind of thing > that a decent admin can eat for breakfast every day? :-) no idea :-( the ones i saw on the net were of that kind (http://poocs.net/files/watch-listener.rb) gabor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: going crazy: foreignkey-reverse-lookup: tests work,my code fails
I'm having a similar (but not identical) problem. In my app I have Rate's that belong to a Rateset, and Card's that use a Rateset. So both Rate and Card have a foreign key connection to Rateset. My application needs a list of "active" rates (those rates that are in use by an active Card). Here is my query: Rate.objects.filter(rateset__card__active_exact=True).distinct().values('countryfrom') I'm trying to follow the relationship from Rate, "forward" to Rateset and "reverse" to Card. I get: AttributeError: 'RelatedObject' object has no attribute 'column' Any idea of what's wrong? Thanks, Rick Model > class RateSet(models.Model): description = models.TextField(maxlength=128) class Continent(models.Model): id = models.TextField(maxlength=2, primary_key=True) description = models.TextField(maxlength=40) class Country(models.Model): id = models.TextField(maxlength=3, primary_key=True) continent = models.ForeignKey(Continent) description = models.TextField(maxlength=40) class Rate(models.Model): rateset = models.ForeignKey(RateSet) countryfrom = models.ForeignKey(Country, related_name='countryfrom_set') countryto = models.ForeignKey(Country, related_name='countryto_set') perminute = models.FloatField(max_digits=6, decimal_places=4) class Card(models.Model): rateset = models.ForeignKey(RateSet) name = models.CharField(maxlength=24) active = models.BooleanField() --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: FastCGI watcher?
On 6/14/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > What can you suggest to prevent or restart failing FastCGI? This is on my to-do list, and here a couple of links I found interesting: These cover use of daemon-monitoring demons: http://www.linuxdevcenter.com/lpt/a/1708 http://ivory.idyll.org/articles/basic-supervisor.html And this is cool :) http://www.truepathtechnologies.com/gcal.html -- Derek --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Admin widgets - where are they invoked?
On 6/14/06, Phil Powell <[EMAIL PROTECTED]> wrote: > I'm playing around with extending field types, but I've hit a bit of a > wall when trying to create custom "widgets" for use in the admin. Can > anyone shed any light on how templates in > django/contrib/admin/templates/widget/ are invoked? They're pulled in by the 'field_widget' templatetag (in django/contrib/admin/templatetags/admin_modify.py). -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Admin widgets - where are they invoked?
Hi, I'm playing around with extending field types, but I've hit a bit of a wall when trying to create custom "widgets" for use in the admin. Can anyone shed any light on how templates in django/contrib/admin/templates/widget/ are invoked? I've got a new subclassed fieldtype working fine, with a customised form class, and I've tracked the code up to the point where fieldsets are generated, but am at a loss now as to how those are wrapped in the "widget" templates? Any pointers much appreciated! -Phil --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: FastCGI watcher?
Ivan Sagalaev wrote: > I have the problem on my virtual hosting where > don't actually know what exactly has happened. So may be this was me > making something stupid in /etc/rc.d script to start this up. To remove suspicions from django-fcgi.py I want to confirm that it was most likely exactly that. I messed up path to my Python and the script wasn't starting properly. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: London/UK Django developer wanted
Just to let you know, http://code.djangoproject.com/wiki/DevelopersForHire is the correct place for posting this and scouting for available developers. On 14/06/06, Gonzalo <[EMAIL PROTECTED]> wrote: > > Hello we're a small independent design studio based in London looking > for a Django/Python developer to join us for a couple of projects over > the summer (2-3 months). We're happy for you to work remotely but must > be avail on Skype or similar to meet/talk/report regularly. You should > have experience working with other people over svn. > > Please send CV, availability & rates (week/month) via email and we'll > get in touch. 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 -~--~~~~--~~--~--~---
Re: howto Django + lighttpd + Windows?
On 6/14/06, mamcxyz <[EMAIL PROTECTED]> wrote: > Then I must install apache + mod_python in Windows? > If your goal is to do load testing, and your production server will use lighttpd, then there's really no point in installing Apache on Windows, because your load test server will be different from your production server. Jay P. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: howto Django + lighttpd + Windows?
Where I get info about this?? Then I must install apache + mod_python in Windows? :( --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ImageField upload not working in django.views.generic.create_update.update_object?
On 6/14/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Jay- > > In case you didn't noticed, Jacob did check in your patch, and it > totally fixed the problem on my end. Thanks so much! :) Yep, I saw that yesterday, I was excited to finally contribute something back to this fantastic set of code. My new thread on Django-dev (which unforuntately doesn't seem to be getting much response) is an early attempt at stopping the next problem you'll run into, which is all avatars having to go into the same directory, and old avatars being "lost" if an user uploads a new one for themself, with the same filename. Jay P. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ImageField upload not working in django.views.generic.create_update.update_object?
Jay- In case you didn't noticed, Jacob did check in your patch, and it totally fixed the problem on my end. Thanks so much! :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ftp not allowed for django uner modpython with DEBUG
hello, I have a running site installed with apache mod_python, and the DEBUG = True in settings.py I thougth I could FTP views or template modifications and see the change in real time, in fact, I am not even allowed to modify (by ftp ing a new version) any file in the app directory. The answer is file locked or something similar. when doing modifications in localhost I think it worked. any idea wher does it come from ? thanks pascal --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Create generic views in Django 0.91
On 6/13/06, Sam Tran <[EMAIL PROTECTED]> wrote: > Now we want to use the same model to create a contact tree for a given > user: we determine who this user can view, e.g. personal phone > numbers. The tables have different name but have the same function. > Obviously we'd like to use the same views as for the hierarchy tree. > > My question is the following: > Should we upgrade to the latest version of Django before making these > views generic or can we make these views generic in 0.91 then easily > port the code to the latest version of Django? Hi Sam, I don't really understand you particular setup/goal, but I would strongly suggest moving to the latest version of Django, period. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
No such column error + tag question
Hi, I've been developping a link model (see at the end of the post, kind of personal delicious) , and when I try to use the admin interface to add a url, I obtain the following error: Request Method: GET Request URL:http://127.0.0.1:8000/admin/links/link/ Exception Type: OperationalError Exception Value:no such column: links_link.link Exception Location: c:\program files\python24\lib\site-packages\django-0.91-py2.4.egg\django\db\backends\sqlite3\base.py in execute, line 69 It is really curious because the table seems to exist. Another question, I've developped a quick tag model (see also at the end). Would I be able to use the same tag model for, say, blog posts and images at the same time? Or would I have to subclass or use different implementation of the Tag class? Thanks a lot. G The code: LINK: from django.db import models from django.contrib.auth.models import User from djangocode.sysvortex.tags.models import Tag class Link(models.Model): slug = models.SlugField(prepopulate_from=('title',), help_text='Automatically built from the title', primary_key=True) link = models.URLField() title = models.CharField(maxlength=79) date = models.DateTimeField() summary = models.TextField(blank=True, help_text='Will be displayed on urls indexes') tags = models.ManyToManyField(Tag,related_name='link_tagged') author = models.ForeignKey(User) def get_absolute_url(self): return '/links/%s/' % self.slug def get_tag_list(self): return self.tags.all() def __str__(self): return self.title def __repr__(self): return self.title class Admin: list_display = ('title','url','date','author') list_select_related = 'True' search_fields = ['title','summary'] ordering = ('-date') fields = ( (None, {'fields':('url','title','slug','author', 'date'), }), (None, {'fields':('summary',), 'classes':'wide', }), ) TAG: class Tag(models.Model): slug=models.SlugField(prepopulate_from=('title',), help_text='Automatically built from the title', primary_key=True) title = models.CharField(maxlength=30) description=models.CharField(maxlength=200,help_text='Short summary of this tag') def get_absolute_url(self): return '/tags/%s/' % self.slug def get_list(self): return self.post_tagged.all() def __str__(self): return self.title def __repr__(self): return self.title --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: how to integrate kid template with django
On 14 Jun 2006, at 12:52, Roger Sun wrote: > I don't like the django templates, can i use kid ? > if can, how can i do then? Yes you can. Here's an example: from django.http import HttpResponse import kid def index(request): # Set up any variables you might want to use template = kid.Template( file='/path/to/template.kid', foo='Bar', baz='bling' ) return HttpResponse(template.serialize()) That's it! Django is designed to completely decouple HTML generation etc from the views, so it's very easy to use whatever method you want to generate the content to be sent back in the HttpResponse. Hope that helps, Simon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Root URI in templates
ChrisW wrote: > I had thought of doing this, but after not seeing it in anyone elses > code, I wasnt sure if: > a) it was the "right thing to do". b) how to do it properly. > In all (both :-) ) my projects I use a context processor to have {{ style_url }} and {{ js_url }} in templates. This is convenient. This is not such a big deal to have an "officially" recommended way to do it. Use whatever and however you feel is right for you. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to do named HTML anchors with Django?
ZebZiggle wrote: > PS> Thx for the tip ... I'll change that! I'm pretty > old-school :) > I want to add that the whole point of referring to an id is to not have for it. If you have an element you want to refer to then instead of: ... you can do just: ... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: FastCGI watcher?
Gábor Farkas wrote: > ! someone also uses fastcgi :-) > This used to be the first thing in Google by "django fastcgi" :-). > we do not have this problem on our system (at least we think so :-) This is good to hear :-). I have the problem on my virtual hosting where don't actually know what exactly has happened. So may be this was me making something stupid in /etc/rc.d script to start this up. However I have it deployed on another server where things go less unpredictably so I'll watch it. > , and > unfortunately do not know the solution. the RoR world seems to simply > periodically probe the fastcgi processes (open a tcpip connection to him > and check if it responds), and kill&spawn it if it does not respond. > Is there any working script of this kind? Or is it some kind of thing that a decent admin can eat for breakfast every day? :-) > how do you monitor your fastcgi processes? i mean, how do you check if > they are running or not? Well... I don't :-) That time when I saw "Internal server error" I just checked ps -aux | grep fcgi and didn't find anything. So I'm interested in this as well :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
London/UK Django developer wanted
Hello we're a small independent design studio based in London looking for a Django/Python developer to join us for a couple of projects over the summer (2-3 months). We're happy for you to work remotely but must be avail on Skype or similar to meet/talk/report regularly. You should have experience working with other people over svn. Please send CV, availability & rates (week/month) via email and we'll get in touch. 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 -~--~~~~--~~--~--~---
Re: FastCGI watcher?
Ivan Sagalaev wrote: > Hello! > > I know that some people here are running Django under FastCGI. I'm using > Hugo's convenient django-fcgi.py script for this > (https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoFcgi). > However couple of days ago I've found my django app (test version, > thankfully) not responding because a script process holding FastCGI > server was down. I also read somewhere that this sometimes occurs in > other FastCGI environments (with RoR, namely). > > What can you suggest to prevent or restart failing FastCGI? ! someone also uses fastcgi :-) we do not have this problem on our system (at least we think so :-), and unfortunately do not know the solution. the RoR world seems to simply periodically probe the fastcgi processes (open a tcpip connection to him and check if it responds), and kill&spawn it if it does not respond. on the other hand, a question: how do you monitor your fastcgi processes? i mean, how do you check if they are running or not? my biggest problem with fastcgi is the lack of status-information... with apache it's easy to use the server-status (using mod_status), but with fastcgi... gabor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: encoding of form variables in views
Pistahh wrote: > now my question is how do I know the encoding of the variables in > data["something"] ? > This encoding should be the same that you're using for output (settings.DEFAULT_CHARSET). However nothing is preventing some broken user agent (like some badly written script) to send you some garbage instead of what you expect. So in general case this can't be solved. I think your best bet is to assume the correct encoding (settings.DEFAULT_CHARSET), try to decode it and let the "bad" client have an error message. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
FastCGI watcher?
Hello! I know that some people here are running Django under FastCGI. I'm using Hugo's convenient django-fcgi.py script for this (https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoFcgi). However couple of days ago I've found my django app (test version, thankfully) not responding because a script process holding FastCGI server was down. I also read somewhere that this sometimes occurs in other FastCGI environments (with RoR, namely). What can you suggest to prevent or restart failing FastCGI? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Generic views and "include"
Hello, I am trying to render the output of multiple generic views under one template. Is this possible and if so how? The include tag renders only a template and cannot be used for the output of an entire view afaik. Best regards, --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: The only click to add any class
Hello Grigory Fateyev! On Tue, 13 Jun 2006 16:56:14 +0400 you wrote: > > Hello! > > We have compositely app 'Address' with lots of classes. Like: Region, > Country, Location and etc. And to fill the only address users need to > click some forms to add one address. It's awfully ;( > > Is it possible to write (Add|Change)Manipulator to commit data from > some forms at that time? To write form with fields from any class and > commit data using only one click? > > Thanks! Is it not possible? -- ÷ÓÅÇÏ ÎÁÉÌÕÞÛÅÇÏ! greg [at] anastasia [dot] ru çÒÉÇÏÒÉÊ. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to integrate kid template with django
hi, everybody. I don't like the django templates, can i use kid ? if can, how can i do then? thanks. -- welcome: http://www.webwork.cn --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Foreign keys and applications
I have two applications in my project: project app1 models.py app2 models.py project/app1/models.py: class Cls1(models.Model): ... project/app2/models.py: from project.app1.models import Cls1 class Cls2(models.Model): c = models.ForeignKey(Cls1) But when in my views I try to do: c1 = Cls1.objects.get(pk=1) clss = c1.cls2_set.all() I get: 'Cls1' object has no attribute 'cls2_set' --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: going crazy: foreignkey-reverse-lookup: tests work,my code fails
I have exactly the same problem, my django is the latest mr head unter Python 2.4(win32). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Q.
Beatiful & interesting!!! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to do named HTML anchors with Django?
So it would just look like: return render_to_response('polls/index.html/#foo', {'latest_poll_list': latest_poll_list}) or return render_to_response('polls/index.html#foo', {'latest_poll_list': latest_poll_list}) Is that correct? -Sandy PS> Thx for the tip ... I'll change that! I'm pretty old-school :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: unable to do an svn co
> nope, tried with another machine not behind a proxy and was unable to > checkout or do an svn update either. I have tried with svn 1.1.4 and > 1.2. I think something is down I am also having the same problem, aparently it is proxy related, a lot of other projects have seen similar problems. I think we should probably reopen http://code.djangoproject.com/ticket/718 and if at all possible, have svn also listen on https. http://www.sipfoundry.org/tools/svn-tips.html svn ls does work for me so I believe it is transparent proxies. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Root URI in templates
On 06/14/06 10:07, limodou wrote: >> > One method: >> > >> > set a "base" tag in template, so this tag will point the root uri of >> > this page, and other uris can be related with this uri. >> > >> > Two method: >> > >> > Define some template variables used for root uri, and using them in >> > urls. So you can define them in settings.py or somewhere, and if the >> > situation changed, you may only change the settings.py. >> >> that is precisely what i would like to do. how you access a >> variable defined in settings.py from a template tho? i have >> not been able to track this bit down. >> >> > 1. in the view code, pass settings.py variables into template. > > 2. write your own template processor and config it in settings.py > 3. write your own templatetags. see django/contrib/admin/templatetags/ for examples --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Root URI in templates
> > One method: > > > > set a "base" tag in template, so this tag will point the root uri of > > this page, and other uris can be related with this uri. > > > > Two method: > > > > Define some template variables used for root uri, and using them in > > urls. So you can define them in settings.py or somewhere, and if the > > situation changed, you may only change the settings.py. > > that is precisely what i would like to do. how you access a > variable defined in settings.py from a template tho? i have > not been able to track this bit down. > > 1. in the view code, pass settings.py variables into template. 2. write your own template processor and config it in settings.py -- I like python! My Blog: http://www.donews.net/limodou My Django Site: http://www.djangocn.org NewEdit Maillist: http://groups.google.com/group/NewEdit --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Root URI in templates
hi, i just saw this documents, maybe it can help you. from django.conf.settings import the full url: http://www.djangoproject.com/documentation/settings/ On 6/14/06, plungerman <[EMAIL PROTECTED]> wrote: > > > limodou wrote: > > On 6/14/06, ChrisW <[EMAIL PROTECTED]> wrote: > > > > > > Let me rephrase this. I don't disagree with absolute URL's per se, but > > > there should be someway of abstracting them further than is currently > > > available. > > > > > > Lets say that your media server's address changes, doesnt it seem silly > > > to have to go through ALL of your templates to change those absolute > > > URL's? > > > > > > I agree with the idea that media should be served served separately to > > > structure, but I disagree with the implication that stylesheets are > > > media (at least for now, as I love being proved wrong by intelligent > > > people). > > > > > > Lets say I have a django app that I want to make publicly available for > > > others to install and play with. Currently, the stylesheets and > > > templates would have to be separately packaged from the app it self. > > > This doesnt bother me so much with regards to the templates as there is > > > a way to tell your django installation with one line where it should > > > look for templates, but its another matter for stylesheets (and I dare > > > say certain images that IMHO should not be considered *media*). > > > > > > I predict that by reading this post you will have guessed correctly > > > that I'm utterly confused about what is the right thing to do. (the > > > best practice) > > > > > > Sincerely, > > > > > > ChrisW > > > > > > > One method: > > > > set a "base" tag in template, so this tag will point the root uri of > > this page, and other uris can be related with this uri. > > > > Two method: > > > > Define some template variables used for root uri, and using them in > > urls. So you can define them in settings.py or somewhere, and if the > > situation changed, you may only change the settings.py. > > that is precisely what i would like to do. how you access a > variable defined in settings.py from a template tho? i have > not been able to track this bit down. > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Root URI in templates
limodou wrote: > On 6/14/06, ChrisW <[EMAIL PROTECTED]> wrote: > > > > Let me rephrase this. I don't disagree with absolute URL's per se, but > > there should be someway of abstracting them further than is currently > > available. > > > > Lets say that your media server's address changes, doesnt it seem silly > > to have to go through ALL of your templates to change those absolute > > URL's? > > > > I agree with the idea that media should be served served separately to > > structure, but I disagree with the implication that stylesheets are > > media (at least for now, as I love being proved wrong by intelligent > > people). > > > > Lets say I have a django app that I want to make publicly available for > > others to install and play with. Currently, the stylesheets and > > templates would have to be separately packaged from the app it self. > > This doesnt bother me so much with regards to the templates as there is > > a way to tell your django installation with one line where it should > > look for templates, but its another matter for stylesheets (and I dare > > say certain images that IMHO should not be considered *media*). > > > > I predict that by reading this post you will have guessed correctly > > that I'm utterly confused about what is the right thing to do. (the > > best practice) > > > > Sincerely, > > > > ChrisW > > > > One method: > > set a "base" tag in template, so this tag will point the root uri of > this page, and other uris can be related with this uri. > > Two method: > > Define some template variables used for root uri, and using them in > urls. So you can define them in settings.py or somewhere, and if the > situation changed, you may only change the settings.py. that is precisely what i would like to do. how you access a variable defined in settings.py from a template tho? i have not been able to track this bit down. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---