Django doesnt create sqlite database
Hi Buddy, I am newbie in Django. Recently I try out the Django tutorial from web with python 2.5.2 and sqlite3 Unfortunately, Django doesn't create sqlite database as the tutorial stated. And I couldn't find any FAQ on the web. Could you advise me on this? 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
About Django Notify
Hi I installed django-notify. But in that django-notify folder it does not contain the file notify_user.py. I need this file. Plese send me the file notify_user.py --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Add Request Parameters
I'm writing some code that does something like... 1. check url for specific information 2. do some logic based on named group 3. pass results along on request It is easy for me to do this through urls.py for a single request. However, i want to perform this for every request. I am going down the path of creating a custom middleware that will perform my logic as mentioned. My problem is with how to pass the results along on the request. My intuition is to try and add a parameter like so... q = request.GET.copy(); q.__setitem__('new_key', 'new_val') request.GET = q Only problem is that the code further down the pipe doesn't recognize 'new_key' as being available in the request.GET querydict. please advise. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Most effective and stable Django set up on a production server?
On Oct 19, 2:23 pm, DjangoRocks wrote: > Hi all, > as per the subject: what is the most effective and stable Django set > up options on a production server? > > I am currently on a mod_python, linux, apache set up. > > And sometimes, it seems that the server is unstable. > For example, whenever i try to submit a form ( uploading images ), > there are times where it says that there is an error ( template not > found ), and times where the upload was successful. ( the code running > on my local computer runs perfectly) > > Is that due to unstable server? Probably not. More than likely you have some order dependency in way things are loaded into memory by your Django application. You should post the exact traceback from the error logs so that people can at least attempt to resolve what is likely your real problem rather than just assume that changing hosting mechanisms will help. > What do u guys recommend for a most effective and stable Django set up > options on a production server? Django documentation no longer recommends mod_python. Have you looked at the Django documentation recently to see what it does say? http://docs.djangoproject.com/en/dev/howto/deployment/#howto-deployment-index Graham --~--~-~--~~~---~--~~ 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: python manage.py syncdb error: sqlite3.OperationalError: unable to open database file
2009/10/18 selena > > Hello > hey michael > I have been experiencing this problem since I installed my brand new > Ubuntu Karmic with python in version 2.6 The project I am working on > was working under python2.5 in my old Gentoo and still works (at least > the python manage.py syncdb command does) on a server which is also > running python2.5. > I have tried installing both the latest official version and the > latest development version of django and still the > "python manage.py syncdb" > it returns this error: > > Traceback (most recent call last): > File "manage.py", line 11, in >execute_manager(settings) > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ > __init__.py", line 3 >utility.execute() > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ > __init__.py", line 3 >self.fetch_command(subcommand).run_from_argv(self.argv) > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ > base.py", line 195, >self.execute(*args, **options.__dict__) > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ > base.py", line 222, >output = self.handle(*args, **options) > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ > base.py", line 351, >return self.handle_noargs(**options) > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ > commands/syncdb.py", >cursor = connection.cursor() > File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ > __init__.py", line 81, i >cursor = self._cursor() > File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ > sqlite3/base.py", line 1 >self.connection = Database.connect(**kwargs) > sqlite3.OperationalError: unable to open database file > > i have looked at other posts and the majority of people had > the"operational error" caused by "~" in the path to the main folder in > the settings.py or permissions to write for the folder that contains > the project. none of the advices i found solved my problem. > do you have any idea where this comes from and what should i do? is > there something to be set in sqlite or should i modify django's > destinations/target files? > thanks > could you post your settings.py file? > > selena > > > > -- Cristian Salamea CEO GnuThink Software Labs Software Libre / Open Source (+593-8) 4-36-44-48 --~--~-~--~~~---~--~~ 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: Django production set up woes [Please Help]
ok thanks! i got it up and running. On Oct 19, 2:51 am, Михаил Лукин wrote: > http://docs.djangoproject.com/en/dev/howto/deployment/ > Choose your deployment method and you'll find the answer > > 2009/10/18 DjangoRocks > > > > > > > hi, how do i put the project's path in my server pyhton path ? > > > On Oct 19, 2:36 am, Михаил Лукин wrote: > > > Seems that you didn't put your project's path in your server python path. > > > > 2009/10/18 DjangoRocks > > > > > Hi yes, i restarted apache after uploading my files. > > > > > Just in case, here is the error message i received: > > > > ViewDoesNotExist at /user/eugene/ > > > > > Could not import crud.views. Error was: No module named crud.views > > > > > Request Method: GET > > > > Request URL: http://140.119.19.139/user/eugene/ > > > > Exception Type: ViewDoesNotExist > > > > Exception Value: > > > > > Could not import crud.views. Error was: No module named crud.views > > > > > Exception Location: /home/lab/public_html/django/django/core/ > > > > urlresolvers.py in _get_callback, line 133 > > > > Python Executable: /usr/bin/python > > > > Python Version: 2.6.2 > > > > Python Path: ['/home/lab/public_html/django', '/usr/lib/python2.6', > > '/ > > > > usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/ > > > > python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/ > > > > python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', > > > > '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist- > > > > packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/ > > > > python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/ > > > > gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] > > > > Server time: Sun, 18 Oct 2009 13:23:32 -0500 > > > > > * > > > > The weird thing is that i have installed the application and uploaded > > > > as it is up to my production server. And its telling me that the > > > > 'crud' views does not exist. > > > > > How do i fix this? > > > > > Best. > > > > > On Oct 19, 2:05 am, Daniel Roseman wrote: > > > > > On Oct 18, 6:54 pm, DjangoRocks wrote: > > > > > > > Hi all, > > > > > > The environment i am using to set up my django project/app on a > > > > > > production server is as follows: > > > > > > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > > > > > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > > > > > > I have followed the tutorial athttp:// > > > > jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > > > > > > for setting Django and it worked ok. I named the project as the > > same > > > > > > name for my django project on my development computer. > > > > > > > I got the Django error message since i have not done anything yet > > when > > > > > > i visited the ip address. Which means that my installation were ok. > > > > > > > Next i created an app ( on the production server ) as per the name > > i > > > > > > have named on my development computer. > > > > > > After which i uploaded alllmy django projct/app files to the > > > > > > production server using the terminal. > > > > > > > Here's where the nightmare happens: > > > > > > > After i have copied all my django project files to the production > > > > > > server, and tested the application on the production server, only > > the > > > > > > homepage worked. > > > > > > > Whenever i tried to visit other pages to test it out, i received > > the > > > > > > error : Exception Type: ViewDoesNotExist > > > > > > > However, the problem is that i have already started the app in the > > > > > > production server before i upload all my files onto the project > > > > > > itself. > > > > > > > May i know how do i fix this problem? > > > > > > > Best Regards, > > > > > > Eugene > > > > > > Did you restart Apache after uploading your files? > > > > > -- > > > > > DR. > > > > -- > > > regards, > > > Mihail > > -- > regards, > Mihail --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Weird server issues] Most effective and stable Django set up on a production server?
Hi all, as per the subject: what is the most effective and stable Django set up options on a production server? I am currently on a mod_python, linux, apache set up. And sometimes, it seems that the server is unstable. For example, whenever i try to submit a form ( uploading images ), there are times where it says that there is an error ( template not found ), and times where the upload was successful. ( the code running on my local computer runs perfectly) Is that due to unstable server? What do u guys recommend for a most effective and stable Django set up options on a production server? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
python manage.py syncdb error: sqlite3.OperationalError: unable to open database file
Hello hey michael I have been experiencing this problem since I installed my brand new Ubuntu Karmic with python in version 2.6 The project I am working on was working under python2.5 in my old Gentoo and still works (at least the python manage.py syncdb command does) on a server which is also running python2.5. I have tried installing both the latest official version and the latest development version of django and still the "python manage.py syncdb" it returns this error: Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/usr/local/lib/python2.6/dist-packages/django/core/management/ __init__.py", line 3 utility.execute() File "/usr/local/lib/python2.6/dist-packages/django/core/management/ __init__.py", line 3 self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.6/dist-packages/django/core/management/ base.py", line 195, self.execute(*args, **options.__dict__) File "/usr/local/lib/python2.6/dist-packages/django/core/management/ base.py", line 222, output = self.handle(*args, **options) File "/usr/local/lib/python2.6/dist-packages/django/core/management/ base.py", line 351, return self.handle_noargs(**options) File "/usr/local/lib/python2.6/dist-packages/django/core/management/ commands/syncdb.py", cursor = connection.cursor() File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ __init__.py", line 81, i cursor = self._cursor() File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ sqlite3/base.py", line 1 self.connection = Database.connect(**kwargs) sqlite3.OperationalError: unable to open database file i have looked at other posts and the majority of people had the"operational error" caused by "~" in the path to the main folder in the settings.py or permissions to write for the folder that contains the project. none of the advices i found solved my problem. do you have any idea where this comes from and what should i do? is there something to be set in sqlite or should i modify django's destinations/target files? thanks selena --~--~-~--~~~---~--~~ 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: Django methodologies and best practices
HI, =>> I tend to start with the models first and when I add a field, I just use alter >> to update the table in place. This has a gotcha with NOT NULL though, if you >> don't specify a default you'll end up with an error. To bypass this error, I >> usually don't add the NOT NULL constraint till after I've added the field and >> updated the existing rows with the required data. >> > I might have to end up using this approach since it seems like a > relatively easy solution. It seems to me that this sort of thing is > the kind of thing that just requires a little repetition and grinding > (especially with a lot of changes...) Yes, I do this in my current project. but a lot of change in models sometimes create a not so nice works. I am planning to integrate south though. -djibon- -- -- http://www.tumbletooth.org my linkedin profile : http://www.linkedin.com/in/bayuadji -- --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
TemplateDoesNotExist at /admin/ on Centos with Django 1.1.1
Greetings, I'm installing Django on a Centos 5.3 system, running under mod_wsgi on Apache, using Django 1.1.1. In a very basic install, when I attempt to access the /admin/ URL, I get the above error... but the templates are there: thebu...@blog templates]$ ls /opt/python2.6/lib/python2.6/site- packages/django/contrib/admin/templates/admin 404.html edit_inline 500.html filter.html actions.html includes app_index.html index.html auth invalid_setup.html base.html login.html base_site.html object_history.html change_form.html pagination.html change_list.html prepopulated_fields_js.html change_list_results.html search_form.html date_hierarchy.htmlsubmit_line.html delete_confirmation.html template_validator.html delete_selected_confirmation.html Any guidance on what I might be doing wrong? Thanks! -- -- Christophe Pettus x...@thebuild.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How do I add an incrementing numeric field to a generic list?
Thanks. I didn't realize that "forloop" really meant forloop. I thought it meant the name of my loop! On Oct 18, 4:39 am, Daniel Roseman wrote: > On Oct 18, 3:11 am, jeffself wrote: > > > > > I've got a view that returns a generic list. It contains the following > > fields: > > school, wins, losses, pf, pa, rating > > > I want to add a field called rank that assigns the values 1 through > > whatever for each of the records returned. Is this possible using the > > templating engine or do I have to write pure python code to achieve > > this? > > > Here's my views.py: > > > def rankings_by_conference(request, conference): > > try: > > conference = Conference.objects.get(slug__iexact=conference) > > except Conference.DoesNotExist: > > raise Http404 > > > return list_detail.object_list( > > request, > > queryset = SchoolData.objects.filter > > (school_season__conference=conference).order_by('-rating'), > > template_name = "college/rankings_by_conference.html", > > template_object_name = "rankings", > > extra_context = {"conference": conference} > > ) > > > And here's my template: > > {% extends "base.html" %} > > > {% block title %}Rankings by Conference{% endblock %} > > > {% block content %} > > > 2009 {{ conference.conf_name }} Rankings > > > > > > > > > Rank > > School > > Wins > > Losses > > Ties > > PF > > PA > > Rating > > Schedule Strength > > > > > > {% for ranking in rankings_list %} > > > > {{ rankings.counter }} > > {{ ranking.school_season.school.short_name > > }} > > {{ ranking.wins }} > > {{ ranking.losses }} > > {{ ranking.ties }} > > {{ ranking.pf }} > > {{ ranking.pa }} > > {{ ranking.rating }} > > {{ ranking.schedule_strength }} > > > > {% endfor %} > > > > > > > {% endblock %} > > > As you can see, I've tried using the counter variable but its not > > returning anything. > > It should be {{ forloop.counter }}. > Seehttp://docs.djangoproject.com/en/dev/ref/templates/builtins/#for > -- > DR. --~--~-~--~~~---~--~~ 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: Django methodologies and best practices
> > > Is there any downside to starting with the models first? > > The biggest one is that if you decide later to add a field to the model that > isn't there and you've filled in some data to the db. I agree 100%. On this project (and some I've worked on before) I know I'll be adding fields as it becomes apparent I'll need them. And I know even with some great schema planning I'll still be adding fields well after the test data for those models is in place. > > I tend to start with the models first and when I add a field, I just use alter > to update the table in place. This has a gotcha with NOT NULL though, if you > don't specify a default you'll end up with an error. To bypass this error, I > usually don't add the NOT NULL constraint till after I've added the field and > updated the existing rows with the required data. > I might have to end up using this approach since it seems like a relatively easy solution. It seems to me that this sort of thing is the kind of thing that just requires a little repetition and grinding (especially with a lot of changes...) --~--~-~--~~~---~--~~ 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: Django methodologies and best practices
On Sunday 18 October 2009 13:57:58 Shakefu wrote: > > > a first working implementation of my models (remember you can test > > > your models from the interactive shell and/or python scripts). > > > > Or write unit tests, which are more suited for testing than loose > > bunch of scripts > > Well, I certainly have noticed that a lot of guides/tutorials/snippets > start with models and then write the rest of the required code in > varying order. > > Is there any downside to starting with the models first? The biggest one is that if you decide later to add a field to the model that isn't there and you've filled in some data to the db. Syncdb is ineffective at updating the table so you either drop the table and reload the data as a fixture with the added field data, or start again with data or use a db migration tool like django evolution. I tend to start with the models first and when I add a field, I just use alter to update the table in place. This has a gotcha with NOT NULL though, if you don't specify a default you'll end up with an error. To bypass this error, I usually don't add the NOT NULL constraint till after I've added the field and updated the existing rows with the required data. This may not be the best approach to it, but it works for me and is fast enough and requires less prep time for using such tools as evolution and the like (no need to install or learn them) and/or editting fixtures. Mike How do I get HOME? signature.asc Description: This is a digitally signed message part.
Re: Django methodologies and best practices
> > > a first working implementation of my models (remember you can test > > your models from the interactive shell and/or python scripts). > > Or write unit tests, which are more suited for testing than loose > bunch of scripts > Well, I certainly have noticed that a lot of guides/tutorials/snippets start with models and then write the rest of the required code in varying order. Is there any downside to starting with the models first? --~--~-~--~~~---~--~~ 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: Django methodologies and best practices
On 18 oct, 17:04, Tomasz Zieliński wrote: > On 18 Paź, 15:48, bruno desthuilliers > wrote: > > > a first working implementation of my models (remember you can test > > your models from the interactive shell and/or python scripts). > > Or write unit tests, which are more suited for testing than loose > bunch of scripts Scripts come in different flavors, not only the "loose bunch" one - and FWIW, unit tests ARE scripts too... My point here was that user interactions with the models were not restricted to the http request => url dispatch => view mechanism. --~--~-~--~~~---~--~~ 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: How to enforce uniqueness based on two model fields
Thanks, Mihail! Sometimes I don't know where to look for what I need, but the docs are indeed stellar! On Oct 18, 8:24 pm, Михаил Лукин wrote: > http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together > why don't you like to read docs first. Django docs are amazing! > > 2009/10/18 Guillermo > > > > > > > > > Ok I've done the following: > > > def save(self): > > r = TargetMessage.objects.filter(src_fk=self.src_fk, > > lang_fk=self.lang_fk) > > if not r: > > super(TargetMessage, self).save() > > > How can I propagate a validation error to the admin interface so that > > I know what's happened? > > > Regards, > > Guillermo > > > On Oct 18, 8:04 pm, Guillermo wrote: > > > Hi all, > > > > I want my records to be unique for field A and B together, so that no > > > two records can share the same values for those particular fields. How > > > can this be declared in the model? > > > > Regards, > > > Guillermo > > -- > regards, > Mihail --~--~-~--~~~---~--~~ 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: "django-pagination" and generic.views.date_based.archive_index()
Sorry, didn't look at condition well...:( So, you see the source and you see that there's no way to get all the records with this view. Why don't you use list_detail.object_list view? If you need just to order list by date, you can use ordering on the model level: http://docs.djangoproject.com/en/dev/ref/models/options/#ordering 2009/10/18 tezro > > Would it? If "latest=None" doesn't it mean that there are no entries? > > By the way, if I pass None to the condition, it returns False, so > latest is None. > > Or isn't it? > > Also the template cannot render it, cause "object of type 'NoneType' > has no len()". > > Anyways, thanks for reply :) > > > > On Oct 18, 11:04 pm, Mihail Lukin wrote: > > Look at date_based.py: > > > > if date_list and num_latest: > > latest = queryset.order_by('-'+date_field)[:num_latest] > > else: > > latest = None > > > > So, if you use num_latest=None, you will always get the whole list. > > > > On Aug 30, 2:47 pm, tezro wrote: > > > > > Anyone? > > > > > On Aug 14, 8:29 am, tezro wrote: > > > > > > The question is that > "django.views.generic.date_based.archive_index()" > > > > takes an optional argument "num_latest" which is 15 by default. > > > > Setting it manually to num_latest=10 is way off to correct to > > > > me. It works. I suppose that it even doesn't retrieve all the tons of > > > > data from the DB, but what if I have 10 + 1 record :) > > > > > > What's the right way to use "django-pagination" and the > "archive_index > > > > ()" or am I missing something? > > > > > > Example code. > > > > ___ > > > > > > def index(request): > > > > qs = News.objects.filter(is_published=1) > > > > return archive_index(request, qs, 'date', > num_latest=1) > > > > ___ > > > > > > Thanks. > > > > > > > -- regards, Mihail --~--~-~--~~~---~--~~ 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: Stored proderures/functions in Django
Good point Jani, thanks. I've forget to raw sql support in Django. Jani Tiainen napsal(a): > Tomas Pelka kirjoitti: >> Hi gang, >> I know that Django do not support stored procedures/function, but is >> here still a chance to handle this stuff in Django? >> >> I found this http://www.djangosnippets.org/snippets/272/, have somebody >> experience with this? >> >> Thanks for advices, >> cheers Tom. >> > > I don't think so, there is no database agnostic way to do it and more > over it varies quite a lot between different DBMSes. > > What would be useful (there is even ticket for that) to able to populate > model instances from raw queries and thus for example from return > value(s) of such database spesific calls. > > And meanwhile you always can call raw sql to anything you want django > supports it. > -- Tom --~--~-~--~~~---~--~~ 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: "django-pagination" and generic.views.date_based.archive_index()
Would it? If "latest=None" doesn't it mean that there are no entries? By the way, if I pass None to the condition, it returns False, so latest is None. Or isn't it? Also the template cannot render it, cause "object of type 'NoneType' has no len()". Anyways, thanks for reply :) On Oct 18, 11:04 pm, Mihail Lukin wrote: > Look at date_based.py: > > if date_list and num_latest: > latest = queryset.order_by('-'+date_field)[:num_latest] > else: > latest = None > > So, if you use num_latest=None, you will always get the whole list. > > On Aug 30, 2:47 pm, tezro wrote: > > > Anyone? > > > On Aug 14, 8:29 am, tezro wrote: > > > > The question is that "django.views.generic.date_based.archive_index()" > > > takes an optional argument "num_latest" which is 15 by default. > > > Setting it manually to num_latest=10 is way off to correct to > > > me. It works. I suppose that it even doesn't retrieve all the tons of > > > data from the DB, but what if I have 10 + 1 record :) > > > > What's the right way to use "django-pagination" and the "archive_index > > > ()" or am I missing something? > > > > Example code. > > > ___ > > > > def index(request): > > > qs = News.objects.filter(is_published=1) > > > return archive_index(request, qs, 'date', num_latest=1) > > > ___ > > > > 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: "django-pagination" and generic.views.date_based.archive_index()
Look at date_based.py: if date_list and num_latest: latest = queryset.order_by('-'+date_field)[:num_latest] else: latest = None So, if you use num_latest=None, you will always get the whole list. On Aug 30, 2:47 pm, tezro wrote: > Anyone? > > On Aug 14, 8:29 am, tezro wrote: > > > The question is that "django.views.generic.date_based.archive_index()" > > takes an optional argument "num_latest" which is 15 by default. > > Setting it manually to num_latest=10 is way off to correct to > > me. It works. I suppose that it even doesn't retrieve all the tons of > > data from the DB, but what if I have 10 + 1 record :) > > > What's the right way to use "django-pagination" and the "archive_index > > ()" or am I missing something? > > > Example code. > > ___ > > > def index(request): > > qs = News.objects.filter(is_published=1) > > return archive_index(request, qs, 'date', num_latest=1) > > ___ > > > 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django production set up woes [Please Help]
http://docs.djangoproject.com/en/dev/howto/deployment/ Choose your deployment method and you'll find the answer 2009/10/18 DjangoRocks > > hi, how do i put the project's path in my server pyhton path ? > > On Oct 19, 2:36 am, Михаил Лукин wrote: > > Seems that you didn't put your project's path in your server python path. > > > > 2009/10/18 DjangoRocks > > > > > > > > > > > > > Hi yes, i restarted apache after uploading my files. > > > > > Just in case, here is the error message i received: > > > ViewDoesNotExist at /user/eugene/ > > > > > Could not import crud.views. Error was: No module named crud.views > > > > > Request Method: GET > > > Request URL:http://140.119.19.139/user/eugene/ > > > Exception Type: ViewDoesNotExist > > > Exception Value: > > > > > Could not import crud.views. Error was: No module named crud.views > > > > > Exception Location: /home/lab/public_html/django/django/core/ > > > urlresolvers.py in _get_callback, line 133 > > > Python Executable: /usr/bin/python > > > Python Version: 2.6.2 > > > Python Path:['/home/lab/public_html/django', '/usr/lib/python2.6', > '/ > > > usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/ > > > python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/ > > > python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', > > > '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist- > > > packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/ > > > python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/ > > > gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] > > > Server time:Sun, 18 Oct 2009 13:23:32 -0500 > > > > > * > > > The weird thing is that i have installed the application and uploaded > > > as it is up to my production server. And its telling me that the > > > 'crud' views does not exist. > > > > > How do i fix this? > > > > > Best. > > > > > On Oct 19, 2:05 am, Daniel Roseman wrote: > > > > On Oct 18, 6:54 pm, DjangoRocks wrote: > > > > > > > Hi all, > > > > > The environment i am using to set up my django project/app on a > > > > > production server is as follows: > > > > > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > > > > > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > > > > > > I have followed the tutorial athttp:// > > > jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > > > > > for setting Django and it worked ok. I named the project as the > same > > > > > name for my django project on my development computer. > > > > > > > I got the Django error message since i have not done anything yet > when > > > > > i visited the ip address. Which means that my installation were ok. > > > > > > > Next i created an app ( on the production server ) as per the name > i > > > > > have named on my development computer. > > > > > After which i uploaded alllmy django projct/app files to the > > > > > production server using the terminal. > > > > > > > Here's where the nightmare happens: > > > > > > > After i have copied all my django project files to the production > > > > > server, and tested the application on the production server, only > the > > > > > homepage worked. > > > > > > > Whenever i tried to visit other pages to test it out, i received > the > > > > > error : Exception Type: ViewDoesNotExist > > > > > > > However, the problem is that i have already started the app in the > > > > > production server before i upload all my files onto the project > > > > > itself. > > > > > > > May i know how do i fix this problem? > > > > > > > Best Regards, > > > > > Eugene > > > > > > Did you restart Apache after uploading your files? > > > > -- > > > > DR. > > > > -- > > regards, > > Mihail > > > -- regards, Mihail --~--~-~--~~~---~--~~ 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: Django production set up woes [Please Help]
hi, how do i put the project's path in my server pyhton path ? On Oct 19, 2:36 am, Михаил Лукин wrote: > Seems that you didn't put your project's path in your server python path. > > 2009/10/18 DjangoRocks > > > > > > > Hi yes, i restarted apache after uploading my files. > > > Just in case, here is the error message i received: > > ViewDoesNotExist at /user/eugene/ > > > Could not import crud.views. Error was: No module named crud.views > > > Request Method: GET > > Request URL: http://140.119.19.139/user/eugene/ > > Exception Type: ViewDoesNotExist > > Exception Value: > > > Could not import crud.views. Error was: No module named crud.views > > > Exception Location: /home/lab/public_html/django/django/core/ > > urlresolvers.py in _get_callback, line 133 > > Python Executable: /usr/bin/python > > Python Version: 2.6.2 > > Python Path: ['/home/lab/public_html/django', '/usr/lib/python2.6', '/ > > usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/ > > python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/ > > python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', > > '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist- > > packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/ > > python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/ > > gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] > > Server time: Sun, 18 Oct 2009 13:23:32 -0500 > > > * > > The weird thing is that i have installed the application and uploaded > > as it is up to my production server. And its telling me that the > > 'crud' views does not exist. > > > How do i fix this? > > > Best. > > > On Oct 19, 2:05 am, Daniel Roseman wrote: > > > On Oct 18, 6:54 pm, DjangoRocks wrote: > > > > > Hi all, > > > > The environment i am using to set up my django project/app on a > > > > production server is as follows: > > > > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > > > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > > > > I have followed the tutorial athttp:// > > jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > > > > for setting Django and it worked ok. I named the project as the same > > > > name for my django project on my development computer. > > > > > I got the Django error message since i have not done anything yet when > > > > i visited the ip address. Which means that my installation were ok. > > > > > Next i created an app ( on the production server ) as per the name i > > > > have named on my development computer. > > > > After which i uploaded alllmy django projct/app files to the > > > > production server using the terminal. > > > > > Here's where the nightmare happens: > > > > > After i have copied all my django project files to the production > > > > server, and tested the application on the production server, only the > > > > homepage worked. > > > > > Whenever i tried to visit other pages to test it out, i received the > > > > error : Exception Type: ViewDoesNotExist > > > > > However, the problem is that i have already started the app in the > > > > production server before i upload all my files onto the project > > > > itself. > > > > > May i know how do i fix this problem? > > > > > Best Regards, > > > > Eugene > > > > Did you restart Apache after uploading your files? > > > -- > > > DR. > > -- > regards, > Mihail --~--~-~--~~~---~--~~ 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: Django production set up woes [Please Help]
hi, how do i put the project's path in my server pyhton path ? On Oct 19, 2:36 am, Михаил Лукин wrote: > Seems that you didn't put your project's path in your server python path. > > 2009/10/18 DjangoRocks > > > > > > > Hi yes, i restarted apache after uploading my files. > > > Just in case, here is the error message i received: > > ViewDoesNotExist at /user/eugene/ > > > Could not import crud.views. Error was: No module named crud.views > > > Request Method: GET > > Request URL: http://140.119.19.139/user/eugene/ > > Exception Type: ViewDoesNotExist > > Exception Value: > > > Could not import crud.views. Error was: No module named crud.views > > > Exception Location: /home/lab/public_html/django/django/core/ > > urlresolvers.py in _get_callback, line 133 > > Python Executable: /usr/bin/python > > Python Version: 2.6.2 > > Python Path: ['/home/lab/public_html/django', '/usr/lib/python2.6', '/ > > usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/ > > python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/ > > python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', > > '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist- > > packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/ > > python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/ > > gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] > > Server time: Sun, 18 Oct 2009 13:23:32 -0500 > > > * > > The weird thing is that i have installed the application and uploaded > > as it is up to my production server. And its telling me that the > > 'crud' views does not exist. > > > How do i fix this? > > > Best. > > > On Oct 19, 2:05 am, Daniel Roseman wrote: > > > On Oct 18, 6:54 pm, DjangoRocks wrote: > > > > > Hi all, > > > > The environment i am using to set up my django project/app on a > > > > production server is as follows: > > > > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > > > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > > > > I have followed the tutorial athttp:// > > jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > > > > for setting Django and it worked ok. I named the project as the same > > > > name for my django project on my development computer. > > > > > I got the Django error message since i have not done anything yet when > > > > i visited the ip address. Which means that my installation were ok. > > > > > Next i created an app ( on the production server ) as per the name i > > > > have named on my development computer. > > > > After which i uploaded alllmy django projct/app files to the > > > > production server using the terminal. > > > > > Here's where the nightmare happens: > > > > > After i have copied all my django project files to the production > > > > server, and tested the application on the production server, only the > > > > homepage worked. > > > > > Whenever i tried to visit other pages to test it out, i received the > > > > error : Exception Type: ViewDoesNotExist > > > > > However, the problem is that i have already started the app in the > > > > production server before i upload all my files onto the project > > > > itself. > > > > > May i know how do i fix this problem? > > > > > Best Regards, > > > > Eugene > > > > Did you restart Apache after uploading your files? > > > -- > > > DR. > > -- > regards, > Mihail --~--~-~--~~~---~--~~ 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: Django production set up woes [Please Help]
Seems that you didn't put your project's path in your server python path. 2009/10/18 DjangoRocks > > Hi yes, i restarted apache after uploading my files. > > Just in case, here is the error message i received: > ViewDoesNotExist at /user/eugene/ > > Could not import crud.views. Error was: No module named crud.views > > Request Method: GET > Request URL:http://140.119.19.139/user/eugene/ > Exception Type: ViewDoesNotExist > Exception Value: > > Could not import crud.views. Error was: No module named crud.views > > Exception Location: /home/lab/public_html/django/django/core/ > urlresolvers.py in _get_callback, line 133 > Python Executable: /usr/bin/python > Python Version: 2.6.2 > Python Path:['/home/lab/public_html/django', '/usr/lib/python2.6', '/ > usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/ > python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/ > python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', > '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist- > packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/ > python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/ > gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] > Server time:Sun, 18 Oct 2009 13:23:32 -0500 > > * > The weird thing is that i have installed the application and uploaded > as it is up to my production server. And its telling me that the > 'crud' views does not exist. > > How do i fix this? > > Best. > > On Oct 19, 2:05 am, Daniel Roseman wrote: > > On Oct 18, 6:54 pm, DjangoRocks wrote: > > > > > > > > > Hi all, > > > The environment i am using to set up my django project/app on a > > > production server is as follows: > > > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > > > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > > > > I have followed the tutorial athttp:// > jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > > > for setting Django and it worked ok. I named the project as the same > > > name for my django project on my development computer. > > > > > I got the Django error message since i have not done anything yet when > > > i visited the ip address. Which means that my installation were ok. > > > > > Next i created an app ( on the production server ) as per the name i > > > have named on my development computer. > > > After which i uploaded alllmy django projct/app files to the > > > production server using the terminal. > > > > > Here's where the nightmare happens: > > > > > After i have copied all my django project files to the production > > > server, and tested the application on the production server, only the > > > homepage worked. > > > > > Whenever i tried to visit other pages to test it out, i received the > > > error : Exception Type: ViewDoesNotExist > > > > > However, the problem is that i have already started the app in the > > > production server before i upload all my files onto the project > > > itself. > > > > > May i know how do i fix this problem? > > > > > Best Regards, > > > Eugene > > > > Did you restart Apache after uploading your files? > > -- > > DR. > > > -- regards, Mihail --~--~-~--~~~---~--~~ 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: Django production set up woes [Please Help]
I've create another project and app on the production server directly and i received the same problem. ViewDoesNotExist at /hello/ Could not import testapp.views. Error was: No module named testapp.views Request Method: GET Request URL:http://140.119.19.139/hello/ Exception Type: ViewDoesNotExist Exception Value: Could not import testapp.views. Error was: No module named testapp.views Exception Location: /home/lab/public_html/django/django/core/ urlresolvers.py in _get_callback, line 133 Python Executable: /usr/bin/python Python Version: 2.6.2 Python Path:['/home/lab/public_html/django', '/usr/lib/python2.6', '/ usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/ python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/ python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist- packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/ python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/ gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] Server time:Sun, 18 Oct 2009 13:37:43 -0500 Is it possible that django cannot serve app on production server? How do i fix this problem? On Oct 19, 2:22 am, DjangoRocks wrote: > Hi yes, i restarted apache after uploading my files. > > Just in case, here is the error message i received: > ViewDoesNotExist at /user/eugene/ > > Could not import crud.views. Error was: No module named crud.views > > Request Method: GET > Request URL: http://140.119.19.139/user/eugene/ > Exception Type: ViewDoesNotExist > Exception Value: > > Could not import crud.views. Error was: No module named crud.views > > Exception Location: /home/lab/public_html/django/django/core/ > urlresolvers.py in _get_callback, line 133 > Python Executable: /usr/bin/python > Python Version: 2.6.2 > Python Path: ['/home/lab/public_html/django', '/usr/lib/python2.6', '/ > usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/ > python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/ > python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', > '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist- > packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/ > python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/ > gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] > Server time: Sun, 18 Oct 2009 13:23:32 -0500 > > * > The weird thing is that i have installed the application and uploaded > as it is up to my production server. And its telling me that the > 'crud' views does not exist. > > How do i fix this? > > Best. > > On Oct 19, 2:05 am, Daniel Roseman wrote: > > > On Oct 18, 6:54 pm, DjangoRocks wrote: > > > > Hi all, > > > The environment i am using to set up my django project/app on a > > > production server is as follows: > > > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > > > I have followed the tutorial > > > athttp://jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > > > for setting Django and it worked ok. I named the project as the same > > > name for my django project on my development computer. > > > > I got the Django error message since i have not done anything yet when > > > i visited the ip address. Which means that my installation were ok. > > > > Next i created an app ( on the production server ) as per the name i > > > have named on my development computer. > > > After which i uploaded alllmy django projct/app files to the > > > production server using the terminal. > > > > Here's where the nightmare happens: > > > > After i have copied all my django project files to the production > > > server, and tested the application on the production server, only the > > > homepage worked. > > > > Whenever i tried to visit other pages to test it out, i received the > > > error : Exception Type: ViewDoesNotExist > > > > However, the problem is that i have already started the app in the > > > production server before i upload all my files onto the project > > > itself. > > > > May i know how do i fix this problem? > > > > Best Regards, > > > Eugene > > > Did you restart Apache after uploading your files? > > -- > > DR. --~--~-~--~~~---~--~~ 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: How to enforce uniqueness based on two model fields
http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together why don't you like to read docs first. Django docs are amazing! 2009/10/18 Guillermo > > Ok I've done the following: > > def save(self): >r = TargetMessage.objects.filter(src_fk=self.src_fk, >lang_fk=self.lang_fk) >if not r: >super(TargetMessage, self).save() > > How can I propagate a validation error to the admin interface so that > I know what's happened? > > Regards, > Guillermo > > On Oct 18, 8:04 pm, Guillermo wrote: > > Hi all, > > > > I want my records to be unique for field A and B together, so that no > > two records can share the same values for those particular fields. How > > can this be declared in the model? > > > > Regards, > > Guillermo > > > -- regards, Mihail --~--~-~--~~~---~--~~ 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: Django production set up woes [Please Help]
Hi yes, i restarted apache after uploading my files. Just in case, here is the error message i received: ViewDoesNotExist at /user/eugene/ Could not import crud.views. Error was: No module named crud.views Request Method: GET Request URL:http://140.119.19.139/user/eugene/ Exception Type: ViewDoesNotExist Exception Value: Could not import crud.views. Error was: No module named crud.views Exception Location: /home/lab/public_html/django/django/core/ urlresolvers.py in _get_callback, line 133 Python Executable: /usr/bin/python Python Version: 2.6.2 Python Path:['/home/lab/public_html/django', '/usr/lib/python2.6', '/ usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/ python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/ python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist- packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/ python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/ gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] Server time:Sun, 18 Oct 2009 13:23:32 -0500 * The weird thing is that i have installed the application and uploaded as it is up to my production server. And its telling me that the 'crud' views does not exist. How do i fix this? Best. On Oct 19, 2:05 am, Daniel Roseman wrote: > On Oct 18, 6:54 pm, DjangoRocks wrote: > > > > > Hi all, > > The environment i am using to set up my django project/app on a > > production server is as follows: > > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > > I have followed the tutorial > > athttp://jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > > for setting Django and it worked ok. I named the project as the same > > name for my django project on my development computer. > > > I got the Django error message since i have not done anything yet when > > i visited the ip address. Which means that my installation were ok. > > > Next i created an app ( on the production server ) as per the name i > > have named on my development computer. > > After which i uploaded alllmy django projct/app files to the > > production server using the terminal. > > > Here's where the nightmare happens: > > > After i have copied all my django project files to the production > > server, and tested the application on the production server, only the > > homepage worked. > > > Whenever i tried to visit other pages to test it out, i received the > > error : Exception Type: ViewDoesNotExist > > > However, the problem is that i have already started the app in the > > production server before i upload all my files onto the project > > itself. > > > May i know how do i fix this problem? > > > Best Regards, > > Eugene > > Did you restart Apache after uploading your files? > -- > DR. --~--~-~--~~~---~--~~ 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: How to enforce uniqueness based on two model fields
Ok I've done the following: def save(self): r = TargetMessage.objects.filter(src_fk=self.src_fk, lang_fk=self.lang_fk) if not r: super(TargetMessage, self).save() How can I propagate a validation error to the admin interface so that I know what's happened? Regards, Guillermo On Oct 18, 8:04 pm, Guillermo wrote: > Hi all, > > I want my records to be unique for field A and B together, so that no > two records can share the same values for those particular fields. How > can this be declared in the model? > > Regards, > Guillermo --~--~-~--~~~---~--~~ 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: Linking items from the same model
Look at how list of permissions is filtered in admin interface when adding/editind user. You may use such javascript in your form for dynamic filtering. 2009/10/17 Oleg Oltar > I would really want to add some sort of filtering to that > http://img.skitch.com/20091017-mfs2mbhbuudk2rgquium1bu61d.png -- regards, Mihail --~--~-~--~~~---~--~~ 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 enforce uniqueness based on two model fields
Hi all, I want my records to be unique for field A and B together, so that no two records can share the same values for those particular fields. How can this be declared in the model? Regards, Guillermo --~--~-~--~~~---~--~~ 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: Django production set up woes [Please Help]
On Oct 18, 6:54 pm, DjangoRocks wrote: > Hi all, > The environment i am using to set up my django project/app on a > production server is as follows: > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > I have followed the tutorial > athttp://jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > for setting Django and it worked ok. I named the project as the same > name for my django project on my development computer. > > I got the Django error message since i have not done anything yet when > i visited the ip address. Which means that my installation were ok. > > Next i created an app ( on the production server ) as per the name i > have named on my development computer. > After which i uploaded alllmy django projct/app files to the > production server using the terminal. > > Here's where the nightmare happens: > > After i have copied all my django project files to the production > server, and tested the application on the production server, only the > homepage worked. > > Whenever i tried to visit other pages to test it out, i received the > error : Exception Type: ViewDoesNotExist > > However, the problem is that i have already started the app in the > production server before i upload all my files onto the project > itself. > > May i know how do i fix this problem? > > Best Regards, > Eugene Did you restart Apache after uploading your files? -- DR. --~--~-~--~~~---~--~~ 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: Django production set up woes [Please Help]
My application was working alright on my development computer by the way. Best. On Oct 19, 1:54 am, DjangoRocks wrote: > Hi all, > The environment i am using to set up my django project/app on a > production server is as follows: > Ubuntu 9.04, Django 1.02, Python version 2.6.2. > > Mysql, mysqldb, apache2 and php is all set up and good to go. > > I have followed the tutorial > athttp://jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-se... > for setting Django and it worked ok. I named the project as the same > name for my django project on my development computer. > > I got the Django error message since i have not done anything yet when > i visited the ip address. Which means that my installation were ok. > > Next i created an app ( on the production server ) as per the name i > have named on my development computer. > After which i uploaded alllmy django projct/app files to the > production server using the terminal. > > Here's where the nightmare happens: > > After i have copied all my django project files to the production > server, and tested the application on the production server, only the > homepage worked. > > Whenever i tried to visit other pages to test it out, i received the > error : Exception Type: ViewDoesNotExist > > However, the problem is that i have already started the app in the > production server before i upload all my files onto the project > itself. > > May i know how do i fix this problem? > > Best Regards, > Eugene --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Django production set up woes [Please Help]
Hi all, The environment i am using to set up my django project/app on a production server is as follows: Ubuntu 9.04, Django 1.02, Python version 2.6.2. Mysql, mysqldb, apache2 and php is all set up and good to go. I have followed the tutorial at http://jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-server/ for setting Django and it worked ok. I named the project as the same name for my django project on my development computer. I got the Django error message since i have not done anything yet when i visited the ip address. Which means that my installation were ok. Next i created an app ( on the production server ) as per the name i have named on my development computer. After which i uploaded alllmy django projct/app files to the production server using the terminal. Here's where the nightmare happens: After i have copied all my django project files to the production server, and tested the application on the production server, only the homepage worked. Whenever i tried to visit other pages to test it out, i received the error : Exception Type: ViewDoesNotExist However, the problem is that i have already started the app in the production server before i upload all my files onto the project itself. May i know how do i fix this problem? Best Regards, Eugene --~--~-~--~~~---~--~~ 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: form problem
> I made the change but now the following error appears: > 'QueryDict' object is not callable Whops. request.GET is a query dict, so it's of course not callable. I ment to call get('user_text', '') on the request.GET: request.GET.get('user_text', '') --mp --~--~-~--~~~---~--~~ 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: form problem
I made the change but now the following error appears: 'QueryDict' object is not callable On Oct 18, 6:43 pm, "Michael P. Jung" wrote: > First of all may I recommend you to use Django forms: > > http://docs.djangoproject.com/en/dev/topics/forms/ > > > With this method i have the following error: > > Key 'user_text' not found in > >> def view(request): > >> user_text = request.GET['user_text'] > >> return render_to_reponse("html",{'user_text':user_text}) > > When requesting the view for the first time the request.GET dict will > not contain a 'user_text'. If you replace request.GET['user_text'] by > request.GET('user_text', '') it will not raise an exception, but return > '' (empty string) if no 'user_text' is contained in the GET dict. > > Besides it's good practice to use POST for forms, if they're used to > submit new or modify existing data. That's the reason why the example > code in the forms documentation always checks for request.method == > 'POST' to see if the form is actually being submitted or loaded for the > first time. > > In order to get the idea of POST and GET better you might be best of > googeling for it and reading up what the HTTP methods are supposted to > be used for. Rule of thumb: Use POST whenever you're modifying data and > GET when querying data. > > --mp --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with filter_horizontal
Hi, This is my first django app and I can't seem to get filter_horizontal to work correctly. I've seen other people asking about this but I don't see any answers in an hour of searching. Can anybody give me some insight into what I'm doing wrong? Right now when I use Admin to create a document I get a select box that just says Tags Object. So there's two things I'd like help with if possible. 1) Am I using filter_horizontal correctly? If not, what am I doing wrong? 2) If I don't use filter_horizontal, how do I get the items in the select box to say the name of the of the Tag rather than say Tags Object? Some info about my environment. I'm using Django 1.1.1, python 2.5, Apache, and I've tested on IE, Firefox, and Chrome. My admin seems to work otherwise. Thanks in advance for any help. class Tags(models.Model): tagname = models.CharField(max_length=40, primary_key=True) class Document(models.Model): name = models.CharField(max_length=40) location = models.FileField(upload_to='repository') indexed = models.BooleanField(('indexed'), default=False) tag= models.ManyToManyField(Tags) class TagsAdmin(admin.ModelAdmin): list_display = ('tagname',) class DocumentAdmin(admin.ModelAdmin): list_display = ('name', 'indexed',) filter_horizontal = ('tag',) admin.site.register(Tags, TagsAdmin) admin.site.register(Document, DocumentAdmin) --~--~-~--~~~---~--~~ 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: How to get multiple test cases to work with manage.py test?
I did not realize that was the case with the xUnit APIs. Thank you so much for your help. On Oct 18, 9:47 am, Russell Keith-Magee wrote: > On Sun, Oct 18, 2009 at 11:49 AM, Jeff wrote: > > > Hi, > > > I'm fairly new to Django and unittest and I seem to be having a > > problem getting manage.py to execute all of my tests. I can only get > > it to execute one test at a time by specifying the test method. When I > > just specify the TestCase class expecting it to execute all of the > > test methods, it won't run any of the tests. > > > In my articles/tests.py file I have the following: > > - > > # -*- coding: utf-8 -*- > > from django.test import TestCase > > from django.test.client import Client > > from oslaurier.articles.models import Article > > > class ArticleTestCase(TestCase): > >fixtures = ['test_fixture.json'] > > >def setUp(self): > >self.client = Client() > > >def test_index(self): > >""" > >Test that article index page returns a 200 response > >""" > >response = self.client.get('/articles/') > >self.failUnlessEqual(response.status_code, 200) > > >def test_index_default_list(self): > >""" > >Test that index is only displaying non-draft, non-hidden > > articles > >""" > >response = self.client.get('/articles/') > >hello_world = Article.objects.get(slug='hello-world') > >two_author = Article.objects.get(slug='two-author-article') > >multi_author = Article.objects.get(slug='multi-author- > > article') > >self.assertEqual(list(response.context > > ['articles'].object_list).sort(), > >[multi_author, two_author, hello_world].sort()) > > > class ArticlePaginationTestCase(TestCase): > >fixtures = ['pagination.json'] > > >def setUp(self): > >self.client = Client() > > >def default_num_per_page(self): > >""" > >Test that the default number of articles per page is 10 > >""" > >response = self.client.get('/articles/') > >self.assertEqual(len(response.context > > ['articles'].object_list), 10) > > >def first_set_has_next(self): > >""" > >Test that first set of articles has a next set > >""" > >response = self.client.get('/articles/?num_per_page=10') > >self.assertTrue(response.context['articles'].has_next) > > - > > If I run python manage.py test articles.ArticlePaginationTestCase I > > get: > > > Creating test database... > > Creating table django_admin_log > > Creating table auth_permission > > Creating table auth_group > > Creating table auth_user > > Creating table auth_message > > Creating table django_content_type > > Creating table django_flatpage > > Creating table django_redirect > > Creating table django_session > > Creating table django_site > > Creating table articles_article > > Installing index for admin.LogEntry model > > Installing index for auth.Permission model > > Installing index for auth.Message model > > Installing index for flatpages.FlatPage model > > Installing index for redirects.Redirect model > > Installing index for articles.Article model > > > -- > > Ran 0 tests in 0.000s > > > OK > > Destroying test database... > > > I would've expected it to run both test methods under > > ArticlesPaginationTestCase. > > Ah.. but there's the rub - it _did_ run all the test cases in > ArticlesPaginationTestCase :-) > > The point of confusion is that there are no tests in > ArticlesPaginationTestCase - at least, not according to the criteria > of unittest.TestCase. TestCase requires that test functions _must_ > have a name starting with "test" - thats how it automatically > discovers the test cases. > > So, from the point of view of unittest.TestCase: > > class ArticleTestCase(TestCase): > def test_index(self): > ... > def test_index_default_list(self): > ... > > contains two tests, but: > > class ArticlePaginationTestCase(TestCase): > def default_num_per_page(self): > ... > def first_set_has_next(self): > ... > > contains no tests - it just contains two utility methods. > > When you explicitly name the test on the command line, you work around > the problem. Since no automatic discovery is required, the prefix > isn't strictly required, and so the test can run. If you want unittest > to discover the tests automatically, just rename the test cases and > prepend the "test" prefix. > > This isn't something unique to Django - it's a common feature of all > the xUnit family of APIs. > > Yours, > Russ Magee %-)k --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use
Re: form problem
First of all may I recommend you to use Django forms: http://docs.djangoproject.com/en/dev/topics/forms/ > With this method i have the following error: > Key 'user_text' not found in >> def view(request): >> user_text = request.GET['user_text'] >> return render_to_reponse("html",{'user_text':user_text}) When requesting the view for the first time the request.GET dict will not contain a 'user_text'. If you replace request.GET['user_text'] by request.GET('user_text', '') it will not raise an exception, but return '' (empty string) if no 'user_text' is contained in the GET dict. Besides it's good practice to use POST for forms, if they're used to submit new or modify existing data. That's the reason why the example code in the forms documentation always checks for request.method == 'POST' to see if the form is actually being submitted or loaded for the first time. In order to get the idea of POST and GET better you might be best of googeling for it and reading up what the HTTP methods are supposted to be used for. Rule of thumb: Use POST whenever you're modifying data and GET when querying data. --mp --~--~-~--~~~---~--~~ 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: form problem
With this method i have the following error: Key 'user_text' not found in What should i change or add to my code? On Oct 18, 5:40 pm, Rama Vadakattu wrote: > Simple Capture the form variable and send it to another template > > def view(request): > user_text = request.GET['user_text'] > return render_to_reponse("html",{'user_text':user_text}) > > --rama > On Oct 18, 7:26 pm, A_Swtos wrote: > > > > > I have a form like this: > > > > > Text: > > > maxlength="20" /> > > > > > > > The user can type into the form whatever wants.If i press the button > > 'submit' i want to go to a page where it appears what i wrote before. > > Is this possible without saving it into a database? > > What is the code that you propose? > > Im new in django and i would like to tell me all the details that will > > help me, if you can. > > 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django methodologies and best practices
On 18 Paź, 15:48, bruno desthuilliers wrote: > > a first working implementation of my models (remember you can test > your models from the interactive shell and/or python scripts). Or write unit tests, which are more suited for testing than loose bunch of scripts -- Tomasz Zielinski, http://pyconsultant.eu --~--~-~--~~~---~--~~ 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: How to restrict True value to only one row in table column
Overriding save() is the best place to put that logic and it should work well with the admin also (other way is by means of signals) On Oct 18, 3:45 pm, Tomasz Zieliński wrote: > Maybe you can use something like this: > > http://stackoverflow.com/questions/1346765/unique-constraint-that-all... > > This would probably mean converting is_master to: > > is_master = models.BooleanField(null=True, blank=True, unique=True) > > - and possibly overriding save to convert accidental False-s to None- > s. > > Other solution would be to store somewhere (possibly in separate model > with single instance) separate value: > > which_Thing_is_master > > Just some quick ideas. > > -- > Tomasz Zielinskihttp://pyconsultant.eu --~--~-~--~~~---~--~~ 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: form problem
Simple Capture the form variable and send it to another template def view(request): user_text = request.GET['user_text'] return render_to_reponse("html",{'user_text':user_text}) --rama On Oct 18, 7:26 pm, A_Swtos wrote: > I have a form like this: > > > Text: > maxlength="20" /> > > > > The user can type into the form whatever wants.If i press the button > 'submit' i want to go to a page where it appears what i wrote before. > Is this possible without saving it into a database? > What is the code that you propose? > Im new in django and i would like to tell me all the details that will > help me, if you can. > 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
form problem
I have a form like this: Text: The user can type into the form whatever wants.If i press the button 'submit' i want to go to a page where it appears what i wrote before. Is this possible without saving it into a database? What is the code that you propose? Im new in django and i would like to tell me all the details that will help me, if you can. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django methodologies and best practices
On 18 oct, 06:55, Shakefu wrote: > So my questions are simple: > > What are your opinions on the best methodologies and practices for > developing django apps and projects? > > What sort of planning do you do for an application or project? > > What development techniques do you use to help conceptualize an > evolving project/app? > > For example: > Do you prefer to write URLconfs first and let those guide your views > which necessitate writing models, or write the models first and then > views to perform operations on the models, or maybe even templates to > help visualize what is needed for each section/page/app/whatever and > then build backends to fulfill those needs... > > ... or any number of permutations along those themes. > > So what works for you? Why? What doesn't work or what stumbling blocks > do certain routes present? As far as I'm concerned - and given I have at least a rough functional spec (but I fail to see how one could write any piece of software with functional specs...) - models are of course the starting point. And models that are not only dumb data-holders - most of the "operations" on models should be handled by the models and managers themselves, not by the views. Views are only an interface between the users and the models, not a place to fill with business rules and 'low-level' operations. FWIW, I don't even bother with views or urls before I have a first working implementation of my models (remember you can test your models from the interactive shell and/or python scripts). --~--~-~--~~~---~--~~ 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: How to get multiple test cases to work with manage.py test?
On Sun, Oct 18, 2009 at 11:49 AM, Jeff wrote: > > Hi, > > I'm fairly new to Django and unittest and I seem to be having a > problem getting manage.py to execute all of my tests. I can only get > it to execute one test at a time by specifying the test method. When I > just specify the TestCase class expecting it to execute all of the > test methods, it won't run any of the tests. > > In my articles/tests.py file I have the following: > - > # -*- coding: utf-8 -*- > from django.test import TestCase > from django.test.client import Client > from oslaurier.articles.models import Article > > class ArticleTestCase(TestCase): > fixtures = ['test_fixture.json'] > > def setUp(self): > self.client = Client() > > def test_index(self): > """ > Test that article index page returns a 200 response > """ > response = self.client.get('/articles/') > self.failUnlessEqual(response.status_code, 200) > > def test_index_default_list(self): > """ > Test that index is only displaying non-draft, non-hidden > articles > """ > response = self.client.get('/articles/') > hello_world = Article.objects.get(slug='hello-world') > two_author = Article.objects.get(slug='two-author-article') > multi_author = Article.objects.get(slug='multi-author- > article') > self.assertEqual(list(response.context > ['articles'].object_list).sort(), > [multi_author, two_author, hello_world].sort()) > > class ArticlePaginationTestCase(TestCase): > fixtures = ['pagination.json'] > > def setUp(self): > self.client = Client() > > def default_num_per_page(self): > """ > Test that the default number of articles per page is 10 > """ > response = self.client.get('/articles/') > self.assertEqual(len(response.context > ['articles'].object_list), 10) > > def first_set_has_next(self): > """ > Test that first set of articles has a next set > """ > response = self.client.get('/articles/?num_per_page=10') > self.assertTrue(response.context['articles'].has_next) > - > If I run python manage.py test articles.ArticlePaginationTestCase I > get: > > Creating test database... > Creating table django_admin_log > Creating table auth_permission > Creating table auth_group > Creating table auth_user > Creating table auth_message > Creating table django_content_type > Creating table django_flatpage > Creating table django_redirect > Creating table django_session > Creating table django_site > Creating table articles_article > Installing index for admin.LogEntry model > Installing index for auth.Permission model > Installing index for auth.Message model > Installing index for flatpages.FlatPage model > Installing index for redirects.Redirect model > Installing index for articles.Article model > > -- > Ran 0 tests in 0.000s > > OK > Destroying test database... > > I would've expected it to run both test methods under > ArticlesPaginationTestCase. Ah.. but there's the rub - it _did_ run all the test cases in ArticlesPaginationTestCase :-) The point of confusion is that there are no tests in ArticlesPaginationTestCase - at least, not according to the criteria of unittest.TestCase. TestCase requires that test functions _must_ have a name starting with "test" - thats how it automatically discovers the test cases. So, from the point of view of unittest.TestCase: class ArticleTestCase(TestCase): def test_index(self): ... def test_index_default_list(self): ... contains two tests, but: class ArticlePaginationTestCase(TestCase): def default_num_per_page(self): ... def first_set_has_next(self): ... contains no tests - it just contains two utility methods. When you explicitly name the test on the command line, you work around the problem. Since no automatic discovery is required, the prefix isn't strictly required, and so the test can run. If you want unittest to discover the tests automatically, just rename the test cases and prepend the "test" prefix. This isn't something unique to Django - it's a common feature of all the xUnit family of APIs. Yours, Russ Magee %-)k --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Linking items from the same model
On 17 oct, 21:00, Oleg Oltar wrote: > I tried to do it. It works really nice. > > I wonder how can I query all articles related to the current one in a > view... Need some examples. others = current_article.related.all() # or any queryset method > Also currently I see all articles in a listbox...And as far as I have more > then 200 in the database it's quite hard to select something. Maybe its > possible to arrange some filters to the list? I strongly suggest you spend some time reading the FineManual(tm). wrt/ your questions, the following links might help you... http://docs.djangoproject.com/en/dev/ref/models/querysets/ http://docs.djangoproject.com/en/dev/topics/forms http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ http://docs.djangoproject.com/en/dev/ref/contrib/admin/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Unable to serialize database: User matching query does not exist.
In application `tasks` there is model `Employee` which is subclass of django.contrib.auth.models.User. I can `dumpdata tasks`, but when I try to dump whole project or `auth` application, I get this: django.contrib.auth.models.DoesNotExist: User matching query does not exist. > I checked twice if there are integrity errors, and there is not. So, now I'm confused :( -- regards, Mihail --~--~-~--~~~---~--~~ 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: Django SAAS projects
These might be helpful http://code.djangoproject.com/wiki/DynamicModels http://www.djangosnippets.org/snippets/442/ Mohammad Tayseer http://spellcoder.com/blogs/tayseer From: Savy To: Django users Sent: Friday, October 16, 2009 11:09:16 PM Subject: Django SAAS projects Hi Djangonauts, I am developing a Django project (with a few pluggable apps). I want to offer this project as a SaaS (something like 37signals.com). i.e: customer1.product1.com , customer2.product2.com etc product1 could be the basecamp product2 could be highrise and so on. I want to know how the project should be structured for these products. Should there be a single project under which all products will be an application. OR Should I be making different projects for all the products. Also interms of database.. should all the products look into a single database or we should have seperate databases for each product. I am looking out for the most efficient and scalable way to do this. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django methodologies and best practices
Ah, thanks for the input. In this case I'm just developing an app for my own gratification. Unfortunately, I have rough idea as to what I'd like it to do eventually, but since the details aren't set in stone or even pencil I'm looking for some ideas to get started. Plus it never hurts to learn about others' methodologies if only for comparison and consideration. On Oct 18, 5:32 am, Tomasz Zieliński wrote: > It surely depends on your input. If you have detailed specification > of user interface, then writing URLconfs is probably more or less no- > brainer, > and also the design can often be quite obvious. > > On the other hand, if you're starting in 'fluid' environment > and project doesn't have a direction, then you're forced to start > with one view and evolve design. > > Re templates - it depends on whether you receive them from you > customer > or only know some general requirements and have to improvise until > some consensus > is reached. > > So, if you ask me, then there is no single answer to your questions. > If you want to get more precise answer then you have to provide > some more insight into your problem. > > -- > Tomasz Zielinskihttp://pyconsultant.eu --~--~-~--~~~---~--~~ 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: Django methodologies and best practices
Ah, thanks for the input. In this case I'm just developing an app for my own gratification. Unfortunately, I have rough idea as to what I'd like it to do eventually, but since the details aren't set in stone or even pencil I'm looking for some ideas to get started. Plus it never hurts to learn about others' methodologies if only for comparison and consideration. On Oct 18, 5:32 am, Tomasz Zieliński wrote: > It surely depends on your input. If you have detailed specification > of user interface, then writing URLconfs is probably more or less no- > brainer, > and also the design can often be quite obvious. > > On the other hand, if you're starting in 'fluid' environment > and project doesn't have a direction, then you're forced to start > with one view and evolve design. > > Re templates - it depends on whether you receive them from you > customer > or only know some general requirements and have to improvise until > some consensus > is reached. > > So, if you ask me, then there is no single answer to your questions. > If you want to get more precise answer then you have to provide > some more insight into your problem. > > -- > Tomasz Zielinskihttp://pyconsultant.eu --~--~-~--~~~---~--~~ 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: Problem in installing database adapter.
I don't remember how I installed it (mysqldb or python-mysqldb), but assuming that this is the correct module, then it's possible that it's for different Python version that you are actually using. For example, default Python for Ubuntu 8 is, iirc, 2.5.2, while you might be using 2.4 or 2.6 for your development. If this is the case, then you can try easy_install for your version of Python, again iirc (writing out of my head), it could be as simple as easy_install2.6 mysqldb -- Tomasz Zielinski, http://pyconsultant.eu --~--~-~--~~~---~--~~ 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: How to restrict True value to only one row in table column
Maybe you can use something like this: http://stackoverflow.com/questions/1346765/unique-constraint-that-allows-empty-values-in-mysql This would probably mean converting is_master to: is_master = models.BooleanField(null=True, blank=True, unique=True) - and possibly overriding save to convert accidental False-s to None- s. Other solution would be to store somewhere (possibly in separate model with single instance) separate value: which_Thing_is_master Just some quick ideas. -- Tomasz Zielinski http://pyconsultant.eu --~--~-~--~~~---~--~~ 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: Django SAAS projects
There is also second issue to consider - single database is a potential security threat (one customer might be able to access data of second customer if you have a bug in your code). -- Tomasz Zielinski, http://pyconsultant.eu --~--~-~--~~~---~--~~ 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: Django methodologies and best practices
It surely depends on your input. If you have detailed specification of user interface, then writing URLconfs is probably more or less no- brainer, and also the design can often be quite obvious. On the other hand, if you're starting in 'fluid' environment and project doesn't have a direction, then you're forced to start with one view and evolve design. Re templates - it depends on whether you receive them from you customer or only know some general requirements and have to improvise until some consensus is reached. So, if you ask me, then there is no single answer to your questions. If you want to get more precise answer then you have to provide some more insight into your problem. -- Tomasz Zielinski http://pyconsultant.eu --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem in installing database adapter.
Hi all, I have run the command "sudo apt-get install python-mysqldb" successfully, but when I run the command "python manage.py shell" it said something like "No module named MySQLdb". Can anyone of you help me solving this? Thank you for your consideration! BR, LQD. --~--~-~--~~~---~--~~ 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: AttributeError when trying to run syncdb after installing django-friends
Hi Gezim, On Sun, Oct 18, 2009 at 7:58 AM, Gezim Hoxha wrote: > I also added "friends" to the INSTALLED_APPS. > That all went fine. However running syncdb gave me this error: Is friends django application or your custom application? looks like you got the path in the installed_apps wrong can you paste the installed apps from the setting file? -- regards, Prashanth twitter: munichlinux blog: prashanthblog.appspot.com irc: munichlinux, JSLint, munichpython. --~--~-~--~~~---~--~~ 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 restrict True value to only one row in table column
Hi all, Let's say I have a model like so: class Thing(models.Model): is_master = models.BooleanField() name = models.CharField() Now I want to be sure that only one Thing is_master at any given time. The rest of the Things must not be master and end users shouldn't be able to make a sencond Thing master by mistake through the admin site. As far as I can tell, I have to override my model's save() method, but I'm not sure how well that will play with the automatic admin site... Regards, Guillermo --~--~-~--~~~---~--~~ 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: how to handle menu links in a template
Thanks a lot for your help! In case someone is struggling with the same here is a link how to handle custom context processors: http://stackoverflow.com/questions/433162/can-i-access-constants-in-settings-py-from-templates-in-django --~--~-~--~~~---~--~~ 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: How do I add an incrementing numeric field to a generic list?
On Oct 18, 3:11 am, jeffself wrote: > I've got a view that returns a generic list. It contains the following > fields: > school, wins, losses, pf, pa, rating > > I want to add a field called rank that assigns the values 1 through > whatever for each of the records returned. Is this possible using the > templating engine or do I have to write pure python code to achieve > this? > > Here's my views.py: > > def rankings_by_conference(request, conference): > try: > conference = Conference.objects.get(slug__iexact=conference) > except Conference.DoesNotExist: > raise Http404 > > return list_detail.object_list( > request, > queryset = SchoolData.objects.filter > (school_season__conference=conference).order_by('-rating'), > template_name = "college/rankings_by_conference.html", > template_object_name = "rankings", > extra_context = {"conference": conference} > ) > > And here's my template: > {% extends "base.html" %} > > {% block title %}Rankings by Conference{% endblock %} > > {% block content %} > > 2009 {{ conference.conf_name }} Rankings > > > > > Rank > School > Wins > Losses > Ties > PF > PA > Rating > Schedule Strength > > > {% for ranking in rankings_list %} > > {{ rankings.counter }} > {{ ranking.school_season.school.short_name }} > {{ ranking.wins }} > {{ ranking.losses }} > {{ ranking.ties }} > {{ ranking.pf }} > {{ ranking.pa }} > {{ ranking.rating }} > {{ ranking.schedule_strength }} > > {% endfor %} > > > > {% endblock %} > > As you can see, I've tried using the counter variable but its not > returning anything. It should be {{ forloop.counter }}. See http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for -- DR. --~--~-~--~~~---~--~~ 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: Django SAAS projects
Savy kirjoitti: > > > Hi Djangonauts, > > I am developing a Django project (with a few pluggable apps). > > I want to offer this project as a SaaS (something like 37signals.com). > > i.e: customer1.product1.com , customer2.product2.com etc > > product1 could be the basecamp product2 could be highrise and so on. > > I want to know how the project should be structured for these > products. > > Should there be a single project under which all products will be an > application. OR Should I be making different projects for > all the products. > > Also interms of database.. should all the products look into a single > database or we should have seperate databases for each product. > > I am looking out for the most efficient and scalable way to do this. I'm not saying this is best and most scalable way but we're doing SaaS Django projects and it's project per customer. And each project will have it's own database (Oracle schema usually) so we can scale up pretty much. -- Jani Tiainen --~--~-~--~~~---~--~~ 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: Stored proderures/functions in Django
Tomas Pelka kirjoitti: > Hi gang, > I know that Django do not support stored procedures/function, but is > here still a chance to handle this stuff in Django? > > I found this http://www.djangosnippets.org/snippets/272/, have somebody > experience with this? > > Thanks for advices, > cheers Tom. > I don't think so, there is no database agnostic way to do it and more over it varies quite a lot between different DBMSes. What would be useful (there is even ticket for that) to able to populate model instances from raw queries and thus for example from return value(s) of such database spesific calls. And meanwhile you always can call raw sql to anything you want django supports it. -- Jani Tiainen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---