2009/12/13, django-users@googlegroups.com <django-users@googlegroups.com>:
> =============================================================================
> Today's Topic Summary
> =============================================================================
>
> Group: django-users@googlegroups.com
> Url: http://groups.google.com/group/django-users/topics
>
>   - Cron vs event triggered action [1 Update]
>     http://groups.google.com/group/django-users/t/423e2a319bf12a28
>   - The best way to populate sqlite3 database [3 Updates]
>     http://groups.google.com/group/django-users/t/8259156ec3bea8b6
>   - Inheriting from User, UserAdmin, and the Admin site [2 Updates]
>     http://groups.google.com/group/django-users/t/4a37105e360e813f
>   - Scope of variables in template blocks [1 Update]
>     http://groups.google.com/group/django-users/t/f4c00d85708fb9c
>   - Count by date [1 Update]
>     http://groups.google.com/group/django-users/t/a158b87cb99d23f6
>   - variable {% url %} parameter [1 Update]
>     http://groups.google.com/group/django-users/t/be3bfe06e8e240ef
>   - CSV to JSON snippet [1 Update]
>     http://groups.google.com/group/django-users/t/a00b529ba2147d91
>   - django.contrib.comments Templates [1 Update]
>     http://groups.google.com/group/django-users/t/7e218282603b984f
>   - Looking for guidance on django-registration [4 Updates]
>     http://groups.google.com/group/django-users/t/9f41d071505085e4
>   - Can I change the models.py of an existing django app? [2 Updates]
>     http://groups.google.com/group/django-users/t/c96f717b1fc1dbf4
>   - basic http authentication [1 Update]
>     http://groups.google.com/group/django-users/t/cc308a72778f30a7
>   - editable AutoField [1 Update]
>     http://groups.google.com/group/django-users/t/950e0ad258812f51
>   - access legacy data without model.py [1 Update]
>     http://groups.google.com/group/django-users/t/a61b59bec4d2af16
>   - Error creating and saving a Django-object from the other script [3
> Updates]
>     http://groups.google.com/group/django-users/t/da30412e6a15ab65
>   - HiddenInput for ModelChoiceField [1 Update]
>     http://groups.google.com/group/django-users/t/c35f4d30014cf6cd
>   - reverse in urlpatterns [1 Update]
>     http://groups.google.com/group/django-users/t/ca61890e2f755ba9
>
>
> =============================================================================
> Topic: Cron vs event triggered action
> Url: http://groups.google.com/group/django-users/t/423e2a319bf12a28
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Tim Daniel <redarrow...@hotmail.com>
> Date: Dec 12 02:58PM -0800
> Url: http://groups.google.com/group/django-users/msg/b5624402d0345a77
>
> Just want to figure out if there is a smarter solution for handling
> the following problem:
>
> 1. An action is performed by a user (Normal django behaviour handling
> a request and giving a response).
> 2. Two hours later I want an automatic action to be done.
>
> Solution A: Have a datetime field with an expiry date and say every 10
> minutes a cron job checks the DB table for expired entries and
> performs the programed action.
>
> Solution B: Have an event triggered cronjob that only executes once
> and is created from Django(Python), after the 2 hours passed it
> performs the programmed action only on the required entry.
>
> So how can I implement solution B? Is there a posibility to create a
> cron on a user action that executes only one time?
>
> NOTE: I don't want to rely on a thread that should stay alive for two
> hours ore more inside the server memory.
>
>
>
> =============================================================================
> Topic: The best way to populate sqlite3 database
> Url: http://groups.google.com/group/django-users/t/8259156ec3bea8b6
> =============================================================================
>
> ---------- 1 of 3 ----------
> From: Zeynel <azeyn...@gmail.com>
> Date: Dec 12 09:01AM -0800
> Url: http://groups.google.com/group/django-users/msg/4bc1b53f068e0790
>
> Hi,
>
> I first put the data in csv format than convert it to json and then
> create a fixture... which seems a long process. This
> http://stackoverflow.com/questions/1884694/how-to-populate-sqlite3-in-django/1885417#1885417
> answer suggests to "Just load the database directly," but without
> giving much practical info. Can anyone here help?
>
>
> ---------- 2 of 3 ----------
> From: Shawn Milochik <sh...@milochik.com>
> Date: Dec 12 03:04PM -0500
> Url: http://groups.google.com/group/django-users/msg/dace54fac43d6cf5
>
> The fastest way for large files is to use sqlite3's .import command to
> directly import a file. However, this will bypass any validation done by
> your models. You could end up with "bad" data, in that it doesn't conform to
> the rules of your models.
>
> Or, you can just write an external script to read the file and create model
> instances. Here's a brief example:
>
> http://pastebin.com/f651cf8de
>
> Shawn
>
>
> ---------- 3 of 3 ----------
> From: Zeynel <azeyn...@gmail.com>
> Date: Dec 12 01:33PM -0800
> Url: http://groups.google.com/group/django-users/msg/180b810ab845c6f6
>
>
>>
>> http://pastebin.com/f651cf8de
>
> Hi,
>
> Thanks for the script, I want to use it but I have some questions.
> These are from the previous thread:
> http://groups.google.com/group/django-users/msg/091f964c6c8e40c7
>
> but I have others as well.
>
> Thanks again.
>
>
>
> =============================================================================
> Topic: Inheriting from User, UserAdmin, and the Admin site
> Url: http://groups.google.com/group/django-users/t/4a37105e360e813f
> =============================================================================
>
> ---------- 1 of 2 ----------
> From: fgasperino <franco.gasper...@gmail.com>
> Date: Dec 12 09:19AM -0800
> Url: http://groups.google.com/group/django-users/msg/10c7c0a401a4520
>
> Looking into this a little deeper, it appears that from
> django.contrib.auth.admin.UserAdmin uses
> django.contrib.auth.models.User in the meta class. I've attempted to
> point this to my app's proxy model by inheriting here as well:
>
> -- forms.py --
>
> from django.contrib.auth.forms import UserCreationForm as
> DjangoUserCreationForm
> from myapp.proxies import User
>
> class UserCreationForm (DjangoUserCreationForm):
>     class Meta:
>         model = User
>
> While this still hasn't solved the problem, I'm curious if the built-
> in User model is more embedded than the layers I'm altering...
>
> Franco
>
>
> ---------- 2 of 2 ----------
> From: fgasperino <franco.gasper...@gmail.com>
> Date: Dec 12 12:28PM -0800
> Url: http://groups.google.com/group/django-users/msg/b40046f482bb7248
>
> Solved by the Manager adding django.contrib.auth.models.UserManager to
> the inherited User model.
>
> from django.db import models
> from django.contrib.auth.models import User as DjangoUser, UserManager
> as DjangoUserManager
>
> class User (DjangoUser):
>     objects = DjangoUserManager()
>
> The admin site now works as expected.
>
>
>
> =============================================================================
> Topic: Scope of variables in template blocks
> Url: http://groups.google.com/group/django-users/t/f4c00d85708fb9c
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Alex Rades <alera...@gmail.com>
> Date: Dec 12 09:25PM +0100
> Url: http://groups.google.com/group/django-users/msg/4ea1b395ec887c18
>
> Hi,
>
> I have a master template which defines two blocks:
>
> {% block account %}{% endblock %}
> {% block content %}{% endblock %}
>
> I have a templatetag which tells me the time of the last image upload
> (it's a photo sharing site).
> This templatetag hits the database, and I don't want to call it
> multiple times in the same page.
>
> The problem is that if I do:
>
> {% get_last_upload as last_upload %}
>
> I cannot access the variable 'last_upload' from the two blocks. I have
> to call the the templatetag twice, one in each block.
>
> Is there a way to share variables between blocks?
>
> Thank you
>
>
>
> =============================================================================
> Topic: Count by date
> Url: http://groups.google.com/group/django-users/t/a158b87cb99d23f6
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: philadams <computers...@gmail.com>
> Date: Dec 12 10:09AM -0800
> Url: http://groups.google.com/group/django-users/msg/fec3458c24987e78
>
> i believe the way filters work (what martin referenced) is that you
> have to explicitly say which weekday you care about.
>
> what the op is looking for is a way to group by week day. ideally to
> write something like MyTable.objects.values(created__week_day).annotate
> (Count('id'))
>
> however, this doesn't work as created__week_day is not a valid
> argument to values. any ideas how to actually do this?
>
> On Nov 23, 8:52 am, Martin Ostrovsky <martin.ostrov...@gmail.com>
> wrote:
>
>
>
> =============================================================================
> Topic: variable {% url %} parameter
> Url: http://groups.google.com/group/django-users/t/be3bfe06e8e240ef
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Baurzhan Ismagulov <i...@radix50.net>
> Date: Dec 12 06:15PM +0100
> Url: http://groups.google.com/group/django-users/msg/d9b32ca51ba277d6
>
> Hello,
>
> Another named URL question. I have the following pattern:
>
>     (r'^app/(?P<object_id>\d+)/$', create_update.update_object,
>      {'model': App}, 'app-edit'),
>
> Now, using {% url 'app-edit' object.pk %} in a form throws
> TemplateSyntaxError, mentioning "NoReverseMatch: Reverse for
> 'rc.'app-edit'' with arguments '(1,)' and keyword arguments '{}' not
> found." in the value. Is passing a variable from the view the best way
> to do that? Is there any other method (not necessarily named URLs) of
> getting a URL without hardcoding it?
>
> With kind regards,
> --
> Baurzhan Ismagulov
> http://www.kz-easy.com/
>
>
>
> =============================================================================
> Topic: CSV to JSON snippet
> Url: http://groups.google.com/group/django-users/t/a00b529ba2147d91
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Zeynel <azeyn...@gmail.com>
> Date: Dec 12 10:04AM -0800
> Url: http://groups.google.com/group/django-users/msg/197467dec3b3cb91
>
> This is fixed by modifying lines 31-32:
> http://stackoverflow.com/questions/1894099/csv2json-py-error
>
>
>
>
> =============================================================================
> Topic: django.contrib.comments Templates
> Url: http://groups.google.com/group/django-users/t/7e218282603b984f
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Carlos Ricardo Santos <carlosricardosan...@gmail.com>
> Date: Dec 12 05:28PM
> Url: http://groups.google.com/group/django-users/msg/b7b620b1e63f6299
>
> Hi:
>
> I fully implemented the django.contrib.comments on my django app and
> comments are saved, showed, etc.
> Just one thing that annoys me... The write comment page and the confirmation
> page are not extending my base.html template.
> I found this post
> http://www.djangrrl.com/view/taking-ugly-out-django-comments/ but when I try
> to comment, no "preview comment" page appears.
>
> Anyone has ever tried to change comments templates?
>
>
> Carlos Ricardo Santos
>
>
>
> =============================================================================
> Topic: Looking for guidance on django-registration
> Url: http://groups.google.com/group/django-users/t/9f41d071505085e4
> =============================================================================
>
> ---------- 1 of 4 ----------
> From: vishy <vishalsod...@gmail.com>
> Date: Dec 12 08:41AM -0800
> Url: http://groups.google.com/group/django-users/msg/5e29c637364bc845
>
> I have downloaded the latest module.Now,I need to set it up.I want
> guidance,especially how to setup the templates, like what goes into
> registration_form.html.If there is some source code that will be
> great.
> thanks
>
>
> ---------- 2 of 4 ----------
> From: vishy <vishalsod...@gmail.com>
> Date: Dec 12 08:51AM -0800
> Url: http://groups.google.com/group/django-users/msg/4cacbc78bb0b794
>
> got the registration working.Now, how to setup activation email?
>
>
>
> ---------- 3 of 4 ----------
> From: Zeynel <azeyn...@gmail.com>
> Date: Dec 12 08:57AM -0800
> Url: http://groups.google.com/group/django-users/msg/22d89b0e816c1bcc
>
> I think this will be in the documentation of your hosting co, for
> instance,
> http://docs.webfaction.com/software/django.html#configuring-django-to-send-email-messages
>
>
>
> ---------- 4 of 4 ----------
> From: "Boris Schäling" <bo...@highscore.de>
> Date: Dec 12 06:15PM +0100
> Url: http://groups.google.com/group/django-users/msg/7fc44f32da50ff9c
>
>> registration_form.html.If there is some source code that will be
>> great.
>
> As the Django website uses django-registration, too, there are real-world
> templates at:
> http://code.djangoproject.com/browser/djangoproject.com/django_website/templ
> ates/registration
>
> HTH,
> Boris
>
>
>
> =============================================================================
> Topic: Can I change the models.py of an existing django app?
> Url: http://groups.google.com/group/django-users/t/c96f717b1fc1dbf4
> =============================================================================
>
> ---------- 1 of 2 ----------
> From: Zeynel <azeyn...@gmail.com>
> Date: Dec 12 08:36AM -0800
> Url: http://groups.google.com/group/django-users/msg/f5d9b7717810233e
>
>> the old database and re-create it, then let syncdb create all the tables
>> again.
>
> Yes, I deleted the content of the sqlite3 database file and then ran
> syncdb and it created the new database. Thanks.
>
>
> ---------- 2 of 2 ----------
> From: Zeynel <azeyn...@gmail.com>
> Date: Dec 12 08:40AM -0800
> Url: http://groups.google.com/group/django-users/msg/1cb563577ae88c87
>
> Shawn, Since I did not want to save the data I deleted the db file and
> ran synchdb and that created a new database. But eventually I will use
> south because I will keep adding new columns to this database. Thanks.
>
>
>
>
> =============================================================================
> Topic: basic http authentication
> Url: http://groups.google.com/group/django-users/t/cc308a72778f30a7
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Alessandro Ronchi <alessandro.ron...@soasi.com>
> Date: Dec 12 05:17PM +0100
> Url: http://groups.google.com/group/django-users/msg/e530f214eb140b73
>
> I need to make a view with a basic html authentication (because I need to
> use that url in a program that parse the result).
>
> I need to authenticate against the check of a permission.
>
> What's the best way to do that?
>
> --
> Alessandro Ronchi
>
> http://www.soasi.com
> SOASI - Sviluppo Software e Sistemi Open Source
>
> http://hobbygiochi.com
> Hobby & Giochi, l'e-commerce del divertimento
>
>
>
> =============================================================================
> Topic: editable AutoField
> Url: http://groups.google.com/group/django-users/t/950e0ad258812f51
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Baurzhan Ismagulov <i...@radix50.net>
> Date: Dec 12 05:09PM +0100
> Url: http://groups.google.com/group/django-users/msg/af631caddbd4d870
>
> Hello,
>
> I'd like to have a numeric field that is shown in the admin and in the
> model form, the value entered by the user is saved, if no value is
> entered, the next sequence number is assigned by the database. Is there
> an easy way to do that? Or should I override the model's save method and
> use a custom form?
>
> With kind regards,
> --
> Baurzhan Ismagulov
> http://www.kz-easy.com/
>
>
>
> =============================================================================
> Topic: access legacy data without model.py
> Url: http://groups.google.com/group/django-users/t/a61b59bec4d2af16
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: dundeemt <dunde...@gmail.com>
> Date: Dec 12 07:24AM -0800
> Url: http://groups.google.com/group/django-users/msg/e64f8b1fdb0af7b9
>
> I need to access data in other databases.  I don't want them listed in
> model.py as I won't be using django's orm for them. Given this, where
> is the preferred place to put the db connection for this data?  The
> only references I could find show creating a db connection in the
> view, http://www.djangobook.com/en/beta/chapter05/  -- while valid for
> my purposes, is there a better place to cache the connection?
>
> Also, I will be accessing 7+ other databases of varying types, some
> have hundreds of tables and I have no desire to create a model when
> for them when I only need to get to a few values.  I will not be
> updating data in these other databases, only doing lookups.  So I am
> not interested in making a proper django data connection to them.
>
>
>
> Best,
>
> Jeff
>
>
>
> =============================================================================
> Topic: Error creating and saving a Django-object from the other script
> Url: http://groups.google.com/group/django-users/t/da30412e6a15ab65
> =============================================================================
>
> ---------- 1 of 3 ----------
> From: tezro <tezro...@gmail.com>
> Date: Dec 12 05:08AM -0800
> Url: http://groups.google.com/group/django-users/msg/2f4b6536cffbb21b
>
> Nope. Did it again on a clean project with the same models migrated
> then by South.
>
> Same error. Any other clues?
>
> Thanks for replies.
>
>
>
> ---------- 2 of 3 ----------
> From: Shawn Milochik <sh...@milochik.com>
> Date: Dec 12 09:56AM -0500
> Url: http://groups.google.com/group/django-users/msg/9a22d94dc92e7375
>
> On Dec 12, 2009, at 8:08 AM, tezro wrote:
>
>>
>> Thanks for replies.
>
> When you say "same error," do you mean this one: "Duplicate key name
> 'news_element_slug'"?
>
> If so, then it appears that, despite the clean project, it's not a clean
> database. Try using sqlite3 temporarily, or change the model name from News
> to NewsTest or something.
>
> Shawn
>
>
> ---------- 3 of 3 ----------
> From: tezro <tezro...@gmail.com>
> Date: Dec 12 07:14AM -0800
> Url: http://groups.google.com/group/django-users/msg/868585ed719804b4
>
> Nope. Sorry for misdescription... Same error is "TypeError: 'slug' is
> an invalid keyword argument" when using:
> ---
> new_element = Element(title="title", date=datetime.now(),
> source=source_object, slug="slug")
> new_element.save()
> ---
>
> And the same "_mysql_exceptions.Warning: Field 'slug' doesn't have a
> default value" when using:
> ---
> new_element = Element(title="title", date=datetime.now(),
> source=source_object)
> new_element.slug = "slug"
> new_element.save()
> ---
>
> The same errors from an outer script. From the shell or admin site -
> works still fine...
>
>
>
>
>
> =============================================================================
> Topic: HiddenInput for ModelChoiceField
> Url: http://groups.google.com/group/django-users/t/c35f4d30014cf6cd
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Aaron <aa...@genieknows.com>
> Date: Dec 12 07:03AM -0800
> Url: http://groups.google.com/group/django-users/msg/747758bf9bbfe4ab
>
> Say I have this model:
>
> model Foo(models.Model):
>     bar = models.ForeignKey(Baz)
>
> I have a ModelForm for Foo (FooModelForm). However, instead of having
> a ModelChoiceField for bar, I want a single bar object in a hidden
> field that's specified when creating the FooModelForm.
>
> my_bar = Baz.objects.get(filter)
> my_foo_form = FooModelForm(bar = my_bar)
>
> I'm not sure how to do this though. This was my first crack at it:
>
> class FooModelForm(forms.ModelForm):
>     bar = forms.ModelChoiceField(queryset = Baz.objects.all(), widget
> = forms.HiddenInput())
>
>     class Meta:
>         model = Foo
>
>     def __init__(self, *args, **kwargs):
>         new_bar = kwargs['bar']
>         del kwargs['bar'] # I get "__init__() got an unexpected
> keyword argument 'bar'" if I don't do this
>         super(FooModelForm, self).__init__(*args, **kwargs)
>         self.fields['bar'].default = new_bar
>
> When I render a form with a template, the hidden input tag has nothing
> set for it's value attribute in the HTML. I also tried setting
> 'self.fields['bar'].default' to 'new_bar.pk', but there still wasn't a
> value attribute.
>
>
>
> =============================================================================
> Topic: reverse in urlpatterns
> Url: http://groups.google.com/group/django-users/t/ca61890e2f755ba9
> =============================================================================
>
> ---------- 1 of 1 ----------
> From: Baurzhan Ismagulov <i...@radix50.net>
> Date: Dec 12 03:44PM +0100
> Url: http://groups.google.com/group/django-users/msg/44ff5c01e556ea72
>
> Hello Javier,
>
> On Thu, Dec 10, 2009 at 09:04:10AM -0500, Javier Guerra wrote:
>>    ...
>> )
>
> Thanks for the idea. I've tried it and got the following error:
>
> File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in
> get_response
>   77.                     request.path_info)
> File "/var/lib/python-support/python2.5/django/core/urlresolvers.py" in
> resolve
>   179.             for pattern in self.urlconf_module.urlpatterns:
> File "/var/lib/python-support/python2.5/django/core/urlresolvers.py" in
> _get_urlconf_module
>   198.             self._urlconf_module = __import__(self.urlconf_name, {},
> {}, [''])
> File "/home/ibr/w/work/mcs/j/rc/src/rc/urls.py" in <module>
>   23.       'post_save_redirect': reverse('app-list')
>
> Exception Type: TypeError at /admin/his/person/add/
>
> With kind regards,
> --
> Baurzhan Ismagulov
> http://www.kz-easy.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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>

-- 
从我的移动设备发送

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to