Manipulating ManyToManyField in Model.save()
Here is a small example: class Item(models.Model): title = models.CharField(max_length=25) other = models.TextField(null=True, blank=True) items = models.ManyToManyField('self', null=True, blank=True) def __unicode__(self): return self.title def save(self, force_insert=False, force_update=False): super(Item, self).save(force_insert, force_update) if self.other.strip(): pieces = [x.strip() for x in self.other.split(',')] self.items.clear() for piece in pieces: other = Item.objects.get(title=piece) self.items.add(other) the idea here is that the user can specify the items in the ManyToManyField by providing a comma-separated list of item titles in the "other" field. This works fine from shell. It does not work from the admin site, I think because the form saves related data *after* the model itself is saved, so my code in save() runs, but it seems that after that it gets overwritten by the form. So, what is the best way to do what I am trying to do? I am hoping to be able to do it in the model (since that's where I think it belongs) -- Thanks, Medhat --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
a question about model inheritance after qs-rf
Hi, QS-rf in general and model inheritance in particular are really cool. I have been waiting for them for a long time, thanks :-) I am trying now to use them. And one question I have is the following: for multi-table inheritance, (using the example from the documentation,) let's say that we have a Place object, is there a way to convert that object into a Restaurant object? The case I am trying to do is have an "augmented" ContentType [ACT] object that will inherit from ContentType but add some other stuff, like icon, etc... but at the time when I try to create my ACT, the ContentType object is already created by syncdb. So, is there a way to create an ACT and tell it to use a specific ContentType object as its parent? Or should this be done differently? -- Thanks, Medhat P.S. Before model inheritance I did this using a OneToOneField, but I am trying to take advantage of model inheritance now. --~--~-~--~~~---~--~~ 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: a question about model inheritance after qs-rf
Trying to use this idea, I created the following function: def extend(parent_class, parent_id, child_class, **kwargs): p = parent_class.objects.filter(pk=parent_id).values()[0] p.update(kwargs) c = child_class(**p) return c but that still does not work. It throws an "AttributeError: can't set attribute" from line 224 in django\db\models\base.py -- Medhat --~--~-~--~~~---~--~~ 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: a question about model inheritance after qs-rf
You are right, and my sample function above "extend" also works. The problem is that I had a read-only property in my child model that had the same name as one of the fields in the parent model. I had not noticed that until I dug deeper to investigate the issue :-( thanks for your help. -- Medhat On May 1, 11:49 am, AmanKow <[EMAIL PROTECTED]> wrote: > I did the following, it works fine: > > from django.db import models > > class Place(models.Model): > name = models.CharField(max_length=50) > address = models.CharField(max_length=80) > > def __unicode__(self): > return self.name > > # you can call this on any model object > def object_as_dict(model_object): > return > model_object.__class__.objects.filter(pk=model_object.pk).values()[0] > > # If you would like to add this ability to your model objects > # you could define this as a method in Place, > # but let's assume that you don't have access to Place > Place.as_dict = object_as_dict > > class Restaurant(Place): > serves_hot_dogs = models.BooleanField() > serves_pizza = models.BooleanField() > > class Bar(Place): > has_happy_hour = models.BooleanField() > checks_id = models.BooleanField() > > # now you can do like the following: > # >>> from mysite.eatery.models import Place, Restaurant, Bar, > object_as_dict > # >>> p = Place(name="Lee's Tavern", address="Staten Island") > # >>> p.save() # now we have a pre-existing record, IRL you would > fetch it > # >>> r = Restaurant(serves_pizza=True, serves_hot_dogs=False, > **p.as_dict()) > # >>> r.save() > > On Apr 30, 1:48 pm, medhat <[EMAIL PROTECTED]> wrote: > > > Trying to use this idea, I created the following function: > > > def extend(parent_class, parent_id, child_class, **kwargs): > > p = parent_class.objects.filter(pk=parent_id).values()[0] > > p.update(kwargs) > > c = child_class(**p) > > return c > > > but that still does not work. It throws an "AttributeError: can't set > > attribute" from line 224 in django\db\models\base.py > > > -- > > Medhat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
sending email with cc
Hi, I am trying to send an email from one of my views. I found http://www.djangoproject.com/documentation/email/ but I need to include people in the cc list of the message, and that page does not mention anything about cc! I tried the following: msg = EmailMessage(subject, body, frm, to, headers={'Cc':cc}) but that still did not work... The people on the to kist will get the message, and it will be showing the cc list correctly, but the people on the cc list will never get it. Any ideas? -- Thanks in advance, Medhat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Poor man's model inheritance question.
Hi, I am using OneToOneField to simulate model inheritance. I have all the shared fields in a base model, and then for every specific case I have a derived model that has a OneToOneField to that base model. That was all working fine. Recently I was trying to encapsulate some of the functionality that is in all the derived models into a base class. So I have something similar to the following: --- class Base(models.Model): common_field = models.CharField() class CommonFunc(models.Model): def save(self): do_common_thing() super(CommonFunc,self).save() class DerivedModel(CommonFunc): base = models.OneToOneField(Base) specific_field = models.CharField() --- The problem I am having is that for some reason it is not detecting that the one-to-one field is a primary key and when I syncdb it gives me an error that DerivedModel has two primary keys since django adds the implicit id field. Is this a bug? Is there a better way for me to achieve this? Or should I just wait patiently until model inheritance is implemented? -- Thanks, Medhat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Creating an empty queryset
Hi, Is there a way to create an empty queryset?! Let's say I have a manager to return all the items with the given tags, and I want to return "no items" if one of the given tags does not exist. Right now I return an empty list, but this causes an error in generic views. Is there a way to create an empty QuerySet object without hitting the database? -- Thanks, Medhat --~--~-~--~~~---~--~~ 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 with a strange error: ImportError No module named pwd
Hi, I have been using django with sqlite and the development server on windows for sometime now. Today was the first time that I moved to mysql, apache, mod_python on gentoo linux. In my templates I use restructured text. And it is giving me the following error: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in render_node 712. result = node.render(context) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in render 762. output = self.filter_expression.resolve(context) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in resolve 571. obj = func(obj, *arg_vals) File "/usr/lib/python2.4/site-packages/django/contrib/markup/templatetags/markup.py" in restructuredtext 51. parts = publish_parts(source=value, writer_name="html4css1", settings_overrides=docutils_settings) File "/usr/lib/python2.4/site-packages/docutils/core.py" in publish_parts 407. enable_exit_status=enable_exit_status) File "/usr/lib/python2.4/site-packages/docutils/core.py" in publish_programmatically 512. pub.process_programmatic_settings( File "/usr/lib/python2.4/site-packages/docutils/core.py" in process_programmatic_settings 128. config_section=config_section, File "/usr/lib/python2.4/site-packages/docutils/core.py" in get_settings 115. option_parser = self.setup_option_parser( File "/usr/lib/python2.4/site-packages/docutils/core.py" in setup_option_parser 103. usage=usage, description=description) File "/usr/lib/python2.4/site-packages/docutils/frontend.py" in __init__ 492. config_settings = self.get_standard_config_settings() File "/usr/lib/python2.4/site-packages/docutils/frontend.py" in get_standard_config_settings 538. for filename in self.get_standard_config_files(): File "/usr/lib/python2.4/site-packages/docutils/frontend.py" in get_standard_config_files 534. return [os.path.expanduser(f) for f in config_files if f.strip()] File "/usr/lib/python2.4/posixpath.py" in expanduser 320. import pwd ImportError at /articles/1/ No module named pwd As far as I can tell pwd is a builtin module. And I have no problem importing it when I run python from the command line. Any ideas what could be the problem? My experience has been that when moving from windows to linux it is usually a permissions problem, but I am really clueless about this one! Any help would be greatly appreciated. -- Thanks, Medhat --~--~-~--~~~---~--~~ 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 with a strange error: ImportError No module named pwd
Permissions for what exactly? That's what I can't figure out! If pwd is a builtin module, shouldn't this problem affect other builtin modules too?! But it doesn't -- Thanks, Medhat --~--~-~--~~~---~--~~ 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 with a strange error: ImportError No module named pwd
Well, re-emerging mod_python fixed the problem! -- Medhat --~--~-~--~~~---~--~~ 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: Getting all the models that have a foreign key to another model?!
Hi, I have been trying to figure this out for a few hours, but could not find anything. Is there a way that given a model (returned by django.db.models.get_models), to figure out if that model has a ForeingKey field to another model? I have a Category model, that other models can have a foreign key to it. In one of the views you can either pass a category to look for or pass nothing, in which case it should return all the items that can be Categorized (i.e. their model class has a foreign key to Category) even if the item itself does not have a category assigned. So I am trying to get all the content_types that can be categorized and then return all the items for these types. Any insight would be greatly appreciated. -- Thanks, Medhat --~--~-~--~~~---~--~~ 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: Creating an empty queryset
The patch is in http://code.djangoproject.com/ticket/3283 -- Thanks, Medhat --~--~-~--~~~---~--~~ 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: Creating an empty queryset
Well, the patch now has documentation and tests. -- Thanks, Medhat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
a password field?
Hi all, Ok, here is a question for anybody who might have a quick answer (since I can't find it in the documentation, and am too lazy to try to find it in the code :-)) Is there an eazy way to add a password field (similar to the one in the User model) in my model? What I need is a field that I can compare some value to without storing the clear-text value in the field. (of course using the User model itself is not an option in my case, otherwise I would have not asked the question.) -- Thanks, Medhat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Accessing instance values in a model...
Probably the title is not very accurate, but I did not know how to word it any better! Probably the following scenarios will make it clearer: 1. I would like to generate the 'upload_to' parameter of the FileField based on the value of another field in my model. example: === class File(models.Model): title = models.CharField(maxlength=50) project = models.ForeignKey(Project) document = models.FileField(upload_to='files/' + self.title + '/',blank=True,null=True) === 2. I would like to use some value from my instance to create the Q object passed to the 'limit_choices_to' parameter. example: === class File(models.Model): title = models.CharField(maxlength=50) project = models.ForeignKey(Project) supercedes = models.ForeignKey('self',limit_choices_to=Q(project=self.project,blank=True,null=True) === Is there any way to do that? It seems to me that having an "automatic" self variable that will be mapped to the instance would solve this problem... any thoughts? 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: Accessing instance values in a model...
Any insight from the django gurus out there? 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: FileField with custom upload_to
Jay Parlar wrote: > I went ahead and filed a patch with Trac, > http://code.djangoproject.com/ticket/1994 > > Jay P. I like this solution... actually, I was trying to achieve something similar and came up with an almost identical solution. So, I am +1 for this patch. -- Thanks, Medhat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
help with constructing a query
Hi, If you have a many-to-many field, let's say for example Employee and Project, is there a way given an arbitrary list of projects to get they employees who work on all projects? (i.e. each on of the employees in the result must be working on *all* projects in the list) I am interested in doing this with one resultant Q object. I can do it with multiple queries and then building the list in python. Thanks! -- Medhat --~--~-~--~~~---~--~~ 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: help with constructing a query
Thanks, I understood the sql solution on your blog... but still can't figure out how to map that to django... waiting to read your next blog post :-) -- Medhat Malcolm Tredinnick wrote: > On Mon, 2006-06-12 at 12:09 -0700, medhat wrote: > > Hi, > > > > If you have a many-to-many field, let's say for example Employee and > > Project, is there a way given an arbitrary list of projects to get they > > employees who work on all projects? (i.e. each on of the employees in > > the result must be working on *all* projects in the list) > > > > I am interested in doing this with one resultant Q object. I can do it > > with multiple queries and then building the list in python. > > Wow, deja vu. > > This came up a while back in a thread on this list [1] and we came up > with a solution at the time. Subsequent to that, I realised the original > solution was unnecessarily ugly and when I had to implement the same > thing in a personal project last week, I decided to write up the > solution as a series of blog posts. It's turning into a multi-part blog > posting. The SQL "problem" is at [2] and a discussion of a solution is > at [3]. Later today, I will write up how to use this effectively in > Django, so if you can wait eight hours, it will be up. Or maybe just > seeing the original thread or SQL query will give you the clues you > need. > > [1] > http://groups.google.com/group/django-users/browse_thread/thread/065ad54287e10bbd/8f410e522e003a9a > > [2] http://www.pointy-stick.com/blog/2006/06/12/sql-puzzle/ > > [3] http://www.pointy-stick.com/blog/2006/06/13/sql-puzzle-solution/ > > Best wishes, > 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 -~--~~~~--~~--~--~---
Non-database fields on the admin side?
Hi, Is there an easy way to create filds on the admin side that don't have database columns behind them? I am thinking of something whose value will drive some functionality in the save() method in the model, but does not need to be saved. If this does not exist, how about the following feature suggestion: Have one of the parameters in the Field to specify that this field should not have a database column, and another field that will specify a model function that should be called to populate that field when it is displayed. -- Regards, Medhat --~--~-~--~~~---~--~~ 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: Creating User Accounts
So, is there a way to not have to repeat the fields (from the example) "username" and "password" in the customer model? I wanted to achive something similar to this, but I don't want to duplicate the fields (look at my related question in http://groups.google.com/group/django-users/browse_thread/thread/273e6b20740e5429/#) Thanks, medhat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
notification when an object is deleted
Hi, I have the following scenario: A ticket system where users can create tickets. A ticket object has a foreign key field to a user object. I would like to delete all the tickets created by a user if that user is deleted. Is there a way to do this *without* changing the user model? -- Thanks, Medhat --~--~-~--~~~---~--~~ 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: notification when an object is deleted
Joe wrote: > You could write a database trigger and bypass Django entirely. but I would like to keep it all in python. first, I am not an sql expert, and second I don't want to worry about the different possible backends. --~--~-~--~~~---~--~~ 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: notification when an object is deleted
James Bennett wrote: > It should happen automatically; Django emulates SQL's "ON DELETE > CASCADE" behavior when deleting an object to which other objects were > related. This has been really confusing to me... I have seen it happen sometimes, but it does not happen for all models or all kinds of relations. I will need to look deeper to figure out why it is not happening in my case. --~--~-~--~~~---~--~~ 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: notification when an object is deleted
Ian Clelland wrote: > I would have thought that this would have been automatic -- normally > Django does a good job of telling me, when I delete an object, about > any other objects related to it which will also be deleted. Ok, I am sorry, but I am still confused! :( First, I am using sqlite... and I checked the manage.py sqlall and it had no "on delete cascade" at all. So, is this done programmatically in python to simulate the same effect? And I had the ticket model with two foreign keys to the user record (who reported it, and who fixed it) the first one is required, while the second one is not. When I delete the user in the admin side it tells me that it will also delete all the tickes that are created by that user, but not the ones fixed by the user. So here I have a few questions: 1. Why did it do that (not that I am complaining, I just want to understand) does it have to do with one field being required and the other not? 2. Is this behavior documented anywhere? It feels a bit of magic to me when it is hard to predict how the software will behave! 3. I am still looking for an answer to my original question at the beginning of this discussion. What if I don't want to delete the tickets but assign them to another user? -- Thanks, Medhat --~--~-~--~~~---~--~~ 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: notification when an object is deleted
Ian Clelland wrote: > > 3. I am still looking for an answer to my original question at the > > beginning of this discussion. What if I don't want to delete the > > tickets but assign them to another user? > > Was that the original question? > > All I saw was: > > On 8/17/06, medhat <[EMAIL PROTECTED]> wrote: > > I would like to delete all the tickets created by a user if that user is > > deleted. Is there a way to do this *without* changing the user model? Well, I am sorry... after reading my post again, I found that it sounded a bit harsh. Anyway, the question I refered to is the subject of the discussion which can be paraphrased: "can I get some kind of notification when an object is deleted?" After reading all the responses it seems that I can't, and that I will need to create the custom view. I was just hoping to do it all from the admin. I was hoping dispatchers can be used for this (my only knowledge of dispatchers is how I use them to creat objects when syncdb is called) -- Thanks, Medhat --~--~-~--~~~---~--~~ 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: notification when an object is deleted
medhat wrote: > Ian Clelland wrote: > > > 3. I am still looking for an answer to my original question at the > > > beginning of this discussion. What if I don't want to delete the > > > tickets but assign them to another user? > > > > Was that the original question? > > > > All I saw was: > > > > On 8/17/06, medhat <[EMAIL PROTECTED]> wrote: > > > I would like to delete all the tickets created by a user if that user is > > > deleted. Is there a way to do this *without* changing the user model? > > Well, I am sorry... after reading my post again, I found that it > sounded a bit harsh. Anyway, the question I refered to is the subject > of the discussion which can be paraphrased: "can I get some kind of > notification when an object is deleted?" After reading all the > responses it seems that I can't, and that I will need to create the > custom view. I was just hoping to do it all from the admin. I was > hoping dispatchers can be used for this (my only knowledge of > dispatchers is how I use them to creat objects when syncdb is called) > > -- > Thanks, > Medhat Ok, I digged a little deeper in the code... and it seems that I *can* use dispatchers for that, since in django.db.models.signals there is a "pre_delete" and a "post_delete" signal defined. The only thing is that I don't see these signals sent to the dispatcher in django.db.models.base. Is this a bug? or am I missing something? If it is I will file a ticket. --~--~-~--~~~---~--~~ 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: urls.py changes ignored
Rock wrote: > Yes I did. No help. > > Then I forced the creation of a new urls.pyc by importing urls.py in > "python manage.py shell" and importing urls.py and explicitly checking > that the correct number of urlpatterns were defined. Still no joy in > the browser though. > > Note that the access_log shows my request but the error_log logs no > associated errors. If you are using Apache with mod_python you will need to restart the webserver. -- Medhat Assaad --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
edit_inline on the other end of the OneToOneField
Hello, I used edit_inline with a OneToOneField and it worked. I am trying to extend the user model, but with multiple OneToOneField models. For example, I might have an Employee model that has a OneToOneField to User, and a Customer model with a OneToOneField to User. Now, if I add 'edit_inline' to those OneToOneFields, it adds the ability to edit Employee and Customer from the User page. I want to do the opposite, whenever I am editing an Employee, I want to have the ability to edit the associated User. Of course I would like to do this wihtout editing the User model itself. Am I approaching this the correct way? or do I have to think about it differently? -- Thanks! Medhat Assaad --~--~-~--~~~---~--~~ 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: Pointing to Memcached on Remote Server
Hi Matt, Did you check that port 11211 is open for connections on the remote server? Regards, Medhat On Fri, Dec 2, 2011 at 2:49 PM, mattym wrote: > Hi all - > > I am stuck on this one. Caching with memcached works when I reference > the local box holding Django. But when I point my setting to a remote > box it does not cache: > > This is with Django 1.3 using python-memcached on the localbox in a > virtualenv > > 'default': { >'BACKEND': > 'django.core.cache.backends.memcached.MemcachedCache', >#'LOCATION': ['127.0.0.1:11211',] # This works >'LOCATION': ['xx.xxx.xxx.xx:11211',] # This remote one does not >} > > My settings file appears to have the proper middleware installed: > > "django.middleware.gzip.GZipMiddleware", > "django.middleware.cache.UpdateCacheMiddleware", >"django.contrib.sessions.middleware.SessionMiddleware", >"django.contrib.auth.middleware.AuthenticationMiddleware", >"django.contrib.redirects.middleware.RedirectFallbackMiddleware", >"mezzanine.core.middleware.DeviceAwareUpdateCacheMiddleware", >"django.middleware.common.CommonMiddleware", >"django.middleware.csrf.CsrfViewMiddleware", >"mezzanine.core.middleware.DeviceAwareFetchFromCacheMiddleware", >"mezzanine.core.middleware.AdminLoginInterfaceSelector", >"django.middleware.cache.FetchFromCacheMiddleware", > > I've checked that memcached is running on the remote box. I am > probably overlooking something simple. > Any help is greatly appreciated. > > Thanks, > 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 > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.