Re: [Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-12 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
-+-
 Reporter:  1st  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by charettes):

 * needs_better_patch:  1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24467#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.f129e077c146b86165b08a6139a7ee3b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-11 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
-+-
 Reporter:  1st  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham <timograham@…>):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"28e8c54d7d2800a8ac98cf646a9e074055bc1b1b" 28e8c54]:
 {{{
 #!CommitTicketReference repository=""
 revision="28e8c54d7d2800a8ac98cf646a9e074055bc1b1b"
 Fixed #24467 -- Removed conditional inclusion of actions.js &
 prepopulate.js.

 The JavaScript may be required when using ModelAdmin.get_actions() or
 get_prepopulated_fields(). Always including them is the easiest solution.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24467#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.403535a0d0ac1748f68f7de795bbd3c4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-11 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
-+-
 Reporter:  1st  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by charettes):

 * stage:  Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24467#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.e649906615070e55aa3c0e4a3614897e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-11 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
---+
 Reporter:  1st|Owner:  nobody
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  1
Easy pickings:  0  |UI/UX:  0
---+

Comment (by 1st):

 Pull request was created: https://github.com/django/django/pull/4297

--
Ticket URL: <https://code.djangoproject.com/ticket/24467#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.f7ce2fc814b7a66fd681b40f882aed3e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-11 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
---+
 Reporter:  1st|Owner:  nobody
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  1
Easy pickings:  0  |UI/UX:  0
---+

Comment (by 1st):

 Okey, will create Pull Request today. Thanks for a link!

--
Ticket URL: <https://code.djangoproject.com/ticket/24467#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.37f5a20d25b82e466e2ffabae5cf9d44%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-10 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
---+
 Reporter:  1st|Owner:  nobody
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  master
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  1
Easy pickings:  0  |UI/UX:  0
---+
Changes (by charettes):

 * needs_better_patch:  0 => 1
 * component:  Uncategorized => contrib.admin
 * version:  1.7 => master
 * keywords:  1.7.5 =>
 * has_patch:  0 => 1
 * type:  Uncategorized => Bug
 * stage:  Unreviewed => Accepted


Comment:

 Hi 1st,

 This looks like a legitimate bug and unconditionally including
 `propulate.js` seems like the correct solution to me.

 Please [https://docs.djangoproject.com/en/dev/internals/contributing
 /writing-code/working-with-git/#publishing-work create a pull request]
 against master with your proposed bug fix.

--
Ticket URL: <https://code.djangoproject.com/ticket/24467#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.06dc4297e5d3fca7836effd1a22081c6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-10 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
---+--
 Reporter:  1st|Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Uncategorized  |  Version:  1.7
 Severity:  Normal |   Resolution:
 Keywords:  1.7.5  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by 1st):

 I found why it happens. I need help from someone who can find workaround
 for this situation, because to call method "get_prepopulated_fields" we
 need to pass at least "request" parameter that isn't accessible in "media"
 dynamic property.

 File: "django/contrib/admin/options.py".

 {{{
 -if self.prepopulated_fields:
 +if self.get_prepopulated_fields(None):
 js.extend(['urlify.js', 'prepopulate%s.js' % extra])
 }}}

 What I can propose - it to refactor "media" property to accept "request"
 parameter.

 OR more easy solution is to delete condition and always include
 prepopulate.js:
 {{{
 @property
 def media(self):
 extra = '' if settings.DEBUG else '.min'
 js = [
 'core.js',
 'admin/RelatedObjectLookups.js',
 'jquery%s.js' % extra,
 'jquery.init.js',
 # CHANGED LINES
 +   'urlify.js',
 +   'prepopulate%s.js' % extra,
 ]
 if self.actions is not None:
 js.append('actions%s.js' % extra)
 return forms.Media(js=[static('admin/js/%s' % url) for url in js])
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24467#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.8d1944eaf824423c57775907afe55b08%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-10 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
---+--
 Reporter:  1st|Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Uncategorized  |  Version:  1.7
 Severity:  Normal |   Resolution:
 Keywords:  1.7.5  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by 1st):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 '''I found why it happens.''' When field "prepopulated_fields" is provided
 - to HTML page included javascript file "prepopulate.js" and all work as
 expected. But when we use "get_prepopulated_fields" - this JS file isn't
 included and we have the error.

 I will try to find how it work internally. But maybe someone know how to
 fix it just now? :-)

--
Ticket URL: <https://code.djangoproject.com/ticket/24467#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.8ba8e26a980b4a2786752d09acb89de8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24467: jQuery error in Django admin site when use "get_prepopulated_fields"

2015-03-10 Thread Django
#24467: jQuery error in Django admin site when use "get_prepopulated_fields"
---+
 Reporter:  1st|  Owner:  nobody
 Type:  Uncategorized  | Status:  new
Component:  Uncategorized  |Version:  1.7
 Severity:  Normal |   Keywords:  1.7.5
 Triage Stage:  Unreviewed |  Has patch:  0
Easy pickings:  0  |  UI/UX:  0
---+
 I have Django ModelAdmin for Blog model.


 {{{
 class BlogAdmin(BaseModelAdmin):
 fieldsets = [
 (None, {'fields': ['name', 'description', 'slug']}),
 ('Date information', {'fields': ['date_create', 'date_change']}),
 ]
 # NOTE: this work well
 # prepopulated_fields = {"slug": ("name",)}

 def get_readonly_fields(self, requets, obj=None):
 """
 Disable edit slug field for object.
 """
 if obj:
 return self.readonly_fields + ('slug',)
 return self.readonly_fields

 def get_prepopulated_fields(self, requets, obj=None):
 """
 Prepopulate slug field only for new object.

 In out case we always return value that I mentioned above for
 "prepopulated_fields".
 """
 return {"slug": ("name",)}

 admin.site.register(Blog, BlogAdmin)
 }}}

 '''What do I do?''' I try to show prepopulate field ONLY on create new
 object page. When we edit this object - I disable option to edit slug
 field and show it as read-only.

 When I use "prepopulated_fields" all work as expected. When I switch to
 use custom method "get_prepopulated_fields" the jQuery error appear in web
 browser console:

 {{{
 TypeError: undefined is not a function (evaluating
 '$(field.id).data('dependency_list', field['dependency_list'])
.prepopulate(field['dependency_ids'], field.maxLength)')
 }}}

 As I found - the error appear because it's not defined "prepopulate"
 function:

 {{{
 >>> django.jQuery("#id_slug").prepopulate
 undefined
 }}}

 Who knows how to fix this?

--
Ticket URL: <https://code.djangoproject.com/ticket/24467>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/046.fbf7b206629c6f27c9de85a8b5046a90%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.