Re: How to debug ORM filter stacking?
Dnia 25-09-2010 o 06:17:10 ydjango napisał(a): I am stacking filters on queryset. For some reason the second filter in stack is not applying and it is not giving any error either. Any way to debug what is going on? python manage.py shell Import ur model, and build ur queries live. ipython has neat autoompletion feature. You might be able to figure out why it is working like it is. -- Linux user -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: How to debug ORM filter stacking?
Are you sure you are saving the new QuerySet that gets created by the filter? I'm guessing you are doing something like: qs = MyModel.objects.filter(field1="somevalue") if condition: qs.filter("someothervalue") What you need to do is save the value of the second filter() call. qs = MyModel.objects.filter(field1="somevalue") if condition: qs = qs.filter("someothervalue") filter() returns a new queryset object rather than modifying the queryset in place. I usually debug SQL problems by using the http://github.com/robhudson/django-debug-toolbar or pdb. With pdb you can put import pdb;pdb.set_trace() where you would like pdb to stop and it will allow you to debug from there. Simply showing the results of the queryset usually gives some clues as to what the problem is. In pdb you can see what sql will get run by running (Pdb) print queryset.query pdb's commands are explained here: http://docs.python.org/library/pdb.html#debugger-commands On Sat, Sep 25, 2010 at 1:17 PM, ydjango wrote: > I am stacking filters on queryset. For some reason the second filter > in stack is not applying and it is not giving any error either. Any > way to debug what is going 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-us...@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. > > -- Ian http://www.ianlewis.org/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: reverse ForeignKey
I've tried to do something like that: class Pacienti_manager(models.Manager): def get_visible(self): return(super(Pacienti_manager, self).get_query_set().filter(pacient_id__exact=pacient_id) but still no go, I tried def queryset(self, request): qs= super(Pacient, self).queryset(request) return qs.filter(exit_pacient_id=pacient_id) in Pacient class, but again all objects in Pacient who have an Exit do show up in the view. Any ideas what I'm doing wrong? 2010/9/23 Vali Lungu : > Hi, > > You may be interested in this: > http://stackoverflow.com/questions/2618893/how-to-filter-queryset-in-changelist-view-in-django-admin, > looks like a similar (solved) problem. > In short, it's about overriding the queryset() method of ModelAdmin. > > On Thu, Sep 23, 2010 at 11:33 AM, ionut cristian cucu > wrote: >> >> Hi list, >> I just came to django, and to web programming for that matter, so my >> question is from a n0b: >> I have to models: >> class Pacient(models.Model): >> name=models.CharField('name', max_length=123) >> >> class Exit(models.Model): >> pacient=models.ForeignKey(Pacient) >> >> >> How to I get the admin interface to show only the pacients for whom I >> have no exit objects. >> Rephrase: if I have an Exit object for a Pacient, I don't want that >> Pacient object to show up >> 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-us...@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-us...@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-us...@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: Since Django 1.2.3, I can't display any Form
Hi, I finally came up with the same conclusion and I moved the allnew django directory to /Library/Python/2.6/site-packages/ to replace the old one. It seemed to work. Thanks for your quick answer! François. On 25 sep, 04:57, Karen Tracey wrote: > 2010/9/24 François Bonnefont > > > > > I am new to this group and not sure how to present my problem > > correctly... > > > I was working with django 1.1 and made a very small and simple > > application with a "ContactForm" not related to any model. > > > My forms.py : > > > from django import forms > > > class ContactForm(forms.Form): > > firstname = forms.CharField(max_length=50) > > lastname = forms.CharField(max_length=50) > > > Recently I updated to Django 1.2.3 and since then I get : > > > "AttributeError: 'CharField' object has no attribute 'prepare_value'" > > when I try to print this form (or any other form). > > It sounds like your 1.2.3 update did not entirely work. Specifically the > error seems to imply you are running with a 1.2.3 level of the > django/forms/forms.py file but some earlier level of django/forms/fields.py. > I'd delete the current Django installation and re-install 1.2.3 from > scratch. > > Karen > --http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
Extending Profile with a ForeignKey field
Hi, I want to add a ForeignKey field in UserProfile. Sth like this: from myapp.models import Person class Profile(models.Model): user = models.ForeignKey(User, unique=True, verbose_name=_('user')) name = models.CharField(_('name'), max_length=50, null=True, blank=True) about = models.TextField(_('about'), null=True, blank=True) location = models.CharField(_('location'), max_length=40, null=True, blank=True) website = models.URLField(_('website'), null=True, blank=True, verify_exists=False) person = models.ForeignKey(Person, unique=True, vervose_name=_('person')) But in Signup form, I got this error: IntegrityError profiles_profile.person_id may not be NULL What should I do? 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-us...@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: Extending Profile with a ForeignKey field
i think you use a string for filling that field . but can you please post the form code too ? out of topic : Are you iranian ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: fixtures and dates
Thanks Shawn. I looked back in my model and found I left off something in my unicode. On Sep 24, 1:44 pm, Shawn Milochik wrote: > We need more information. Preferably the full traceback. > > In short, something is trying to add a date object to a unicode text > object. Possibly the date as a date object and the time as a unicode > string. How did you convert the original data to JSON? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: reverse ForeignKey
On Sep 25, 9:51 am, ionut cristian cucu wrote: > I've tried to do something like that: > class Pacienti_manager(models.Manager): > def get_visible(self): > return(super(Pacienti_manager, > self).get_query_set().filter(pacient_id__exact=pacient_id) > but still no go, I tried > def queryset(self, request): > qs= super(Pacient, self).queryset(request) > return qs.filter(exit_pacient_id=pacient_id) > in Pacient class, but again all objects in Pacient who have an Exit do > show up in the view. > Any ideas what I'm doing wrong? That method needs to go in your ModelAdmin class, not your model. -- DR. > 2010/9/23 Vali Lungu : > > > > > Hi, > > > You may be interested in this: > >http://stackoverflow.com/questions/2618893/how-to-filter-queryset-in-..., > > looks like a similar (solved) problem. > > In short, it's about overriding the queryset() method of ModelAdmin. > > > On Thu, Sep 23, 2010 at 11:33 AM, ionut cristian cucu > > wrote: > > >> Hi list, > >> I just came to django, and to web programming for that matter, so my > >> question is from a n0b: > >> I have to models: > >> class Pacient(models.Model): > >> name=models.CharField('name', max_length=123) > >> > >> class Exit(models.Model): > >> pacient=models.ForeignKey(Pacient) > >> > > >> How to I get the admin interface to show only the pacients for whom I > >> have no exit objects. > >> Rephrase: if I have an Exit object for a Pacient, I don't want that > >> Pacient object to show up > >> 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-us...@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-us...@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-us...@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: The REAL superuser
Thanks for replying so quickly. I thought that since I could not find the problem, I'll just paste the contents of the files into an email. # models.py from django.db import models from django.contrib import admin from blog import posts class Posts(models.Model): title = models.CharField(max_length=30, verbose_name='Title') body = models.TextField(verbose_name='Body') def __unicode__(self): return self.title # admin.py from django.db import models from django.contrib import admin from blog import posts class PostsAdmin(admin.ModelAdmin): list_display = ('title', 'body') admin.site.register(Posts, PostsAdmin) # urls.py from django.conf.urls.defaults import * from django.contrib import admin from blog import posts admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), ) Thanks! On Fri, Sep 24, 2010 at 10:41 PM, Karen Tracey wrote: > On Fri, Sep 24, 2010 at 6:02 PM, aug dawg wrote: > >> Hey all, >> >> I'm currently learning how to use Django, so earlier this evening I spent >> about 30 minutes working on a blog engine. I used the admin interface and >> ran 'python manage.py syncdb'. I then run the dev server. I log in to the >> admin interface successfully, but then it says I don't have permission to >> edit anything. I even manually created a superuser. Can anyone help me out? >> >> > Admin says you don't have permission to edit anything regardless of your > superuser status when it there have been no models registered for it to > manage. So either there are no admin.py files in any of the INSTALLED_APPS > or (more likely) the admin.autodiscover() call in urls.py has been left > commented out (part of the instructions for enabling the admin include > uncommenting that line. The admin.autodiscover() call is what ensures the > registrations done in admin.py files in all installed apps are actually > executed. > > Karen > -- > http://tracey.org/kmt/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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: Universal form
Hello, You're assuming that form are called only from views. Some Form methods are mostly used inside templates like as_p for example. Another assumption you made is that all url point to html ressources. Images, javascripts can have their url. Generation of pdf, csv and AJAX mechanics are other examples. As far as I understand, you want to display a login form in all your html pages. My first thought is to place it in a template extended by all html pages (I think about Django documentation 'base.html' template). You can't call the form's as_p (or whatever you want) as the form is missing from your context and built-in template tags and filters do not provide directly (AFAIK) what you need for that purpose but you can write your own [1][2]. Your context already provides request.user; you can use it to display login form or logout link according this context. I don't know if this is a correct way to handle the case: maybe I'll do it another way with experience. The purpose is to point that you don't necessaraly need to work on "every function" from your views. Regards [1] http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ [2] http://docs.djangoproject.com/en/dev/topics/auth/#module-django.contrib.auth.forms -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Universal form
Le 25/09/2010 14:52, werefr0g a écrit : You're assuming that form are called only from views. Some Form methods are mostly used inside templates like as_p for example. Sorry for the double post but this statement is far from accurate (to be kind with myself). You can use form in a template without any kind of preparation in the views. This maybe pointless in most practical cases but developpers are inclined to behave weirdly (this is a lame explanation but this is at least accurate). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: How do you set choices in your application?
Hello, I'm not legitimate to answer you but I'm adding other options that experienced people can comment. I'd rather use a ForeignKey in that context but I don't have to think to much to performances in my apps. You can easily add status, handle i18n this way. I must confess that writing "data in hard" into the code itself makes me nervous too. This is a documented option so maybe some arguments we'll help to overcome this bias. If performances are an issue, I think about caching and I'll go to your third solution with http://docs.djangoproject.com/en/dev/ref/models/querysets/#pickling-querysets with maybe some "caching" issues to deal with. By the way, I'll add to Russel's comments that even if someone tries to answer you, this can be time consuming because this answer will be send to the community and it better be as correct as possible (both in social, formal and technical domains) and that implies reviewing your answer. You can take also in consideration than for some people, english is not really flowing when their main mentor is exception.Exception. Regards, Le 25/09/2010 02:51, Yo-Yo Ma a écrit : Let's say I have a model with a field called "status". I could set the choices in three ways: 1) status_choices = ((1, 'Completed'), (2, 'Unfinished'), (3, 'Cancelled')) 2) status_choices = (('COM', 'Completed'), ('UNF', 'Unfinished'), ('CAN', 'Cancelled')) Or, 3 ): db_choices = Choice.objects.all() status_choices = [[choice.pk, choice.description] for choice in db_choices] Is there any best practice? Note: Client's won't be able to define these choices. They'll all be defined by me (or else DB would be the answer of course). My thoughts: 1) Risky (data is useless without python file), 2) Slower, and risky because it might be difficult to change later, 3) a lot of work, and slow (because of DB). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: The REAL superuser
Hello Aug dawg, Your code seems fine. You said: " I even manually created a superuser". What does it mean?, How did you create super user?, and check your auth_user_user_permission table in the database. Does it mapped your user and required permissions. good luck! On Sep 25, 8:36 pm, aug dawg wrote: > Thanks for replying so quickly. > > I thought that since I could not find the problem, I'll just paste the > contents of the files into an email. > > # models.py > > from django.db import models > from django.contrib import admin > from blog import posts > > class Posts(models.Model): > title = models.CharField(max_length=30, verbose_name='Title') > body = models.TextField(verbose_name='Body') > def __unicode__(self): > return self.title > > # admin.py > > from django.db import models > from django.contrib import admin > from blog import posts > > class PostsAdmin(admin.ModelAdmin): > list_display = ('title', 'body') > > admin.site.register(Posts, PostsAdmin) > > # urls.py > > from django.conf.urls.defaults import * > from django.contrib import admin > from blog import posts > > admin.autodiscover() > > urlpatterns = patterns('', > (r'^admin/', include(admin.site.urls)), > ) > > Thanks! > > > > On Fri, Sep 24, 2010 at 10:41 PM, Karen Tracey wrote: > > On Fri, Sep 24, 2010 at 6:02 PM, aug dawg wrote: > > >> Hey all, > > >> I'm currently learning how to use Django, so earlier this evening I spent > >> about 30 minutes working on a blog engine. I used the admin interface and > >> ran 'python manage.py syncdb'. I then run the dev server. I log in to the > >> admin interface successfully, but then it says I don't have permission to > >> edit anything. I even manually created a superuser. Can anyone help me out? > > > Admin says you don't have permission to edit anything regardless of your > > superuser status when it there have been no models registered for it to > > manage. So either there are no admin.py files in any of the INSTALLED_APPS > > or (more likely) the admin.autodiscover() call in urls.py has been left > > commented out (part of the instructions for enabling the admin include > > uncommenting that line. The admin.autodiscover() call is what ensures the > > registrations done in admin.py files in all installed apps are actually > > executed. > > > Karen > > -- > >http://tracey.org/kmt/ > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com > groups.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-us...@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.
SITE_ID
Hey, I do have problem with SITE_ID. I don't really get this. What is it? I am using the django registration from bitbucker. When I click on register I get the following error-message: You're using the Django "sites framework" without having set the SITE_ID setting. Create a site in your database and set the SITE_ID setting to fix this error. Am I right that I do have to set an ID in my database? For example mysql > test.db table 1? settings.py SITE_ID = 1 Can somebody write me a little tutorial? Thanks, Craphunter PS: Sorry, newbee! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: SITE_ID
http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#site-id On Sep 25, 2010, at 10:50 AM, craphunter wrote: > Hey, > > I do have problem with SITE_ID. I don't really get this. What is it? > > I am using the django registration from bitbucker. When I click on > register I get the following error-message: > > You're using the Django "sites framework" without having set the > SITE_ID setting. Create a site in your database and set the SITE_ID > setting to fix this error. > > Am I right that I do have to set an ID in my database? > > For example > mysql > test.db table 1? > > settings.py > > SITE_ID = 1 > > Can somebody write me a little tutorial? > > Thanks, > > Craphunter > > PS: Sorry, newbee! > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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: SITE_ID
Yes, I have read it, but I don't really get it. What is the meaning of it? Craphunter On 25 Sep., 16:51, Max Countryman wrote: > http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#site-id > > On Sep 25, 2010, at 10:50 AM, craphunter wrote: > > > Hey, > > > I do have problem with SITE_ID. I don't really get this. What is it? > > > I am using the django registration from bitbucker. When I click on > > register I get the following error-message: > > > You're using the Django "sites framework" without having set the > > SITE_ID setting. Create a site in your database and set the SITE_ID > > setting to fix this error. > > > Am I right that I do have to set an ID in my database? > > > For example > > mysql > test.db table 1? > > > settings.py > > > SITE_ID = 1 > > > Can somebody write me a little tutorial? > > > Thanks, > > > Craphunter > > > PS: Sorry, newbee! > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://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-us...@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: SITE_ID
Yes, I have read it, but I don't really get it. What ist the meaning? What do I have to do?! Craphunter On 25 Sep., 16:50, craphunter wrote: > Hey, > > I do have problem with SITE_ID. I don't really get this. What is it? > > I am using the django registration from bitbucker. When I click on > register I get the following error-message: > > You're using the Django "sites framework" without having set the > SITE_ID setting. Create a site in your database and set the SITE_ID > setting to fix this error. > > Am I right that I do have to set an ID in my database? > > For example > mysql > test.db table 1? > > settings.py > > SITE_ID = 1 > > Can somebody write me a little tutorial? > > Thanks, > > Craphunter > > PS: Sorry, newbee! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: SITE_ID
Have you set SITE_ID in your settings.py file and run 'python manage.py syncdb'? On Sep 25, 2010, at 10:59 AM, craphunter wrote: > Yes, I have read it, but I don't really get it. What ist the meaning? > What do I have to do?! > > Craphunter > > On 25 Sep., 16:50, craphunter wrote: >> Hey, >> >> I do have problem with SITE_ID. I don't really get this. What is it? >> >> I am using the django registration from bitbucker. When I click on >> register I get the following error-message: >> >> You're using the Django "sites framework" without having set the >> SITE_ID setting. Create a site in your database and set the SITE_ID >> setting to fix this error. >> >> Am I right that I do have to set an ID in my database? >> >> For example >> mysql > test.db table 1? >> >> settings.py >> >> SITE_ID = 1 >> >> Can somebody write me a little tutorial? >> >> Thanks, >> >> Craphunter >> >> PS: Sorry, newbee! > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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: SITE_ID
Hello, I searched the web for your error message and found that maybe you should see at INSTALLED_APPS level [1]. Regards, [1] http://www.pubbs.net/200908/django/40799-django-sites-framework.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: The REAL superuser
When I say I manually created a superuser, I used the command 'python manage.py createsuperuser' and created another one. What was that about the auth_user_user_permission table? On Sat, Sep 25, 2010 at 10:42 AM, nyambaa wrote: > Hello Aug dawg, > Your code seems fine. You said: " I even manually created a > superuser". What does it mean?, How did you create super user?, and > check your auth_user_user_permission table in the database. Does it > mapped your user and required permissions. > > good luck! > > On Sep 25, 8:36 pm, aug dawg wrote: > > Thanks for replying so quickly. > > > > I thought that since I could not find the problem, I'll just paste the > > contents of the files into an email. > > > > # models.py > > > > from django.db import models > > from django.contrib import admin > > from blog import posts > > > > class Posts(models.Model): > > title = models.CharField(max_length=30, verbose_name='Title') > > body = models.TextField(verbose_name='Body') > > def __unicode__(self): > > return self.title > > > > # admin.py > > > > from django.db import models > > from django.contrib import admin > > from blog import posts > > > > class PostsAdmin(admin.ModelAdmin): > > list_display = ('title', 'body') > > > > admin.site.register(Posts, PostsAdmin) > > > > # urls.py > > > > from django.conf.urls.defaults import * > > from django.contrib import admin > > from blog import posts > > > > admin.autodiscover() > > > > urlpatterns = patterns('', > > (r'^admin/', include(admin.site.urls)), > > ) > > > > Thanks! > > > > > > > > On Fri, Sep 24, 2010 at 10:41 PM, Karen Tracey > wrote: > > > On Fri, Sep 24, 2010 at 6:02 PM, aug dawg wrote: > > > > >> Hey all, > > > > >> I'm currently learning how to use Django, so earlier this evening I > spent > > >> about 30 minutes working on a blog engine. I used the admin interface > and > > >> ran 'python manage.py syncdb'. I then run the dev server. I log in to > the > > >> admin interface successfully, but then it says I don't have permission > to > > >> edit anything. I even manually created a superuser. Can anyone help me > out? > > > > > Admin says you don't have permission to edit anything regardless of > your > > > superuser status when it there have been no models registered for it to > > > manage. So either there are no admin.py files in any of the > INSTALLED_APPS > > > or (more likely) the admin.autodiscover() call in urls.py has been left > > > commented out (part of the instructions for enabling the admin include > > > uncommenting that line. The admin.autodiscover() call is what ensures > the > > > registrations done in admin.py files in all installed apps are actually > > > executed. > > > > > Karen > > > -- > > >http://tracey.org/kmt/ > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Django users" group. > > > To post to this group, send email to django-us...@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-us...@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-us...@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.
Django on Apache
I am about a week into learning Django, having developed with PHP and the CodeIgniter framework for the past 3 years. That said, I'm used to making a change to a file, refreshing my browser and seeing the results. Django's "syncdb" aside, it's been pretty weird having to restart the Django webserver manually on certain occasions. Is this also the case when running Django on Apache? If not, can I set up Django to run with MAMP locally? 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-us...@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: Django on Apache
MAMP can be a bit of a pain I think sometimes to modify, though I haven't used it much in the past few years. You can use the Mac's built-in apache server though with mod_python. Check out http://www.google.com/search?q=mod_python+mac+os+x&ie=UTF-8&oe=UTF-8&hl=en&client=safari Sent from my iPhone On Sep 25, 2010, at 11:07 AM, Derek wrote: > I am about a week into learning Django, having developed with PHP and > the CodeIgniter framework for the past 3 years. That said, I'm used > to making a change to a file, refreshing my browser and seeing the > results. > > Django's "syncdb" aside, it's been pretty weird having to restart the > Django webserver manually on certain occasions. Is this also the case > when running Django on Apache? If not, can I set up Django to run > with MAMP locally? > > 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-us...@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-us...@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: SITE_ID
On 25/09/10 15:57, craphunter wrote: Yes, I have read it, but I don't really get it. What is the meaning of it? Consider a website that has multiple blogs, all of which are deployed to the same database. Consider that you want each blog to be a separate URL: www.blog1.com, www.blog2.com, but you only want one database for ease of backing up etc. So, you have one codebase, one database, but multiple sites. You can achieve this using SITE_ID. www.blog1.com has a settings.py with SITE_ID = 1. www.blog2.com has a settings.py file with SITE_ID = 2. In your database, there are two rows in the django_site database table, with serials 1 and 2. The table that holds the blog entries has a foreign key to Site, and so identifies which site the blog post appears on. At least that's how I used it...hope that helps clarify it a bit! Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Django on Apache
On 25/09/10 16:07, Derek wrote: I am about a week into learning Django, having developed with PHP and the CodeIgniter framework for the past 3 years. That said, I'm used to making a change to a file, refreshing my browser and seeing the results. Django's "syncdb" aside, it's been pretty weird having to restart the Django webserver manually on certain occasions. Is this also the case when running Django on Apache? If not, can I set up Django to run with MAMP locally? If you're developing, you can use the built in test server and that will pick up changes without refreshing. If you're deploying on apache using mod_wsgi, you can set that up to automatically pick up your changes when the code updates. Details at: http://drumcoder.co.uk/blog/2009/nov/21/apache-mod_wsgi-config/ Hope that helps, Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Django on Apache
Thanks for the quick response, guys. I guess what confuses me is the need to EVER restart the server to pick up changes (excluding db syncs). It's been stated in many places (including Tim's response) that the test server will automatically pickup code changes, but on several occasions I've made changes to a view, and got a "cannot load page/no response" (from the browser, not a Django error). Once I quit the server (Control-C), start it up again and refresh the page, it works fine. Can someone briefly explain the difference between PHP apps -- which run your code "as is" without need for refreshing the server -- and Django? Again, much appreciated. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Problem with reversing url in test
This problem turned out to be related to specificity. Another url pattern was overriding the pattern that I was testing. On Sep 24, 9:43 pm, Brandon Taylor wrote: > So it appears to be something with django-cms' urls that are causing > issues with testing. I'm able to test any URL that isn't controlled by > dajngo-cms, like '/admin/' or whatever. > > Anyone else using django-cms v2 and Django 1.1.1 experiencing these > issues? > > TIA, > Brandon > > On Sep 24, 6:40 am, Brandon Taylor wrote: > > > So here's something else that's weird... > > > I can start a shell, load up the test Client and get the page in > > question: > > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) > > [GCC 4.4.3] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > (InteractiveConsole)>>> from django.test.client import Client > > >>> c = Client() > > >>> response = c.get('/categories/') > > >>> response.status_code > > > 200 > > > Anyone have any ideas what could be wrong with the unit test? > > > On Sep 23, 10:51 pm, Brandon Taylor wrote: > > > > Hi everyone, > > > > I'm having a problem with reversing a URL in a unit test: > > > > class ProductTestCase(TestCase): > > > def setUp(self): > > > self.client = Client > > > > def test_project_permalink(self): > > > project = Project.approved.all()[0] > > > url = project.get_absolute_url() > > > > I'm using an initial_data.json fixture that I exported from my current > > > database, and I'm able to use the get_absolute_url method to navigate > > > to a project detail page without error. > > > > When I try to reverse this url pattern in a test, I get a > > > NoReverseMatch exception. django-cms is also running on my site, but > > > disabling that app, and its url patterns doesn't make a difference. > > > > Anyone have any ideas on why this method would fail? > > > > TIA, > > > Brandon > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
error in urlconf
http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Django on Apache
On 25/09/10 19:36, Derek wrote: on several occasions I've made changes to a view, and got a "cannot load page/no response" (from the browser, not a Django error). Once I quit the server (Control-C), start it up again and refresh the page, it works fine. I get that sometimes too - I think it's just reloading the server as it has noticed a code change. Refresh again in the browser and it's usually working again. I find that if you're developing a template tag it's sometimes required to restart the server to pick up the new code. What I tend to do is try not to restart, and if something isn't working I'll restart the test server as my first test. If it still doesn't work then it's more than likely my fault rather than the server's... Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: error in urlconf
Dnia 25-09-2010 o 21:39:15 CarloRatm napisał(a): http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers http://docs.djangoproject.com/en/1.2/topics/http/urls/#example And check what ^ char mean http://en.wikipedia.org/wiki/Regular_expression_examples -- Linux user -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: error in urlconf
On 25/09/10 20:39, CarloRatm wrote: http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers ^blog/ ^(?Pd+)$ should be ^blog/ ^(?P\d+)/$ ?? Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: error in urlconf
Dnia 25-09-2010 o 22:04:16 Tim Sawyer napisał(a): On 25/09/10 20:39, CarloRatm wrote: http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers ^blog/ ^(?Pd+)$ should be ^blog/ ^(?P\d+)/$ ?? Tim. use raw definitions like django docs says. And why do u put ^ witch means beginning of the string in the middle? That i think would be correct: r'^articles/(?P\d+)/$' -- Linux user -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: error in urlconf
On 25/09/10 21:14, bagheera wrote: Dnia 25-09-2010 o 22:04:16 Tim Sawyer napisał(a): On 25/09/10 20:39, CarloRatm wrote: http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers ^blog/ ^(?Pd+)$ should be ^blog/ ^(?P\d+)/$ ?? Tim. use raw definitions like django docs says. And why do u put ^ witch means beginning of the string in the middle? That i think would be correct: r'^articles/(?P\d+)/$' I wasn't clear. I was correcting the error message, given that the provided pastebin link didn't include any of the source, but only the 404 text. The error appears to be from two levels of urls.py. The first something like: (r'^blog/', include('application.urls')), And the second, inside the application/urls.py file, is something like: (r'^(?Pd+)', 'applications.views.view_function'), This second one is wrong, I believe it should be: (r'^(?P\d+)/', 'applications.views.view_function'), I hope that is clearer, Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
Dajax isn't working
Hi all, I just start to use Dajax with my Pinax based project I followed the installation steps and it's almost working :P I tried to do a test just copying the following code from Dajax examplex: http://www.dajaxproject.com/random/ I'ts calling the randomize function correctly (and I can debug it), but it's not updating the field with the value. I understood that there's no need to write any js code, right? I just created my ajax.py and write this: *import random from dajax.core import Dajax from dajaxice.core import dajaxice_functions def randomize(request): dajax = Dajax() dajax.assign('#result','value',random.randint(1, 10)) return dajax.json() dajaxice_functions.register(randomize)* and added to my html code: Just changed the "examples" name to my app name. It's calling the function, I can debug it, but nothing change in my page. What am I doing wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Dajax isn't working
some extra informations: I'm adding this lines to my base html: {% dajaxice_js_import %} The response has the value(seems right): Dajax.process([{"cmd": "as", "id": "#result", "val": "5", "prop": "value"}]) and my js raise this error: Uncaught ReferenceError: Dajax is not defined but these error is not in my function randomize, this function has the Dajax import and it's working debuging it seems to be here that it's raising this error: self.shutdown_request(request) 2010/9/25 Daniel França > Hi all, > I just start to use Dajax with my Pinax based project > I followed the installation steps > > and it's almost working :P > > I tried to do a test just copying the following code from Dajax examplex: > http://www.dajaxproject.com/random/ > I'ts calling the randomize function correctly (and I can debug it), but > it's not updating the field with the value. > > I understood that there's no need to write any js code, right? > > I just created my ajax.py and write this: > > *import random > from dajax.core import Dajax > from dajaxice.core import dajaxice_functions > > def randomize(request): > dajax = Dajax() > dajax.assign('#result','value',random.randint(1, 10)) > return dajax.json() > > dajaxice_functions.register(randomize)* > > > and added to my html code: > > > > onclick="Dajaxice.examples.randomize('Dajax.process')"> > > Just changed the "examples" name to my app name. > > It's calling the function, I can debug it, but nothing change in my page. > > What am I doing wrong? > > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Dajax isn't working
It's working now.. I was referencing another jquery file 2010/9/25 Daniel França > some extra informations: > I'm adding this lines to my base html: > type="text/javascript"> > {% dajaxice_js_import %} > > The response has the value(seems right): > Dajax.process([{"cmd": "as", "id": "#result", "val": "5", "prop": > "value"}]) > > and my js raise this error: > Uncaught ReferenceError: Dajax is not defined > > but these error is not in my function randomize, this function has the > Dajax import and it's working > debuging it seems to be here that it's raising this error: > self.shutdown_request(request) > > > 2010/9/25 Daniel França > > Hi all, >> I just start to use Dajax with my Pinax based project >> I followed the installation steps >> >> and it's almost working :P >> >> I tried to do a test just copying the following code from Dajax examplex: >> http://www.dajaxproject.com/random/ >> I'ts calling the randomize function correctly (and I can debug it), but >> it's not updating the field with the value. >> >> I understood that there's no need to write any js code, right? >> >> I just created my ajax.py and write this: >> >> *import random >> from dajax.core import Dajax >> from dajaxice.core import dajaxice_functions >> >> def randomize(request): >> dajax = Dajax() >> dajax.assign('#result','value',random.randint(1, 10)) >> return dajax.json() >> >> dajaxice_functions.register(randomize)* >> >> >> and added to my html code: >> >> >> >> > onclick="Dajaxice.examples.randomize('Dajax.process')"> >> >> Just changed the "examples" name to my app name. >> >> It's calling the function, I can debug it, but nothing change in my page. >> >> What am I doing wrong? >> >> >> >> >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.