Is django-nonrel still updating, or will be part of future django
Is django-nonrel still updating, or will be part of future django What is most used framework when django is used with MongoDB. Thanks! -Alex -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/19ecd3bd-a45f-4d3c-9f0b-65c65436fd66%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
no translation file found for domain 'django'
I copied the django distribute into my project folder thinking it will work well it works perfectly in one of my machine ,but throw an error below in another one Traceback (most recent call last): File "manage.py", line 12, in execute_from_command_line(sys.argv) File "cmdb_lib/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "cmdb_lib/django/core/management/__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "cmdb_lib/django/core/management/commands/test.py", line 30, in run_from_argv super(Command, self).run_from_argv(argv) File "cmdb_lib/django/core/management/base.py", line 393, in run_from_argv self.execute(*args, **cmd_options) File "cmdb_lib/django/core/management/commands/test.py", line 74, in execute super(Command, self).execute(*args, **options) File "cmdb_lib/django/core/management/base.py", line 458, in execute translation.activate(saved_locale) File "cmdb_lib/django/utils/translation/__init__.py", line 146, in activate return _trans.activate(language) File "cmdb_lib/django/utils/translation/trans_real.py", line 222, in activate _active.value = translation(language) File "cmdb_lib/django/utils/translation/trans_real.py", line 206, in translation _translations[language] = DjangoTranslation(language) File "cmdb_lib/django/utils/translation/trans_real.py", line 115, in __init__ self._init_translation_catalog() File "cmdb_lib/django/utils/translation/trans_real.py", line 153, in _init_translation_catalog translation = self._new_gnu_trans(localedir, use_null_fallback) File "cmdb_lib/django/utils/translation/trans_real.py", line 136, in _new_gnu_trans fallback=use_null_fallback) File "/usr/local/lib/python2.7/gettext.py", line 472, in translation raise IOError(ENOENT, 'No translation file found for domain', domain) IOError: [Errno 2] No translation file found for domain: u'django' but in my settins.py I set LANGUAGE_CODE = 'en-us' as default! how could this throw an error I tried to pip install django , problem solved ,but I still want to include the django packege in my project how can I achieve this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c4e82d10-c383-4fe7-8890-50f40febd080%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django/Python based webmail
https://github.com/iggy/simone El lunes, 29 de julio de 2013, 12:13:27 (UTC-5), Tomáš Ehrlich escribió: > > Hi there, > I'm looking for django (or python) based webmail, similar to RoundCube > and SquirrelMail. > > I tried djangopackages.com and google search, but it doesn't seem to be > an alive project out there. How you ever wondered why? :) Seems to me > like useful app. > > Thanks in advance > > > Cheers, > Tom > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6423c492-34d6-4641-96c9-54266aceba31%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Exclude models from makemigrations
I'm working with django-salesforce and have salesforce models in my models.py, as well as local models which point to a Postgres database. I am excluding the salesforce models from the migrate command by using managed = False in a meta class on the models. However, makemigrations still generates migrations for the salesforce model which then never get run by migrate. That's ok but seems a little messy. Is there any way to prevent Django generating migrations for particular models? Have searched the django documentation (I think) pretty extensively for a method. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bc155bd7-b46f-4898-b0f0-44e511b89990%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django admin add related object doesn't open popup window?
I pressed F12 on Firefox, and played around to see if I could find anything. But I didn't see anything that looked like an error. But I'm not sure what I am looking for. What else can I do? On Tuesday, October 27, 2015 at 11:32:33 AM UTC-4, Tim Graham wrote: > > Please check the JavaScript console in your browser to see if there are > any errors. > > On Tuesday, October 27, 2015 at 11:18:18 AM UTC-4, j.coss...@gmail.com > wrote: >> >> Thanks, I succesfully disabled the add related button, as a temporary >> patch. >> >> Any ideas of why the pop-up isn't working? >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bf8fe45a-75fe-4061-a735-debba4e83a2e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Making a field readonly according to the user in admin.py
On Wed, Nov 18, 2015, at 07:15, Victor wrote: > Dear experts, > > models.py > > class Book(models.Model): > title = models.CharField(max_length=100) > author = models.CharField(max_length=100) > quantity = models.IntegerField(db_column='quantitity',default=0) > class Meta: > db_table="book" > > admin.py > > class BookOption(admin.ModelAdmin): > list_display = ('title', 'author', 'quantity') > fields=(('title', 'author'), ('quantity')) > order_by= ['title', ] > > admin.site.register(Book,BookOption) > > > I'm trying to explain my problem with the simple example above. > Let's suppose that I have two staff users 'victor' and 'roby' and I want > that the fields 'author and 'quantity' be readonly when user 'roby' is > logged in and readwrite for user 'victor' > How can I achieve this result if possible with something of the following > simple kind > > > class BookOption(admin.ModelAdmin): > if (user is 'roby'): > readonly_fields=['quantity',] > list_display = ('title', 'author', 'quantity') > fields=(('title', 'author'), ('quantity')) > order_by= ['title', ] > > Thanks > Vittorio > > -- I generally solve this via get_readonly_fields(request, obj): if request.user.has_perm(...): return ('somefield',) return () -- Hugo Osvaldo Barrera -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1447940859.2229149.444303673.348A2F62%40webmail.messagingengine.com. For more options, visit https://groups.google.com/d/optout.
Re: Django admin add related object doesn't open popup window?
Yes, it would be in the "Console" tab of that window. You need to open console using F12 first, then trigger the action. If you can create a minimal project that reproduces the error, then other people can try to reproduce it as well. On Thursday, November 19, 2015 at 8:32:32 AM UTC-5, Jorge Fernandez-de-Cossio-Diaz wrote: > > I pressed F12 on Firefox, and played around to see if I could find > anything. But I didn't see anything that looked like an error. But I'm not > sure what I am looking for. What else can I do? > > > On Tuesday, October 27, 2015 at 11:32:33 AM UTC-4, Tim Graham wrote: >> >> Please check the JavaScript console in your browser to see if there are >> any errors. >> >> On Tuesday, October 27, 2015 at 11:18:18 AM UTC-4, j.coss...@gmail.com >> wrote: >>> >>> Thanks, I succesfully disabled the add related button, as a temporary >>> patch. >>> >>> Any ideas of why the pop-up isn't working? >>> >> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e72231cf-4893-4835-af81-fc7636d7c076%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django admin add related object doesn't open popup window?
I'm trying to isolate a small example of the error, but I still haven't quite diagnosed the problem. I appreciate your help. This what I get in the "Console" tab: GET http://192.168.101.10:66/it_meeting/admin/it_meeting_profiles/institute/126/ [HTTP/1.1 200 OK 771ms] GET http://192.168.101.10:66/static/admin/css/base.css [HTTP/1.1 200 OK 0ms] GET http://192.168.101.10:66/static/admin/css/forms.css [HTTP/1.1 200 OK 0ms] GET http://192.168.101.10:66/it_meeting/admin/jsi18n/ [HTTP/1.1 200 OK 17ms] GET http://192.168.101.10:66/static/admin/js/core.js [HTTP/1.1 200 OK 0ms] GET http://192.168.101.10:66/static/admin/js/admin/RelatedObjectLookups.js [HTTP/1.1 200 OK 0ms] GET http://192.168.101.10:66/static/admin/js/jquery.js [HTTP/1.1 200 OK 0ms] GET http://192.168.101.10:66/static/admin/js/jquery.init.js [HTTP/1.1 200 OK 0ms] GET http://192.168.101.10:66/static/admin/js/actions.js [HTTP/1.1 200 OK 0ms] GET http://192.168.101.10:66/static/admin/css/widgets.css [HTTP/1.1 200 OK 0ms] reflow: 0.2ms reflow: 0.45ms reflow: 0.06ms function , jquery.js line 1574 reflow: 0.27ms function , jquery.js line 1574 reflow: 0.13ms function , jquery.js line 1581 reflow: 0.05ms function , jquery.js line 1596 reflow: 0.19ms function , jquery.js line 1596 reflow: 0.21ms function , jquery.js line 1628 reflow: 0.1ms function , jquery.js line 1636 reflow: 0.11ms function , jquery.js line 1642 reflow: 0.06ms function , jquery.js line 1647 reflow: 0.17ms On Thursday, November 19, 2015 at 9:13:01 AM UTC-5, Tim Graham wrote: > > Yes, it would be in the "Console" tab of that window. You need to open > console using F12 first, then trigger the action. If you can create a > minimal project that reproduces the error, then other people can try to > reproduce it as well. > > On Thursday, November 19, 2015 at 8:32:32 AM UTC-5, Jorge > Fernandez-de-Cossio-Diaz wrote: >> >> I pressed F12 on Firefox, and played around to see if I could find >> anything. But I didn't see anything that looked like an error. But I'm not >> sure what I am looking for. What else can I do? >> >> >> On Tuesday, October 27, 2015 at 11:32:33 AM UTC-4, Tim Graham wrote: >>> >>> Please check the JavaScript console in your browser to see if there are >>> any errors. >>> >>> On Tuesday, October 27, 2015 at 11:18:18 AM UTC-4, j.coss...@gmail.com >>> wrote: Thanks, I succesfully disabled the add related button, as a temporary patch. Any ideas of why the pop-up isn't working? >>> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dd6203c2-a287-492f-89bf-b61ce63e1039%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Controlling access at table row level
I've followed up the suggestions given here but am still struggling with this problem. My table rows are marked as 'public' or 'private' and the suggested approaches (and others I could think of) could certainly control access in such a way that logged-in users could access the whole table and other users coukd only access the 'public' items. So far so good. The problem that I can't solve is that the same table is accessed by lots of foreign key relationships from other views in various apps. As far as I can tell, the available solutions all either allow the foreign key access to bypass the security or else result in unresolved foreign key accesses that raise exceptions. Either way, I am having to litter my code with either further security checks or checks for foreign keys to non-existent object instances. I'm kind of coming to the conclusion that there is no elegant solution to this but thought I would ask here one more time. Thanks Steve -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8ad1817d-7c6f-435f-8a6f-650a4ed62160%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Ask for help
*When I migrate the database, I meet some errors, and errors are following:* > Operations to perform: > Synchronize unmigrated apps: staticfiles, messages > Apply all migrations: admin, contenttypes, api, auth, sessions > Synchronizing apps without migrations: > Creating tables... > Running deferred SQL... > Installing custom SQL... > Running migrations: > Rendering model states... DONE > Applying api.0004_auto_20151119_1545...Traceback (most recent call last > ): > File "manage.py", line 10, in > execute_from_command_line(sys.argv) > File > "/Library/Python/2.7/site-packages/django/core/management/__init__.py", > line 354, in execute_from_command_line > utility.execute() > File > "/Library/Python/2.7/site-packages/django/core/management/__init__.py", > line 346, in execute > self.fetch_command(subcommand).run_from_argv(self.argv) > File "/Library/Python/2.7/site-packages/django/core/management/base.py", > line 394, in run_from_argv > self.execute(*args, **cmd_options) > File "/Library/Python/2.7/site-packages/django/core/management/base.py", > line 445, in execute > output = self.handle(*args, **options) > File > "/Library/Python/2.7/site-packages/django/core/management/commands/migrate.py" > , line 222, in handle > executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial) > File > "/Library/Python/2.7/site-packages/django/db/migrations/executor.py", > line 110, in migrate > self.apply_migration(states[migration], migration, fake=fake, > fake_initial=fake_initial) > File > "/Library/Python/2.7/site-packages/django/db/migrations/executor.py", > line 148, in apply_migration > state = migration.apply(state, schema_editor) > File > "/Library/Python/2.7/site-packages/django/db/migrations/migration.py", > line 115, in apply > operation.database_forwards(self.app_label, schema_editor, old_state, > project_state) > File > "/Library/Python/2.7/site-packages/django/db/migrations/operations/fields.py" > , line 62, in database_forwards > field, > File > "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/schema.py", > line 179, in add_field > self._remake_table(model, create_fields=[field]) > File > "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/schema.py", > line 77, in _remake_table > self.effective_default(field) > File > "/Library/Python/2.7/site-packages/django/db/backends/base/schema.py", > line 211, in effective_default > default = field.get_db_prep_save(default, self.connection) > File > "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", > line 710, in get_db_prep_save > prepared=False) > File > "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", > line 1322, in get_db_prep_value > value = self.get_prep_value(value) > File > "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", > line 1317, in get_prep_value > return self.to_python(value) > File > "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", > line 1274, in to_python > parsed = parse_date(value) > File "/Library/Python/2.7/site-packages/django/utils/dateparse.py", > line 60, in parse_date > match = date_re.match(value) > TypeError: expected string or buffer > > *and the source code of models.py is following:* > > from django.db import models from django.core.exceptions import ValidationError from django.utils.dateformat import format from django.contrib.auth.models import AbstractUser from datetime import date import datetime from django.conf import settings from django.db.models import Sum from django.utils import timezone from django.utils.dateformat import format # Create your models here. #Users, Contacts, Events class User(models.Model): phonenum = models.CharField(max_length=20) username = models.CharField(max_length=20) def get_usr_info(self): data = {} # dictionary data['phonenum'] = self.phonenum data['name'] = self.username return data class Contacts(models.Model): user = models.ForeignKey(User) class UpdateEvents(models.Model): user = models.ForeignKey(User) events = models.CharField(max_length=50) latitude = models.CharField(max_length=10) longitude = models.CharField(max_length=10) city = models.CharField(max_length=10) arriveDate = models.DateTimeField(blank=True, null=True) leaveDate = models.DateTimeField(blank=True, null=True) #arriveDate = models.CharField(max_length=15, default="") #leaveDate = models.CharField(max_length=15, default="") def get_events_info(self): data = {} data['phonenum'] = self.user.phonenum data['name'] = self.user.username data['events'] = self.events data['latitude'] = self.latitude data['longitude'] = self.longitude data['city'] = self.city data['arriveDate'] = format(self.arriveDate,
Re: Getting NoReverseMatch and can't find the mistake
Really sorry Tom, I've been looking at your text and thinking about it for most of today, but no penny dropping. I'm rather unsure which bits go where, I'm trying to understand this by rebuilding the tutorial. I can't seem to get my head around this 'reverse()' part: the reverse() as such is used in the HttpResponseRedirect statement whereas the error seems to be caused by the form statement in vraag.html - how do these things connect? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/59230d07-badd-4c1c-b664-f0b26db9a68b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Problem with static folder
Add the path of the static folders to STATICFILES_DIRS list in settings, see documentation: https://docs.djangoproject.com/en/1.9/ref/settings/#std:setting-STATICFILES_DIRS On Wednesday, November 18, 2015 at 7:02:26 PM UTC-2, Dariusz Mysior wrote: > > I had a static folder nr 1 in app accounts and my templates see it, but > when I create folder static nr 2 in my project directory tempalates > dosn't see it. I copy this static folder nr 2 and past to accounts folder > next to this static folder nr 1 and it is visible. Why in project directory > this is not visible? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5bf7ecd8-48e1-47d3-a950-3ff3e5cf8926%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Getting NoReverseMatch and can't find the mistake
On Thursday, 19 November 2015 19:04:05 UTC, Bob Aalsma wrote: > > Really sorry Tom, I've been looking at your text and thinking about it for > most of today, but no penny dropping. > I'm rather unsure which bits go where, I'm trying to understand this by > rebuilding the tutorial. > > I can't seem to get my head around this 'reverse()' part: the reverse() as > such is used in the HttpResponseRedirect statement whereas the error seems > to be caused by the form statement in vraag.html - how do these things > connect? > Tom is mistaken, you *did* pass an argument in your url tag: `{% url 'zoekopdrachten:resultaat' vraag.zoekvraag_id %}`. However, as the error message says, the argument that you passed is being interpreted as the empty string, which doesn't match the url pattern. You haven't posted your models, but I suspect that the reason for this is that there is no such attribute as `zoekvraag_id` on your Vraag model, so `vraag.zoekvraag_id` doesn't return a value. I think you probably meant `vraag.id`. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a450c700-e7ac-4732-bba6-9363991f8e24%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Getting NoReverseMatch and can't find the mistake
Umm, one of the things I've found difficult is to determine the logic in the translation of the class names in models.py to other variables. And I'm sorry to have not included the models.py. This is the part of ZoekVraag: class ZoekVraag(models.Model): vrager = models.ForeignKey(KlantContactPersoon) vraag_naam = models.CharField("naam vraag", max_length=200) vraag_omschrijving = models.TextField("omschrijving vraag", blank = True) vraag_taktiek = models.TextField("taktiek oplossing vraag", blank = True) def __unicode__(self): return self.vraag_naam class Meta: verbose_name = 'zoekvraag' verbose_name_plural = 'zoekvragen' -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7990e791-d7fa-404f-a776-5bde2522a7a7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Is django-nonrel still updating, or will be part of future django
Hi Alex, On Thu, Nov 19, 2015 at 5:09 PM, Alex Yang wrote: > Is django-nonrel still updating, or will be part of future django > I can’t comment on whether nonrel is still updating, but I can say with a high degree of certainty that it is unlikely to be part of Django at any point in the near future. Django has recently gained some new features (in particular, a formalised Meta model) which should remove the need for an invasive patch like nonrel; deep support for MongoDB (and other data stores) should now be possible using public APIs. If you want more details, see my talk at DjangoCon US this year: https://www.youtube.com/watch?v=VgM0qmpHDiE 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. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJxq849ybgwRyZuvewL1s5%2BTYxtyfY6fVmSzhFDrBR8iHKWGyg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Ask for help
Can you post the migration file? It looks like one of the fields you're parsing for date doesn't like the data it's trying to parse (it's expecting a string type, but that may not be what it's getting), -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/26fce308-d609-4863-b310-6e100eba0d77%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Django RedirectView 410 (Gone) Response
url(r'^change-service/$', RedirectView.as_view(pattern_name='new-service', permanent=False)) url(r'^new-service/$', 'service', name='service'), Hitting this route gives a 410 error. I've never used the RedirectView so perhaps I haven't implemented something correctly? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0413bd4a-8e00-4a76-a27c-8b302550c708%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django RedirectView 410 (Gone) Response
It would help if I wasn't using `pattern_name` wrongly. For anyone else who does something similarly sill, `pattern_name` would be the actual pattern name, not the name of the url you want to redirect to. In this case, I want to use `url` with `reverse`. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/73b21c9c-3761-4389-8211-16aebf0c2c76%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django RedirectView 410 (Gone) Response
It would help if I wasn't using `pattern_name` wrongly. For anyone else who does something similarly silly, `pattern_name` would be the actual pattern name, not the name of the url you want to redirect to. In this case, I want to use `url` parameter with `reverse`. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/80b5ebc9-3558-40f9-a324-5430ee5f6375%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
matching query does not exist.
Hi -- I'm working on a personal project, and have been stuck on this problem for a bit of time. There don't seem to be examples out there for editing tables with data. Is this right? Am I looking in the right places? I'm still pretty new at Django, and learning largely on my own. I have a template wherein people can sign up for meal shifts at Burning Man. It doesn't use a form, because the table is populated with data, but until someone signs up for a shift, "camper" is set to None. The page is rendering and displaying data correctly, but when I go to add myself as a logged in user, I get the following error: DoesNotExist at /signup/ mealShifts matching query does not exist. Code is below. Thanks for any help. Signup is the name of the template and the view function. mealShifts (which I know needs to be capitalized) is the name of the model. Here's the view: def signup_for_shift(shift_id, camper): shift = mealShifts.objects.get(pk=shift_id) if shift.camper is not None: raise ValueError shift.camper = camper shift.save() @login_required(login_url='login.html') def signup(request): model = mealShifts user = request.user poss_shifts = mealShifts.objects.all().order_by('day') day_choices = range(0, 6) meal_choices = ['Breakfast', 'Dinner'] shift_choices = ['Chef', 'Sous_Chef', 'KP'] username = None sundayShiftsAvail = mealShifts.objects.filter(day=0, assigned=False) sundayShiftsTaken = mealShifts.objects.filter(day=0, assigned=True) mondayShiftsAvail = mealShifts.objects.filter(day=1, assigned=False) mondayShiftsTaken = mealShifts.objects.filter(day=1, assigned=True) tuesdayShiftsAvail = mealShifts.objects.filter(day=2, assigned=True) tuesdayShiftsTaken = mealShifts.objects.filter(day=2, assigned=True) wednesdayShiftsAvail = mealShifts.objects.filter(day=3, assigned=False) wednesdayShiftsTaken = mealShifts.objects.filter(day=3, assigned=True) thursdayShiftsAvail = mealShifts.objects.filter(day=4, assigned=False) thursdayShiftsTaken = mealShifts.objects.filter(day=4, assigned=True) fridayShiftsAvail = mealShifts.objects.filter(day=5, assigned=False) fridayShiftsTaken = mealShifts.objects.filter(day=5, assigned=True) saturdayShiftsAvail = mealShifts.objects.filter(day=6, assigned=False) saturdayShiftsTaken = mealShifts.objects.filter(day=6, assigned=True) saturdayShiftsAvail = mealShifts.objects.filter(day=7, assigned=False) saturdayShiftsTaken = mealShifts.objects.filter(day=7, assigned=True) if request.method == 'POST': shift_id = request.POST.get('shift_id') signup_for_shift(shift_id, request.user) return redirect('signup') context = RequestContext(request) return render_to_response('signup.html', RequestContext(request, { 'username':username, 'poss_shifts':poss_shifts, 'sundayShiftsAvail':sundayShiftsAvail, 'sundayShiftsTaken':sundayShiftsTaken, 'mondayShiftsTaken':mondayShiftsTaken, 'mondayShiftsAvail':mondayShiftsAvail, 'tuesdayShiftsTaken':tuesdayShiftsTaken, 'tuesdayShiftsAvail':tuesdayShiftsAvail, 'wednesdayShiftsTaken':wednesdayShiftsTaken, 'wednesdayShiftsAvail':wednesdayShiftsAvail, 'thursdayShiftsTaken':thursdayShiftsTaken, 'thursdayShiftsAvail':thursdayShiftsAvail, 'fridayShiftsTaken':fridayShiftsTaken, 'fridayShiftsAvail':fridayShiftsAvail, 'saturdayShiftsTaken':saturdayShiftsTaken, 'saturdayShiftsAvail':saturdayShiftsAvail },)) Here is my model: class mealShifts(models.Model): Sunday = "Sunday" Monday = "Monday" Tuesday = "Tuesday" Wednesday = "Wednesday" Thursday = "Thursday" Friday = "Friday" Days = ( (0, "Sunday"), (1, "Monday"), (2, "Tuesday"), (3, "Wednesday"), (4, "Thursday"), (5, "Friday"), (6, "Saturday"), ) Breakfast = "Breakfast" Dinner = "Dinner" Meals = ( (Breakfast, "Breakfast"), (Dinner, "Dinner"), ) Chef = "Chef" Sous_Chef = "Sous-Chef" KP ="KP" Shifts = ( (Chef, "Chef"), (Sous_Chef, "Sous_Chef"), (KP, "KP"), ) assigned = models.BooleanField(default=False) day = models.IntegerField(choices=Days) meal = models.CharField(max_length = 10, choices=Meals) shift = models.CharField(max_length = 10, choices=Shifts, default=KP) camper = models.ForeignKey(User, null=True, blank=True, default=None) class Meta: unique_together = ("day", "meal", "shift") def __str__(self): return '%s %s %s %s %s %s'%(self.id, self.assigned, self.day, self.meal, self.shift, self.camper) And my template: Day Meal Shift Camper Camper {% for shift in sundayShiftsTaken %} Sunday {{shift.meal}} {{shift.shift}} {{shift.camper}} {% endfor %} {% for shifts in mondayShiftsTaken %} Monday {{shifts.meal}} {{shifts.shift}} {{shifts.camper}} {% endfor %} {% for shifts in tuesdayShiftsTaken %} Tuesday {{shifts.meal}} {{shifts.shift}}
Re: matching query does not exist.
Hi Becka, So it seems like, from reading your code, that I can diagnose your issue. When a user clicks "sign up", in say the Thursday Shifts Available table, the browser sends a POST from this form: {% csrf_token %} {{shift.meal}} {{shift.meal}} {{shift.camper}} This POST includes the keys 'csrf_token', 'camper, 'meal', & 'meal' but not 'shift_id'. Therefore, in if request.method == 'POST': shift_id = request.POST.get('shift_id') signup_for_shift(shift_id, request.user) return redirect('signup') request.POST.get('shift_id') returns None. When that gets passed to mealShifts.objects.get(pk=shift_id), it raises the error. You can confirm that by inserting the line import pdb;pdb.set_trace() before that line and run `print(request.POST.get('shift_id'))` when the django toy server hits that breakpoint. -- Andrew Farrell On Thu, Nov 19, 2015 at 9:31 PM, Becka R. wrote: > Hi -- > > I'm working on a personal project, and have been stuck on this problem for > a bit of time. There don't seem to be examples out there for editing > tables with data. Is this right? Am I looking in the right places? I'm > still pretty new at Django, and learning largely on my own. > > I have a template wherein people can sign up for meal shifts at Burning > Man. It doesn't use a form, because the table is populated with data, but > until someone signs up for a shift, "camper" is set to None. The page is > rendering and displaying data correctly, but when I go to add myself as a > logged in user, I get the following error: > > DoesNotExist at /signup/ > > mealShifts matching query does not exist. > > > Code is below. Thanks for any help. > > > Signup is the name of the template and the view function. mealShifts > (which I know needs to be capitalized) is the name of the model. > > Here's the view: > > def signup_for_shift(shift_id, camper): > shift = mealShifts.objects.get(pk=shift_id) > if shift.camper is not None: > raise ValueError > > shift.camper = camper > shift.save() > > > > @login_required(login_url='login.html') > def signup(request): > model = mealShifts > user = request.user > poss_shifts = mealShifts.objects.all().order_by('day') > day_choices = range(0, 6) > meal_choices = ['Breakfast', 'Dinner'] > shift_choices = ['Chef', 'Sous_Chef', 'KP'] > username = None > > > sundayShiftsAvail = mealShifts.objects.filter(day=0, assigned=False) > sundayShiftsTaken = mealShifts.objects.filter(day=0, assigned=True) > > mondayShiftsAvail = mealShifts.objects.filter(day=1, assigned=False) > mondayShiftsTaken = mealShifts.objects.filter(day=1, assigned=True) > > tuesdayShiftsAvail = mealShifts.objects.filter(day=2, assigned=True) > tuesdayShiftsTaken = mealShifts.objects.filter(day=2, assigned=True) > > wednesdayShiftsAvail = mealShifts.objects.filter(day=3, assigned=False) > wednesdayShiftsTaken = mealShifts.objects.filter(day=3, assigned=True) > > thursdayShiftsAvail = mealShifts.objects.filter(day=4, assigned=False) > thursdayShiftsTaken = mealShifts.objects.filter(day=4, assigned=True) > > fridayShiftsAvail = mealShifts.objects.filter(day=5, assigned=False) > fridayShiftsTaken = mealShifts.objects.filter(day=5, assigned=True) > > saturdayShiftsAvail = mealShifts.objects.filter(day=6, assigned=False) > saturdayShiftsTaken = mealShifts.objects.filter(day=6, assigned=True) > > saturdayShiftsAvail = mealShifts.objects.filter(day=7, assigned=False) > saturdayShiftsTaken = mealShifts.objects.filter(day=7, assigned=True) > > if request.method == 'POST': > shift_id = request.POST.get('shift_id') > signup_for_shift(shift_id, request.user) > return redirect('signup') > > context = RequestContext(request) > return render_to_response('signup.html', > RequestContext(request, { > 'username':username, 'poss_shifts':poss_shifts, > 'sundayShiftsAvail':sundayShiftsAvail, > 'sundayShiftsTaken':sundayShiftsTaken, > 'mondayShiftsTaken':mondayShiftsTaken, > 'mondayShiftsAvail':mondayShiftsAvail, > 'tuesdayShiftsTaken':tuesdayShiftsTaken, > 'tuesdayShiftsAvail':tuesdayShiftsAvail, > 'wednesdayShiftsTaken':wednesdayShiftsTaken, > 'wednesdayShiftsAvail':wednesdayShiftsAvail, > 'thursdayShiftsTaken':thursdayShiftsTaken, > 'thursdayShiftsAvail':thursdayShiftsAvail, > 'fridayShiftsTaken':fridayShiftsTaken, > 'fridayShiftsAvail':fridayShiftsAvail, > 'saturdayShiftsTaken':saturdayShiftsTaken, > 'saturdayShiftsAvail':saturdayShiftsAvail > },)) > > > > Here is my model: > > > class mealShifts(models.Model): > Sunday = "Sunday" > Monday = "Monday" > Tuesday = "Tuesday" > Wednesday = "Wednesday" > Thursday = "Thursday" > Friday = "Friday" > Days = ( > (0, "Sunday"), > (1, "Monday"), > (2, "Tuesday"), > (3, "Wedn
Questions on project vs app, and how they relate
So... if I'm understanding things correctly, a Django 'project' can have multiple 'apps' in it, and these 'apps' can be reused to some extent between projects. As in: copy the folder of code for an 'app' from one project to another (editing things as needed for the new project)? An app can either have its own style/templates, or it can use the 'project' templates / CSS, correct? Maybe I haven't came across it yet... but how do you tie the different apps of a project together? How does the As an example... lets say I want to set up a web site for running sports tournaments. One 'app' might be the competitor information, sort of like a contact / address book. Another might be for setting up specific events, and another would be for entering the scores and doing various things with them (validating, enforcing bounds / constraints, calculating aggregates, breaking ties, publishing results). The specific functions are distinct enough it seems like they would each be separate apps, but they all need to access the same database, possibly the same tables to get the information that one app or another needs. This seems to be where my (admittedly very basic) understanding of how Django works pretty much falls apart... Thanks, Monte -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/n2m6qk%249u3%241%40ger.gmane.org. For more options, visit https://groups.google.com/d/optout.
Re: Questions on project vs app, and how they relate
Dear Monte, Don't consider me an expert but here is how you may want to handle this scenario. 1. django-admin.py startproject tournaments Now, cd into the 'tournaments' directory (wherein you have a manage.py file). From that directory you can create as many different apps (actually "components") of your tournaments project. So, you do: python manage.py startapp competitors python manage.py startapp eventshandler python manage.py startapp scoreboard Each of these apps will handle each set of data and activities you outlined above. Each app may also have its own set of templates (e.g. competitors/templates/), static assets for JS, CSS, etc. (e.g. competitors/static) and, of course the necessary models, views, urls, admin, etc. modules as needed. This might be the best way to approach it. However, you may also choose to share put all your templates or static assets in one app and have all other apps fetch them from there. For example, you may put all your CSS and JS files in competitors/static/ . The separation of code and content into various apps is simply to help you better organize your project in a way that is simple and makes sense to you. But if your preference is different for a particular project or something else makes sense to you, you may fee free to do so as long as you know what you are doing and done break your code along the way. If you haven't already done so, I would advise that you go over the official Django tutorial at https://docs.djangoproject.com/en/1.9/intro/ . While working through it just remember that you can do with/to each of your apps what you did to the "polls" app in that tutorial. I hope this helps in some way. All the best. :) Sincerely, Muhammad On Thu, Nov 19, 2015 at 11:16 PM, memilanuk wrote: > So... if I'm understanding things correctly, a Django 'project' can have > multiple 'apps' in it, and these 'apps' can be reused to some extent > between projects. As in: copy the folder of code for an 'app' from one > project to another (editing things as needed for the new project)? > > An app can either have its own style/templates, or it can use the > 'project' templates / CSS, correct? > > Maybe I haven't came across it yet... but how do you tie the different > apps of a project together? How does the > > As an example... lets say I want to set up a web site for running sports > tournaments. One 'app' might be the competitor information, sort of like a > contact / address book. Another might be for setting up specific events, > and another would be for entering the scores and doing various things with > them (validating, enforcing bounds / constraints, calculating aggregates, > breaking ties, publishing results). The specific functions are distinct > enough it seems like they would each be separate apps, but they all need to > access the same database, possibly the same tables to get the information > that one app or another needs. This seems to be where my (admittedly very > basic) understanding of how Django works pretty much falls apart... > > Thanks, > > Monte > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/n2m6qk%249u3%241%40ger.gmane.org > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJOFuZz5vwkF9eJqX%2BEMMaYktMn1Jmk8HWk6EMzoTVKVrTBRbg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Questions on project vs app, and how they relate
Hello Muhammad, Yes that does help, thank you very much! I'm still a little unclear on sharing data between the apps. If it was a standalone SQL database (not using Django or an ORM), I'd think it would be appropriate to set up one database, with various tables, shared between all three aspects of the project. Example: Besides their contact info, competitors would have other info specific to each person - their classification(s) in various equipment categories, etc. The EventHandler would need the competitor information for combining/splitting relays, etc. The Scoreboard would need information from both, to tie the scores to a specific competitor at a given event. The way it looks to me, all the model info (models.py) is particular to each specific app. How would you get them to all share *one* database for the project, using the Django ORM? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/n2mb5e%244u2%241%40ger.gmane.org. For more options, visit https://groups.google.com/d/optout.
Re: Questions on project vs app, and how they relate
Hi Monte, You can use a model from one app in another app. So, let's say that in competitors/models.py (where you define the models for your "competitors" app), you have a model class named Participant. This model represents, well, a participant in the tournament. It is likely, as you stated, that you would need the Participant model (from the "competitors" app) in your "scoreboard" app when calculating scores for various participants. In this case, all you have to do is import the Participant model from competitors/models.py into your scoreboard/models.py file. This way, you can create relationships between the different models of the various apps of your tournaments project. So, assuming that you have a Score model in your scoreboard/models.py (which you use to tie scores to a particular Participant), you can approach it like this: > Make sure you have defined the Participant model in your competitors/models.py file. For example, in your competitors/models.py, you may have: class Participant(models.Model): name = models.CharField(max_length=90) team_name = models.CharField(max_length=75) signup_date = models.DateTimeField(auto_now_add=True) # Add other fields here > In your scoreboard/models.py file, you may have something like: from django.db import models from competitors.models import Participant #Add other imports from other files and apps' models that you need here class Score(models.Model): participant = models.ForeignKey(Participant) field_x = models.CharField(max_length=123) another_field = models.PositiveIntegerField() This way, when you query for scores through the Django ORM, the ORM also ties in the Participant from this queried score. You can then ask to get more info about the Participant from the participants table in the database. So, when you execute a query through the ORM, for example: participant_a_scores = Score.objects.filter(participant__name="Monte") To get the name of this team name of the participant whose scores you just queried for, you do: monte_team = participant_a_scores.participant.team_name This query hits the "scores" table as well as the "participants" table to retrieve the score and the related Participant's info. You may want to take a look at how Django handles relationships between models. Please, note that there is no difference in whether the related models are in the same app or from different apps. For details, please, take a look at documentation on: https://docs.djangoproject.com/en/1.8/topics/db/examples/ If I made it more confusing, please, let me know. The best way to clear the fog on this is to go through the official tutorial, the model relationship docs (in the above link) and to implement these in your own project. All the best. :) Sincerely, Muhammad On Fri, Nov 20, 2015 at 12:30 AM, memilanuk wrote: > Hello Muhammad, > > Yes that does help, thank you very much! > > I'm still a little unclear on sharing data between the apps. If it was a > standalone SQL database (not using Django or an ORM), I'd think it would be > appropriate to set up one database, with various tables, shared between all > three aspects of the project. > > Example: Besides their contact info, competitors would have other info > specific to each person - their classification(s) in various equipment > categories, etc. The EventHandler would need the competitor information > for combining/splitting relays, etc. The Scoreboard would need information > from both, to tie the scores to a specific competitor at a given event. > > The way it looks to me, all the model info (models.py) is particular to > each specific app. How would you get them to all share *one* database for > the project, using the Django ORM? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/n2mb5e%244u2%241%40ger.gmane.org > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJOFuZyPxw6DT5kawn0XKwjNE2d_S1sWQt%3DFv5FURNxauvUg_A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.