Template inheritance
Hello, I am using django admin for my project so I am not writing much templates by myself, therefore I am not very skilled with them, so excuse me if I ask dumb question. I have extended base_site.html to add browser refresh in block extrahead. I do not want however to do refresh while I am inserting data. In my change_form.html I have something as {% block extrahead %}{{ block.super }} What I would need is the possiblity to have some template variable that is True for base_site.html and that I set to False only in change_form.html, and then I could use that in base_site.html something as base_site.html {% block extrahead %} {% if do_refresh %} {% endif %} {% endblock %} I understand that the template is only for presentation and not logic, as found in docs, but this I do see as logic of presentation:) I am looking in docs but can not see anythign useful for my scenario, which should not be so uncommon. What's the proper way to solve this. Thanks Nenad -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Template inheritance
If the refresh is the only thing in your "extrahead" block, then just don't add block.super to extrahead in your change form, and you can eliminate the "if" statement from it in your base template. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Template inheritance
Thanks, yes, this is what I did. I just wanted to know if there is a better way. In the case I add something more to base_site extrahead I would be in trouble. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Template inheritance
Hi Nenad, you can wrap your meta-refresh line in another block and then delete it's content in templates which shouldn't be refreshed. # base_site.html {% block extrahead %} {% block extrahead-refresh %} {% endblock %} {% endblock %} # change_form.html -- deletes content of block extrahead-refresh {% block extrahead-refresh %}{% endblock %} Quote from django docs: * More {% block %} tags in your base templates are better. Remember, child templates don’t have to define all parent blocks, so you can fill in reasonable defaults in a number of blocks, then only define the ones you need later. It’s better to have more hooks than fewer hooks. Cheers, Tom Dne Sat, 9 Mar 2013 01:41:35 -0800 (PST) Nenad Cikic napsal(a): > Hello, > I am using django admin for my project so I am not writing much templates > by myself, therefore I am not very skilled with them, so excuse me if I ask > dumb question. > I have extended base_site.html to add browser refresh in block extrahead. > I do not want however to do refresh while I am inserting data. > In my change_form.html I have something as > {% block extrahead %}{{ block.super }} > > What I would need is the possiblity to have some template variable that is > True for base_site.html and that I set to False only in change_form.html, > and then I could use that in base_site.html something as > > base_site.html > {% block extrahead %} > {% if do_refresh %} > > {% endif %} > {% endblock %} > > I understand that the template is only for presentation and not logic, as > found in docs, but this I do see as logic of presentation:) > I am looking in docs but can not see anythign useful for my scenario, which > should not be so uncommon. > > What's the proper way to solve this. > Thanks > Nenad > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Template inheritance
Many thanks I new it should exist better way. Nenad -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: urls.py not loading changes
I understand but I cannot locate the FastCGI process to stop it. When I type "locate *.fcgi" I get no results at all so unfortunatelly I don't know how to stop the Django (or fastCGI) process itself. Can anyone help me, please? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Urls on the fly
Hi Serge, The following works and is almost the same as your code: url_list = [] for i in range(0, 4): url_list.append(url(r'^%d$' % i, 'view%d' % i)) urlpatterns = patterns('', *url_list) As patterns is a function that expects multiple arguments each of which (other than the first) is a url pattern, you need to pass *url_list to it and not url_list. As for your error on the url(), the error indicates that though the function has received 2 arguments it hasn't received the two *required* arguments it needs, this could be if in the actual code you are passing one optional keyword argument. Could you paste the exact url call from your code? Regards, Atul On Saturday, 9 March 2013 06:03:05 UTC+11, Serge G. Spaolonzi wrote: > > I am looking the way to create urls on the fly. > This is a simplified version of the code I am using: > > def get_urls(): > url_list = [] > for code in external_code_list: > url_list.append( > url(r'^%s/$' % code, > view > ) > ) > urlpatterns = patterns('', url_list) > return urlpatterns > > > urlpatterns = get_urls() > > It throws "url() takes at least 2 arguments (2 given)" > > Any idea? > > Thanks > > -- > Serge G. Spaolonzi > Cobalys Systems > http://www.cobalys.com > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Upgrade to 1.5 issues
I'll try to answer your second question: On Saturday, 9 March 2013 16:07:46 UTC+11, jayhalleaux wrote: > > > > 2. Accessing user profile data from a session. > > Example: > > models.py > > from django.contrib.auth.models import User > > class UserProfile(models.Model): > > user = models.ForeignKey(User, unique=True) > timestamp = models.DateTimeField(auto_now_add=True) > > > So in the above example if I get the User object from a session how do I > get the session data. > Per the documentation it looks like it should be: > > user = request.user > > timestamp = user.userprofile.timestamp > > > I get that user does not have userprofile attribute. > > Hopefully someone can help... > > user.userprofile will only work if you have a OneToOneField rather than ForeignKey (which is a many-to-one relationship) in the UserProfile model pointing to User. When you have a ForeignKey, the user object will instead have user.userprofile_set which is a manager, so you could do user.userprofile_set.all() to get all the profiles for this user. This is probably not what you want so use a OneToOneField instead. Cheers, Atul -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: how to automatically create userprofile when user is created from admin
On Saturday, 9 March 2013 04:56:52 UTC+11, frocco wrote: > > Hello, > > right now, if I create a user in admin, I have to also create their > userprofile that I have defined in settings. > > Is there a way to automate this? > > Thanks > > > Hi, If by automate you mean admin should allow you to fill in user profile information at the same time as the user then you need to use admin inlines. This will place the user profile form in the same page as the user create page. An example is below: In an admin.py file in your app (this assumes that your profile model is called UserProfile) admin.site.unregister(User) # don't use the default user ModelAdmin class UserProfileInline(admin.TabularInline): model = UserProfile # change this to whatever your actual profile model is called and import it class UserAdmin(admin.ModelAdmin): inlines = [UserProfileInline] admin.site.register(User, UserAdmin) # use the new ModelAdmin Hope this helps. Atul -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: urls.py not loading changes
On Fri, Mar 8, 2013 at 6:14 PM, Asier Hernández Juanes wrote: > When I type "locate *.fcgi" I get no results at all that searches for files. no relation to processes. to help you, first we need to know a bit about your deployment architecture, specially which WSGI server you're using behind nginx. for FastCGI, one easy to use is flup. it can be started using the Django manage.py script: # python manage.py runfcgi another popular choice is a fast python http server, like gunicorn. in either case, it's usually not started from the command line, but from a startup script. also, most of these scripts don't run directly the server, but use some daemon monitor. like supervisord, or start-stop-daemon. as you see, there are lots of options so, which is your case? which steps you did to install your app? -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: urls.py not loading changes
The problem is that I am administrating this server where the Django application was already installed and deployed so I don't have this information. However I have execute "ps -e" to view all the processes running on my server and I got this: PID TTY TIME CMD 1 ?00:00:25 init 2 ?00:00:00 kthreadd 3 ?00:03:02 ksoftirqd/0 5 ?00:00:00 kworker/u:0 6 ?00:00:00 migration/0 7 ?00:08:20 watchdog/0 8 ?00:00:00 cpuset 9 ?00:00:00 khelper 10 ?00:00:00 kdevtmpfs 11 ?00:00:00 netns 12 ?00:00:27 sync_supers 13 ?00:00:00 bdi-default 14 ?00:00:00 kintegrityd 15 ?00:00:00 kblockd 16 ?00:00:00 ata_sff 17 ?00:00:00 khubd 18 ?00:00:00 md 19 ?00:05:58 kworker/0:1 21 ?00:00:02 khungtaskd 22 ?00:05:22 kswapd0 23 ?00:00:00 ksmd 24 ?00:00:00 fsnotify_mark 25 ?00:00:00 ecryptfs-kthrea 26 ?00:00:00 crypto 35 ?00:00:00 kthrotld 36 ?00:00:00 scsi_eh_0 37 ?00:00:00 scsi_eh_1 40 ?00:00:00 binder 41 ?00:00:00 kworker/u:4 60 ?00:00:00 deferwq 61 ?00:00:00 charger_manager 62 ?00:00:00 devfreq_wq 236 ?00:03:50 jbd2/sda3-8 237 ?00:00:00 ext4-dio-unwrit 353 ?00:00:00 upstart-udev-br 391 ?00:00:00 kjournald 395 ?00:00:00 udevd 541 ?00:00:03 dbus-daemon 554 ?00:00:00 udevd 555 ?00:00:00 udevd 563 ?00:00:00 vballoon 572 ?00:08:35 rsyslogd 577 ?00:00:00 kpsmoused 597 ?00:00:00 kworker/0:2 730 ?00:00:01 upstart-socket- 739 ?00:01:17 sshd 832 tty4 00:00:00 getty 838 tty5 00:00:00 getty 862 tty2 00:00:00 getty 863 tty3 00:00:00 getty 869 tty6 00:00:00 getty 880 ?00:00:00 acpid 885 ?00:00:14 cron 887 ?00:00:00 atd 990 ?00:00:02 mdadm 1015 ?00:00:21 chronyd 7034 tty1 00:00:00 getty 7890 ?00:01:35 flush-8:0 9790 ?00:00:26 master 9794 ?00:00:04 qmgr 9806 ?00:00:03 tlsmgr 11916 ?00:03:52 uwsgi 11917 ?00:08:18 uwsgi 11918 ?00:06:14 uwsgi 11975 ?00:03:57 uwsgi 11976 ?00:02:19 uwsgi 11977 ?00:01:50 uwsgi 11984 ?00:00:00 nginx 11985 ?00:00:03 nginx 11986 ?00:00:06 nginx 17773 ?00:00:00 pickup 17788 ?00:00:00 sshd 17969 pts/000:00:00 bash 18028 pts/000:00:00 ps 18065 ?00:54:38 mysqld I think the key process is uwsgi but I can't find he way to restart it if is this the process tha I need to restart. How do you think? Thanks again! El sábado, 9 de marzo de 2013 15:22:07 UTC+1, Javier Guerra escribió: > > On Fri, Mar 8, 2013 at 6:14 PM, Asier Hernández Juanes > > wrote: > > When I type "locate *.fcgi" I get no results at all > > > that searches for files. no relation to processes. > > to help you, first we need to know a bit about your deployment > architecture, specially which WSGI server you're using behind nginx. > > for FastCGI, one easy to use is flup. it can be started using the > Django manage.py script: > > # python manage.py runfcgi > > another popular choice is a fast python http server, like gunicorn. > > in either case, it's usually not started from the command line, but > from a startup script. also, most of these scripts don't run directly > the server, but use some daemon monitor. like supervisord, or > start-stop-daemon. > > as you see, there are lots of options > > so, which is your case? which steps you did to install your app? > > > -- > Javier > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: TestCase - send POST with m2m data?
Oh, how could I miss that. Now I see it. Thanks :) To submit multiple values for a given key – for example, to specify the > selections for a – provide the values as a list or > tuple for the required key. For example, this value of data would submit > three selected values for the field named choices: > {'choices': ('a', 'b', 'd')} On Saturday, March 9, 2013 3:34:19 AM UTC+1, Russell Keith-Magee wrote: > > > > On Fri, Mar 8, 2013 at 7:52 PM, galgal > > wrote: > >> As in the topic - how can I prepare POST data dictionary in TestCase to >> send it via POST? >> I can see how it works in real admin POST in Chrome: >> >> --WebKitFormBoundaryEXChB8PRJPhaP3OQ >> Content-Disposition: form-data; name="visibly_usergroup" 1 >> --WebKitFormBoundaryEXChB8PRJPhaP3OQ >> Content-Disposition: form-data; name="visibly_usergroup" 2 >> --WebKitFormBoundaryEXChB8PRJPhaP3OQ >> Content-Disposition: form-data; name="visibly_usergroup" 5 >> >> How to simulate that? >> > > Hi, > > You don't need to concern yourself about the POST data encoding -- you > just pass in a list of values instead of a single value to the data > argument in the test client. > > self.client.post('/your/url/here'/, data={'visibly_usergroup': > ['1','2','5']} > > This is all covered in the docs; specifically on the section on POST > operation of the test client: > > > https://docs.djangoproject.com/en/1.5/topics/testing/overview/#django.test.client.Client.post > > Yours, > Russ Magee %-) > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: urls.py not loading changes
I have launched a "/etc/init.d/uwsgi restart" but the application is still not loading the changes in urls.py file. I think I have to kill the process because after restarting the uwsgi process the PID is still the same: *root@miami ~ # ps -fea|grep uwsgi uwsgi11916 1 0 Jan22 ?00:03:52 uwsgi --uid uwsgi --home /home/oper/bros --pythonpath /home/oper/bros/src --socket 127.0.0.1:5001 --chmod-socket --module wsgi -b 8192 --logdate --optimize 2 --processes 2 --master --logto /home/oper/bros/log/uwsgi.log uwsgi11917 11916 0 Jan22 ?00:08:19 uwsgi --uid uwsgi --home /home/oper/bros --pythonpath /home/oper/bros/src --socket 127.0.0.1:5001 --chmod-socket --module wsgi -b 8192 --logdate --optimize 2 --processes 2 --master --logto /home/oper/bros/log/uwsgi.log uwsgi11918 11916 0 Jan22 ?00:06:15 uwsgi --uid uwsgi --home /home/oper/bros --pythonpath /home/oper/bros/src --socket 127.0.0.1:5001 --chmod-socket --module wsgi -b 8192 --logdate --optimize 2 --processes 2 --master --logto /home/oper/bros/log/uwsgi.log uwsgi11975 1 0 Jan22 ?00:03:57 uwsgi --uid uwsgi --home /home/oper/fys --pythonpath /home/oper/fys/src --socket 127.0.0.1:5002 --chmod-socket --module wsgi -b 8192 --logdate --optimize 2 --processes 2 --master --logto /home/oper/fys/log/uwsgi.log uwsgi11976 11975 0 Jan22 ?00:02:19 uwsgi --uid uwsgi --home /home/oper/fys --pythonpath /home/oper/fys/src --socket 127.0.0.1:5002 --chmod-socket --module wsgi -b 8192 --logdate --optimize 2 --processes 2 --master --logto /home/oper/fys/log/uwsgi.log uwsgi11977 11975 0 Jan22 ?00:01:50 uwsgi --uid uwsgi --home /home/oper/fys --pythonpath /home/oper/fys/src --socket 127.0.0.1:5002 --chmod-socket --module wsgi -b 8192 --logdate --optimize 2 --processes 2 --master --logto /home/oper/fys/log/uwsgi.log root 18451 17969 0 16:30 pts/000:00:00 grep --color=auto uwsgi* Some clue to restart uwsgi process. I know how to kill it but what is the best way to restart it? Thanks! El sábado, 9 de marzo de 2013 16:19:58 UTC+1, Asier Hernández Juanes escribió: > > The problem is that I am administrating this server where the Django > application was already installed and deployed so I don't have this > information. > > However I have execute "ps -e" to view all the processes running on my > server and I got this: > > PID TTY TIME CMD > 1 ?00:00:25 init > 2 ?00:00:00 kthreadd > 3 ?00:03:02 ksoftirqd/0 > 5 ?00:00:00 kworker/u:0 > 6 ?00:00:00 migration/0 > 7 ?00:08:20 watchdog/0 > 8 ?00:00:00 cpuset > 9 ?00:00:00 khelper >10 ?00:00:00 kdevtmpfs >11 ?00:00:00 netns >12 ?00:00:27 sync_supers >13 ?00:00:00 bdi-default >14 ?00:00:00 kintegrityd >15 ?00:00:00 kblockd >16 ?00:00:00 ata_sff >17 ?00:00:00 khubd >18 ?00:00:00 md >19 ?00:05:58 kworker/0:1 >21 ?00:00:02 khungtaskd >22 ?00:05:22 kswapd0 >23 ?00:00:00 ksmd >24 ?00:00:00 fsnotify_mark >25 ?00:00:00 ecryptfs-kthrea >26 ?00:00:00 crypto >35 ?00:00:00 kthrotld >36 ?00:00:00 scsi_eh_0 >37 ?00:00:00 scsi_eh_1 >40 ?00:00:00 binder >41 ?00:00:00 kworker/u:4 >60 ?00:00:00 deferwq >61 ?00:00:00 charger_manager >62 ?00:00:00 devfreq_wq > 236 ?00:03:50 jbd2/sda3-8 > 237 ?00:00:00 ext4-dio-unwrit > 353 ?00:00:00 upstart-udev-br > 391 ?00:00:00 kjournald > 395 ?00:00:00 udevd > 541 ?00:00:03 dbus-daemon > 554 ?00:00:00 udevd > 555 ?00:00:00 udevd > 563 ?00:00:00 vballoon > 572 ?00:08:35 rsyslogd > 577 ?00:00:00 kpsmoused > 597 ?00:00:00 kworker/0:2 > 730 ?00:00:01 upstart-socket- > 739 ?00:01:17 sshd > 832 tty4 00:00:00 getty > 838 tty5 00:00:00 getty > 862 tty2 00:00:00 getty > 863 tty3 00:00:00 getty > 869 tty6 00:00:00 getty > 880 ?00:00:00 acpid > 885 ?00:00:14 cron > 887 ?00:00:00 atd > 990 ?00:00:02 mdadm > 1015 ?00:00:21 chronyd > 7034 tty1 00:00:00 getty > 7890 ?00:01:35 flush-8:0 > 9790 ?00:00:26 master > 9794 ?00:00:04 qmgr > 9806 ?00:00:03 tlsmgr > 11916 ?00:03:52 uwsgi > 11917 ?00:08:18 uwsgi > 11918 ?00:06:14 uwsgi > 11975 ?00:03:57 uwsgi > 11976 ?00:02:19 uwsgi > 11977 ?00:01:50 uwsgi > 11984 ?00:00:00 nginx > 11985 ?00:00:03 nginx > 11986 ?00:00:06 nginx > 17773 ?00:00:00 pickup > 17788 ?00:00:00 sshd > 17969 pts/000:00:00 bash > 18028 pts/000:00:00 ps > 18065 ?00:54:38
Problem with testing Django files (sources).
Hello, I have little problem with testing Django sources in Windows. I have fresh sources from "git clone". I used Git shell (sh.exe) from "Git Bash". When: *PYTHONPATH=.. /python.exe runtests.py --settings=test_sqlite* I receive these errors: == > FAIL: test_naturalday_uses_localtime > (django.contrib.humanize.tests.HumanizeTests) > -- > Traceback (most recent call last): > File "D:\- Repositories GIT -\django\django\contrib\humanize\tests.py", > line 162, in test_naturalday_uses_localtime > self.humanize_tester([dt], ['yesterday'], 'naturalday') > File "D:\- Repositories GIT -\django\django\contrib\humanize\tests.py", > line 48, in humanize_tester > msg="%s test failed, produced '%s', should've produced '%s'" % > (method, rendered, result)) > AssertionError: naturalday test failed, produced 'today', should've > produced 'yesterday' > > == > FAIL: test_aware_expiration (requests.tests.RequestsTests) > Cookie accepts an aware datetime as expiration time > -- > Traceback (most recent call last): > File "D:\- Repositories GIT -\django\tests\requests\tests.py", line 275, > in test_aware_expiration > self.assertEqual(datetime_cookie['max-age'], 10) > AssertionError: 11 != 10 > > == > FAIL: test_near_expiration (requests.tests.RequestsTests) > Cookie will expire when an near expiration time is provided > -- > Traceback (most recent call last): > File "D:\- Repositories GIT -\django\tests\requests\tests.py", line 266, > in test_near_expiration > self.assertEqual(datetime_cookie['max-age'], 10) > AssertionError: 11 != 10 > > == > FAIL: test_feed_last_modified_time (syndication.tests.SyndicationFeedTest) > -- > Traceback (most recent call last): > File "D:\- Repositories GIT -\django\tests\syndication\tests.py", line > 265, in test_feed_last_modified_time > self.assertEqual(response['Last-Modified'], 'Thu, 03 Jan 2008 19:30:00 > GMT') > AssertionError: 'Thu, 03 Jan 2008 12:30:00 GMT' != u'Thu, 03 Jan 2008 > 19:30:00 GMT' > > -- > Ran 5124 tests in 2268.805s > > FAILED (failures=4, skipped=217, expected failures=9) > Does anyone know what I'm doing wrong? regards -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Problem with testing Django sources
Hello, I have problem with testing Django sources from Git. When I use: * PYTHONPATH=.. /python runtests.py --settings=test_sqlite*(in Windows with Git Shell). I receive these errors: == FAIL: test_naturalday_uses_localtime (django.contrib.humanize.tests.HumanizeTests) -- Traceback (most recent call last): File "D:\- Repositories GIT -\django\django\contrib\humanize\tests.py", line 162, in test_naturalday_uses_localtime self.humanize_tester([dt], ['yesterday'], 'naturalday') File "D:\- Repositories GIT -\django\django\contrib\humanize\tests.py", line 48, in humanize_tester msg="%s test failed, produced '%s', should've produced '%s'" % (method, rendered, result)) AssertionError: naturalday test failed, produced 'today', should've produced 'yesterday' == FAIL: test_aware_expiration (requests.tests.RequestsTests) Cookie accepts an aware datetime as expiration time -- Traceback (most recent call last): File "D:\- Repositories GIT -\django\tests\requests\tests.py", line 275, in test_aware_expiration self.assertEqual(datetime_cookie['max-age'], 10) AssertionError: 11 != 10 == FAIL: test_near_expiration (requests.tests.RequestsTests) Cookie will expire when an near expiration time is provided -- Traceback (most recent call last): File "D:\- Repositories GIT -\django\tests\requests\tests.py", line 266, in test_near_expiration self.assertEqual(datetime_cookie['max-age'], 10) AssertionError: 11 != 10 == FAIL: test_feed_last_modified_time (syndication.tests.SyndicationFeedTest) -- Traceback (most recent call last): File "D:\- Repositories GIT -\django\tests\syndication\tests.py", line 265, in test_feed_last_modified_time self.assertEqual(response['Last-Modified'], 'Thu, 03 Jan 2008 19:30:00 GMT') AssertionError: 'Thu, 03 Jan 2008 12:30:00 GMT' != u'Thu, 03 Jan 2008 19:30:00 GMT' -- Ran 5124 tests in 2268.805s FAILED (failures=4, skipped=217, expected failures=9) Does anyone know what I'm doing wrong? regards, VVilku -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Upgrade to 1.5 issues
thanks... i totally blanked as to where i was making the mistake. On Saturday, March 9, 2013 3:39:06 AM UTC-5, Atul Bhouraskar wrote: > > > I'll try to answer your second question: > > On Saturday, 9 March 2013 16:07:46 UTC+11, jayhalleaux wrote: >> >> >> > > >> 2. Accessing user profile data from a session. >> >> Example: >> >> models.py >> >> from django.contrib.auth.models import User >> >> class UserProfile(models.Model): >> >> user = models.ForeignKey(User, unique=True) >> timestamp = models.DateTimeField(auto_now_add=True) >> >> >> So in the above example if I get the User object from a session how do I >> get the session data. >> Per the documentation it looks like it should be: >> >> user = request.user >> >> timestamp = user.userprofile.timestamp >> >> >> I get that user does not have userprofile attribute. >> >> Hopefully someone can help... >> >> > user.userprofile will only work if you have a OneToOneField rather than > ForeignKey (which is a many-to-one relationship) in the UserProfile model > pointing to User. > > When you have a ForeignKey, the user object will instead have > user.userprofile_set which is a manager, so you could do > user.userprofile_set.all() to get all the profiles for this user. This is > probably not what you want so use a OneToOneField instead. > > Cheers, > > Atul > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: django-registration vs Django 1.5
I setup a brand new 1.5 project today. I had everything working fine. Was using django's built in admin to test/refine and add data to my models. Then I installed django-registration using the repo below, and grabbed the templates. The good news is that, yes, the registration stuff works and allows me to add new users. The bad news, django admin is no longer operable. I have already tried adding 'django.contrib.auth.backends.ModelBackend', to AUTHTENTICATION_SETTINGS (which helped other people in prior versions). But that has not worked and I cannot figure it out. Any ideas? On Friday, March 1, 2013 9:07:53 AM UTC-7, jompa wrote: > > Hi Xavi, > > I'm wrestling with the same problem right now. > > There are a couple of pull request to solve this but until they are > accepted I'm using this fork: > > https://bitbucket.org/eire1130/django-registration > > pip install > https://bitbucket.org/eire1130/django-registration/get/tip.tar.gz > > /Johan > > > On Mar 1, 2013, at 4:53 PM, Xavier Pegenaute wrote: > > Hi, > > seems django-registration doesn't support properly the new user model from > Django 1.5, any one know how to work around it, or at least some other > application able to deal with Django 1.5? > > Thanks, > Xavi > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users...@googlegroups.com . > To post to this group, send email to django...@googlegroups.com > . > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: django-registration vs Django 1.5
I plan to work on it at the PyCon sprints. Rejected some pull requests lately though due to people abusing various features of bitbucket to spam rather than to help, and my policy is not to reward that kind of behavior. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Survey : Theme for Django admin interface
Hi, Was wondering if there are *paid* takers for themes for the django-admin interface. I know there are a few that exist already but am not quite happy with them. I can definitely spend a few days/weeks and develop some nice looking ones, but wanted to check if people are really looking for some fresh air or not, and are ready to pay for it :) And well, i do not intend to price it more than 40$ per theme(or less than that!). Non-commercial+personal usage would be free, obviously; and all this being CC licensed. Regards, Venkat -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.