Re: Site Framework
2014-07-23 12:52 GMT+02:00 Akshay Mukadam <mukadam.aks...@gmail.com>: > Why do we use Site Framework in django > https://docs.djangoproject.com/en/dev/ref/contrib/sites/#how-django-uses-the-sites-framework -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEaW5xyXvMDLSuW5js35uB10%3DkOiLGXXhXeLpczVCdycu1Ys1Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Site Framework
Why do we use Site Framework in django -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a88d7f2b-ac07-4c17-9e6f-100dca509d58%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Overriding save() + site framework = nothing changed when clicking save in the admin
I got some help on the Django IRC channel: The anwser is that django save m2m relationship in the admin by calling 'clear' on it, then setting it. I means that the form destroy any attached data to the object then add the ones in you entered in the admin. It works outside the admin because we don't use the admin form that clear the m2m relationship. The reason it works for tags in the admin is that the tagging application doesn't use m2m but emulate it by placing a TaggedItem object with a foreign key to a tag and to your model with a generic relation. Plus it's an inline field inclusion. I think a possible solution is to create a custom admin form and add the site from here. On 13 mai, 00:03, ksamuelwrote: > I overrided the save method of one of my model to it sync its sites > with its parent sites: > > def save(self, *args, **kwargs): > > ret = models.Model.save(self, *args, **kwargs) > > if self.id: > > for site in self.parent.sites.all(): > self.sites.add(site.id) > > This code work, except when you save the object in the admin. Using > PDB, I can see that self.parent.sites.all() return something at the > end of send. But right after, the relations disapears. I'm not > (willingly at least) using transactions. > > More details > here:http://stackoverflow.com/questions/5982347/why-is-adding-site-to-an-o... -- 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.
Overriding save() + site framework = nothing changed when clicking save in the admin
I overrided the save method of one of my model to it sync its sites with its parent sites: def save(self, *args, **kwargs): ret = models.Model.save(self, *args, **kwargs) if self.id: for site in self.parent.sites.all(): self.sites.add(site.id) This code work, except when you save the object in the admin. Using PDB, I can see that self.parent.sites.all() return something at the end of send. But right after, the relations disapears. I'm not (willingly at least) using transactions. More details here: http://stackoverflow.com/questions/5982347/why-is-adding-site-to-an-object-doesnt-seem-to-work-in-a-save-override-in-the -- 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.
how to provide fixtures for django site framework?
I read the django document, I know how to create fixtures for app, but how can I provide initial_data for django site framework? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: a question about site framework
Kai: I was worrying about how to use the django database api to do site related queries. I mean how do I simply retrieve articles of a site without having to use the custom query. Harry On Aug 1, 9:36 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote: > Hi Harry, > > On 8/2/07, gt7658b <[EMAIL PROTECTED]> wrote: > > > > > Kai: > > > Thanks for the suggestions. In this case, my Article will have > > relationship with category, not directly withsite. Will I still be > > able to take advantage of the functions ofsiteframework? > > I don't understand you (well, it's late.. maybe that's the reason). > Your articles have a realtionship with a category and a > category belongs to one-or-more sites. Isn't that what you > wanted? > > Kai --~--~-~--~~~---~--~~ 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 site framework
Hi Harry, On 8/2/07, gt7658b <[EMAIL PROTECTED]> wrote: > > Kai: > > Thanks for the suggestions. In this case, my Article will have > relationship with category, not directly with site. Will I still be > able to take advantage of the functions of site framework? I don't understand you (well, it's late.. maybe that's the reason). Your articles have a realtionship with a category and a category belongs to one-or-more sites. Isn't that what you wanted? Kai --~--~-~--~~~---~--~~ 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 site framework
Kai: Thanks for the suggestions. In this case, my Article will have relationship with category, not directly with site. Will I still be able to take advantage of the functions of site framework? Harry On Jul 31, 9:45 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote: > ManyToManyField maybe is way better. Sorry, its late. --~--~-~--~~~---~--~~ 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 site framework
ManyToManyField maybe is way better. Sorry, its late. --~--~-~--~~~---~--~~ 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 site framework
Hi, On 8/1/07, Hai Dong <[EMAIL PROTECTED]> wrote: > > Hello: > > I got a question. What if I have two sites, and each site has several > categories (where articles belong to). For such kind of case what is the > best way of utilizing the site framework. What about a ForeignKey field in the categories model pointing to a site? Something like: from django.contrib.sites.models import Site class Category(models.Model): site = models.ForeignKey(Site) > Thanks, > Harry Kai --~--~-~--~~~---~--~~ 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 question about site framework
Hello: I got a question. What if I have two sites, and each site has several categories (where articles belong to). For such kind of case what is the best way of utilizing the site framework. Thanks, Harry --~--~-~--~~~---~--~~ 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: Site framework
On 12 heinä, 05:30, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/11/07, Glebb <[EMAIL PROTECTED]> wrote: > > > I'm not aware of anything that would be causing this sort of problem. > To help you debug, we will need to see some actual code - 'it > complains' isn't really that helpful as debugging information. It seems the problem mysteriously went away. Now it works just like I imagined it would. I have no idea why it didn't work at first. I obviously changed something but I just don't understand what it was. Oh well, nevermind.. but thank you anyway. Glebb --~--~-~--~~~---~--~~ 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: Site framework
On 7/11/07, Glebb <[EMAIL PROTECTED]> wrote: > > Hi, I'm trying to use the site framework, and it works, but I just > have one problem. I have a form (from form_for_model for example) > which represents an object which has a site foreign key. The site > selection shows up just fine in the form. But when I try to submit it, > it complains about the site_id being null (event though the site > variable in request.POST is correct, site id that is). Am I doing > something wrong or how I'm supposed to accomplish this? I'm not aware of anything that would be causing this sort of problem. To help you debug, we will need to see some actual code - 'it complains' isn't really that helpful as debugging information. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Site framework
Hi, I'm trying to use the site framework, and it works, but I just have one problem. I have a form (from form_for_model for example) which represents an object which has a site foreign key. The site selection shows up just fine in the form. But when I try to submit it, it complains about the site_id being null (event though the site variable in request.POST is correct, site id that is). Am I doing something wrong or how I'm supposed to accomplish this? The admin site works just fine, I can create objects there but I really need a set up a form for my site. For now, I set the site field in models.py to blank=True, and after submission I manually set the site field. This is, however, not very intuitive way of doing this. Is newforms still lacking this or is there something else I need to take in consideration? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---