Re: Quick Filter in the Admin Sidebar

2020-12-02 Thread Collin Anderson
I think this would be really helpful. Looking at the code in the gist, that looks about right. It's not too complicated and the basic toLowerCase()/indexOf() method of search should hopefully be enough (it's what I would do if I were implementing this!). I'd suggest adding some sort of clear or

Re: Adding a security concerned feature

2020-12-02 Thread Collin Anderson
, we > recommend you change that"? > > I think the combination of blocking IPs and having a different admin URL > would raise the bar quite a bit. > > -A > > On Wed, Nov 25, 2020 at 6:51 AM Collin Anderson > wrote: > >> Hi All, >> >> I think a

Re: Adding a security concerned feature

2020-11-25 Thread Collin Anderson
Hi All, I think at minimum we should change the default admin url for new projects, as that's very easy to do, and it does provide a lot of value for new projects. This helps Django to be secure by default. I use the default /admin/ url for my projects and bots are regurarly trying different p

Re: Removing url() ?

2020-05-05 Thread Collin Anderson
) is actually removed. I feel like collections.abc is a much rarer thing, however, pretty much every Django project that started pre 2.0 uses url(). On Tuesday, May 5, 2020 at 4:39:35 PM UTC-4, James Bennett wrote: > > On Tue, May 5, 2020 at 1:05 PM Collin Anderson > wrote:If it were

Re: Removing url() ?

2020-05-05 Thread Collin Anderson
> I don't think that we can revert [1] without a technical board approval Needing technical board approval to keep url() seems fair to me. I think most of the 2522559 changes are ok. I'd be fine if we only made these changes: https://github.com/django/django/compare/master...collinanderson:kee

Getting rid of url()

2020-05-05 Thread Collin Anderson
Hi All, Are we ok getting rid of url()? Yesterday url() was officially slated for removal in [ticket #31534], and I know it was discussed and agreed upon back in [2017], even in a DEP, but I feel like the amount of work it would take to maintain the [shim] is near zero, and the total amount of

Re: Removing url() ?

2020-05-05 Thread Collin Anderson
just fine on newer versions of Django. On Tuesday, May 5, 2020 at 1:04:02 PM UTC-4, James Bennett wrote: > > On Tue, May 5, 2020 at 8:42 AM Collin Anderson > wrote: > > Is this really worth it? It's only a few lines of code to keep backward > compatibility, and it seems

Removing url() ?

2020-05-05 Thread Collin Anderson
Hi All, Are we _sure_ we want to completely get rid of url()? Yesterday, url() was given a RemovedInDjango40Warning [PR]. The removal was approved as part of the new path() syntax back in 2017 [DEP 0201]. Is this really worth it? It's only a *few lines of code* to keep backward compatibility,

Re: Adding ability to choose AutoField type (signed vs unsigned)

2020-04-09 Thread Collin Anderson
Having a DEFAULT_AUTOFIELD setting makes sense to me. On Monday, April 6, 2020 at 12:48:10 PM UTC-4, Adam Johnson wrote: > > Jure - yes switching the setting should generate migrations for all > affected models. The migration guide would cover changing models' primary > key fields to PositiveBig

Re: More standard template filters

2020-01-29 Thread Collin Anderson
>> similar and you can pop a Jinja2 backend in your TEMPLATES. >> >> >> >> On Fri, 5 Apr 2019 at 07:43, Curtis Maloney wrote: >> >>> On 4/5/19 3:06 AM, Collin Anderson wrote: >>> > Hi All, >>> > >>> > I use django tem

Re: Proposal: Allow ManyToMany using a intermediary table to be defined as symmetrical

2019-05-08 Thread Collin Anderson
d this one which is > kind of related https://code.djangoproject.com/ticket/9475 > And you can see in the PR some discussion about the check > https://github.com/django/django/pull/8981#discussion_r247946460 > Thanks to the work of Collin Anderson in the previous PR I think we can >

Re: 2020 Authentication Initiativ

2019-04-10 Thread Collin Anderson
Email + password auth is definitely a wanted feature out-of the box, and probably a good first step would be to create a separate AbstractEmailUser or something like that. Seems to me AbstractUser shouldn't be changed for backwards compatibility reasons, but maybe something like a BaseAbstractUser

Re: Specifying model relationship as string vs concrete model class

2019-04-07 Thread Collin Anderson
models.Foreignkey(User) is a more pythonic and allows more better analysis by tools like flake8, but in some cases you need to create the ForeignKey before User is defined, so you _have_ to use a string. Example: https://docs.djangoproject.com/en/stable/ref/models/fields/#foreignkey On Sat, Apr 6

More standard template filters

2019-04-04 Thread Collin Anderson
Hi All, I use django templates a lot and I always wished there was a myvar|startswith:"teststring", myvar|endswith:"teststring" and a myvar|contains:"teststring" filter. I instead do stuff like myvar|slice:":10" == "teststring" which is a total hack. Is this something that could be simple and

Re: Password reset emails in combination with click tracking do not work with Intelligent Tracking Prevention on Safari for iOS 12 and macOS Mojave

2019-02-22 Thread Collin Anderson
I wouldn't mind just rolling back the security fix (or maybe making a straightforward way to enable/disable the behavior). We could instead encourage people to use on any links (from the password rest page) to untrusted urls. On Friday, February 22, 2019 at 5:03:01 AM UTC-5, Henrik Ossipoff Ha

Re: include only columns from selected related models in select_related query

2019-02-11 Thread Collin Anderson
So would you "defer" the other columns like "only()"? If nothing else, you could try using .annotate(F('author__hometown')) (not sure if that works) or .values('author__hometown') to just get the values you need. On Mon, Feb 11, 2019 at 5:50 AM Riccardo Magliocchetti < riccardo.magliocche...@gmai

Re: Automating the process of creating models from the data file provided

2019-02-07 Thread Collin Anderson
Hi Abhilasha, This is ringing a bell. I almost started working on an "inspectfile" feature many years ago as a Google Summer of Code project. https://groups.google.com/d/topic/django-developers/z88grOaxEHU/discussion https://groups.google.com/d/topic/django-gsoc/V9FdRVZ7gMg/discussion I ended u

Re: revisiting the Python version support policy

2019-01-22 Thread Collin Anderson
Now that we've dropped Python 2, I personally wouldn't mind having the policy be to support all supported versions of python (except 2.7) at the time of each Django release. So Django would drop just after Python drops. (The most recent version of Django (and maybe LTS too) should probably also add

Re: [Looking for feedback] Make Admin raw_id_fields the default choice for FKs, or project-wide configurable

2019-01-18 Thread Collin Anderson
els can have >>>> different names. I can't just write one global ModelAdmin and then use it >>>> for all my models, because they'll have different names for their fields. >>>> Or if it works, it'll need A LOT of introspection (to dynamically check >

Re: [Looking for feedback] Make Admin raw_id_fields the default choice for FKs, or project-wide configurable

2019-01-17 Thread Collin Anderson
I agree that default load-all-options is an annoying default. I just ran into this problem again myself in the last few weeks. One problem with any of the alternatives (besides making it readonly by default) is that it requires the other model to be registered in the admin, which could be also be a

Re: RFC: #30053 Allow for conditional QuerySet.update_or_create()

2019-01-02 Thread Collin Anderson
Seems to me a documentation example or improvement could be helpful. On Mon, Dec 31, 2018 at 11:30 AM Joshua Cannon wrote: > Personally, the snippet suggested in the ticket is sufficient for my needs > (although I'm saddened by having to duplicate the setattr logic). > However, I filed the ticke

Re: New to open source community

2018-12-18 Thread Collin Anderson
Hi Pradeep, You could try also joining the #django-dev irc channel. Also checkout the "Advice for new contributors" if you haven't yet: https://docs.djangoproject.com/en/dev/internals/contributing/new-contributors/ Thanks, Collin On Sun, Dec 16, 2018 at 2:18 PM Pradeep Sukhwani wrote: > Hi t

Re: normalizing newlines in form fields

2018-11-12 Thread Collin Anderson
Maybe the newline character could be part of the setting, something like normalize_newlines_to='\n'. And then just do a normalize_newlines_to.join(value.splitlines()) could work. On Mon, Nov 12, 2018 at 10:49 AM Jakub Kleň wrote: > Regarding the link you sent, I also think that the current behav

Re: Allow skipping CSRF check for Referer header

2018-11-12 Thread Collin Anderson
Aas a data point, I've customized my csrf checking to skip the referrer checking if there's a correct origin header. Though yes, it doesn't work in some browsers. (I haven't set up Referrer-Policy so that hasn't been an issue for me yet.) I think it's worth mentioning too that same-site cookies ar

Re: Simplify authentication backend interface

2018-11-12 Thread Collin Anderson
> Add default implementations for get_all_permissions() and has_perm(), either in PermissionMixin or in a new BaseBackend class. On a first glance, I think that makes sense to me. > Also note that the separation between user and group permissions may not be applicable with custom backends. That al

Re: Idea: Allow queryset.get() and queryset.filter() to accept a positional argument for implicit primary key filtering

2018-11-07 Thread Collin Anderson
You could probably also just monkey patch like so: from django.db.models import Manager, QuerySet Manager.ident = QuerySet.ident = lambda self, pk: self.get(pk=pk) On Wed, Nov 7, 2018 at 3:33 PM C. Kirby wrote: > I bit the bullet and put together a small app to handle this, with maybe > even le

Ticket/Issue Tracker

2018-10-26 Thread Collin Anderson
A few years ago I realized I really liked the UI of Trello.com, so I tried creating a trello-style view of django tickets: https://djello.collinand.org/ (beware, I'm not a designer :) It's basically just 100 lines of JS and a little CSS. It's still my go to for finding tickets. I thought I'd s

Re: Make `raw_id_fields` the default functionality in the admin

2018-10-17 Thread Collin Anderson
raw_id_fields can be a bit confusing to people. Have you tried the new autocomplete_fields? It's almost as easy to use as a select field, and it should help solve the problem. However, it's not as easy to make the default (because it requires specifying search_fields on the related model) On Wed,

Re: #29752 Adding a ALLOWED_HOSTS_IGNORABLE_URLS setting

2018-09-14 Thread Collin Anderson
You might be able to handle this by a middleware that gets called early enough in the process (before CommonMiddleware) to avoid calling request.get_host(). A simple if request.path == '/statuscheck/': return HttpResponse() should work. As long as you never call request.get_host(), django doesn't a

Re: HTML5 and XHTML5 documents

2018-08-17 Thread Collin Anderson
> serve Django Admin as 'text/html', and let other apps choose for themselves. Yes, DEFAULT_CONTENT_TYPE is deprecated, so the admin (soon) should always return text/html, and other apps can choose for themselves. (see ticket #23908 ) I think django sho

Re: python manage.py inspectdb makes all fields with a default value blank=True, null=True

2018-07-22 Thread Collin Anderson
It's tricky to automatically convert the database default value to python, but I wonder if it would help to put the default value in a python comment at the end of the field? like: models.IntegerField(blank=True, null=True) # DB Default value: 1 That way it's more clear in models.py what's going

Re: Re: The behavior of QueryDict.get(_key_, _default=None_)

2018-07-19 Thread Collin Anderson
You might want to try json encoding your data if you want to preserve integers, lists, etc. On Thu, Jul 19, 2018 at 10:54 PM Collin Anderson wrote: > Using your example, the client is sending this string: > > ?wordPos=2&wordPos=3 > > It's not an array like ?wordPos=2,3

Re: Re: The behavior of QueryDict.get(_key_, _default=None_)

2018-07-19 Thread Collin Anderson
Using your example, the client is sending this string: ?wordPos=2&wordPos=3 It's not an array like ?wordPos=2,3 On Thu, Jul 19, 2018 at 10:27 PM Zhao Lee wrote: > I have to confess I don’t know much about web development . > > I used to expect QueryDict.get(_key_, _default=None_) to return dat

Re: New Feature discussion: making admin app & model url configurable

2018-06-29 Thread Collin Anderson
Maybe we could make an AdminSite.get_urls_for_model(self, model, model_admin) https://github.com/django/django/pull/10108/files On Fri, Jun 29, 2018 at 8:57 AM wrote: > Personally, I'm not sure I see that much value. As I see it, the admin is > intended for technical users, not as a general adm

Re: Redirect using HTTP status "303 See Other"

2018-06-04 Thread Collin Anderson
I don't think we should make any changes to HttpResponseRedirect, for backwards compatibility reasons if nothing else. It might make sense to encourage people to use HttpResonse(status=303) directly, rather than using subclasses. On Mon, Jun 4, 2018 at 3:51 PM, Duane Hutchins wrote: > The "302

Re: Spaces between argument separator and argument in template filter generate error

2018-05-31 Thread Collin Anderson
Maybe it would be worth having a more friendly error message? On Thu, May 31, 2018 at 8:59 PM, wrote: > Thank you for your reply. > I understand your opinion well > > 2018년 5월 31일 목요일 오전 11시 41분 22초 UTC+9, oli...@kidsnote.com 님의 말: >> >> In the template filter system now, >> >> spaces between au

Re: #29433 New split template filter

2018-05-30 Thread Collin Anderson
There's been a few cases where I would have found a split filter to be useful. I don't remember them off the top of my head. I like that the behavior of it should be pretty well defined: just return obj.split() if val is None else obj.split(val) On Wed, May 30, 2018 at 6:32 AM, Carlton Gibson wr

Re: Set formfield.initial when created using modelformset_factory

2018-05-23 Thread Collin Anderson
Hi Brock, Yes, that's the intended behavior, and you can see the same behavior on a regular form, without using formsets, which might make it a little more clear what's going on: class MyForm(forms.Form): name = forms.CharField() form = MyForm(initial={'name': 'test'}) form.initial #yields

Re: email login, create and save

2018-05-04 Thread Collin Anderson
Do you want something like this? class EmailUserCreationForm(UserCreationForm): username = User._meta.get_field('username').formfield(label='Email', validators=[validators.validate_email]) def save(self, commit=True): self.instance.email = self.cleaned_data['username'] ret

Re: #django-dev IRC channel

2018-04-27 Thread Collin Anderson
Hi Kenneth, The Contributing to Django page is part of the Django's main documentation, so open a ticket for django: https://code.djangoproject.com The source for that page is here: https://github.com/ django/django/blob/master/docs/

Re: ModelAdmin.prepopulated_fields removes stop words

2018-04-25 Thread Collin Anderson
Hi Kelly, I believe it's in urlify.js https://github.com/django/django/blob/master/django/contrib/admin/static/admin/js/urlify.js#L172-L175 Collin On Wed, Apr 25, 2018 at 4:51 PM, Kelly wrote: > Hello, > > I am working on ticket 29351 > and I am d

Re: Fabric examples in documentation

2018-04-25 Thread Collin Anderson
A little bit more information: Fabric2 has been actively developed over the last year, but is still Alpha (may get api changes): https://github.com/fabric/fabric/tree/v2 http://bitprophet.org/blog/2017/04/17/fabric-2-alpha-beta/ I agree removing references to fabric might be the way to go. There a

Re: Shouldn't manage.py call python3 instead of python?

2018-04-11 Thread Collin Anderson
but python3 manage.py doesn't work on windows, right? On Tue, Apr 10, 2018 at 10:17 PM, Josh Smeaton wrote: > As a datapoint, I've seen roughly 1 person per week in #django IRC > confused about specific startup exceptions due to them using python 2 > rather than python 3 on Django >= 2.0. Unsur

Re: Shouldn't manage.py call python3 instead of python?

2018-04-09 Thread Collin Anderson
k to use os.path.basename(sys.executable) ?) > > > The shebang is interpreted by the OS so this is before python even starts > :) > > On 9 April 2018 at 20:53, Collin Anderson wrote: > >> I personally just edit my manage.py to change it from python to python3. >> Maybe we

Re: Shouldn't manage.py call python3 instead of python?

2018-04-09 Thread Collin Anderson
I personally just edit my manage.py to change it from python to python3. Maybe we could just document that? (Or would it work to use os.path.basename(sys.executable) ?) On Sun, Apr 8, 2018 at 11:02 AM, Tom Forbes wrote: > It may be an obstacle but I believe it’s better than having them nuke > t

Re: URL Query Params via Reverse.

2018-03-05 Thread Collin Anderson
Hi Matthew, Are you aware of Python's urlencode? https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode It sounds like you want something like: def reverse_with_querystring(viewname, data=None): return "{url}{querystring}".format(url=reverse(viewname), querystring='?' + ur

Re: please make django model independent,i wanna use without full django project, thanks

2018-03-01 Thread Collin Anderson
Hello, Do you mean not use the entire django package? or not use an entire "project" directory as created by startproject? Why don't you want to use full django project? Thanks, Collin On Thu, Mar 1, 2018 at 5:31 AM, 王冯俊 wrote: > please make django model independent,i wanna use without full dj

Re: Raising awareness to issue #17664

2018-03-01 Thread Collin Anderson
"{% if %} template tag silences exceptions inconsistently" On Thu, Mar 1, 2018 at 8:57 AM, Robert Roskam wrote: > I spent some time looking at this issue last week, and I wanted to raise > awareness here. It's an issue that's been out there for 6 years, and I > think I have a path forward. > > H

Re: Consider renaming `mark_safe` to `dangerously_trust_html` (etc)

2018-02-21 Thread Collin Anderson
> Maybe we could just alias and warn when using the old name, leaving a decision on deprecation until some time in the future. I'm a fan of delaying deprecation/removal if we do change it. :) On Wed, Feb 21, 2018 at 4:41 PM, Josh Smeaton wrote: > I agree that the names are misleading and we sho

Re: Thoughts re looser coupling of django.contrib.auth and django.contrib admin

2018-02-08 Thread Collin Anderson
Hi Steve, If it helps at least in the short-term, those fields currently don't need to be actual database columns. I have a custom user that has these properties/methods to make work with the admin. Collin @property def is_anonymous(self): return not self.is_authenticated @p

Re: ticket 28404

2018-02-07 Thread Collin Anderson
Hi Carlton, There are some cases where I really do want an empty string displayed (though not in a linked column). Maybe only use it only when it's an auto-linked field/column? Or maybe only use this behavior in display_for_field()? (So if you use a custom function/method, you can still have full

Re: DEP Pre-posal: Re-Designing Django Forms

2018-01-31 Thread Collin Anderson
I personally use the (undocumented?) formfield() method, which takes the model defaults and lets you override things. I think it's pretty elegant, though maybe it could use some less verbose syntax (maybe have a forms.ModelDefault(label='Note') that does this for you). class NoteModalForm(forms.Mo

Re: Why Django render DateField type as text instead of date ?

2018-01-23 Thread Collin Anderson
Hi, The history of why is here: https://code.djangoproject.com/ticket/16630#comment:11 You can get type="date" like so on your form: birth_date = forms.DateField(attrs={'type': 'date'}, required=False) Thanks, Collin On Tue, Jan 23, 2018 at 12:43 AM, Ruchit Bhatt wrote: > Hi folks, > Here i

Re: Don't assume that missing fields from POST data are equal to an empty string value.

2018-01-23 Thread Collin Anderson
Maybe it would be helpful to have an option where it errors if (non-boolean) fields are non-existent in the POST data? (Though I have some GET-forms where I would not want that behavior) Maybe I could somehow set allow_missing_fields = True in that case? On Tue, Jan 23, 2018 at 4:56 AM, Tai Lee w

Re: ManytoMany Field save_form_data has not support for through table

2018-01-18 Thread Collin Anderson
Hi Andrew, Sure, do you want propose some tests? You could even open a new PR. Thanks, Collin 574-339-1060 On Thu, Jan 18, 2018 at 12:40 AM, Andrew Standley wrote: > Hi Collin, > The patch seems to work perfectly with intermediate models without > required fields. > > However looking over t

Re: ManytoMany Field save_form_data has not support for through table

2018-01-16 Thread Collin Anderson
Hi Andrew, Would allowing set() for through models help in your case? https://github.com/django/django/pull/8981 Thanks, Collin On Mon, Jan 15, 2018 at 5:14 PM, Andrew Standley < astand...@linear-systems.com> wrote: > Greetings, > I've been messing around with trying to update some custom

Re: Hello everyone I'm a new member

2017-12-18 Thread Collin Anderson
Yes, wait until at least 2019 to deprecate those. https://code.djangoproject.com/ticket/27753 On Mon, Dec 18, 2017 at 10:45 AM, Adam Johnson wrote: > Please don't do that, as I recall we'll just delete django.utils.six after > the minimum recommended django version for third party libraries is 2.

Re: Proposal: make Model __unicode__() default to self.name

2017-12-12 Thread Collin Anderson
On the other hand, it does make sense to include the PK in __repr__, so I > would suggest backtracking on this change and making an equivalent change > in __repr__. > > On Saturday, April 8, 2017 at 8:41:56 PM UTC+2, Collin Anderson wrote: >> >> I just made a pull request. >

Improving Backward Compatibility

2017-12-06 Thread Collin Anderson
Hi All, I think it would help if Django was better at *deprecations and backward compatibility*. I’ve brought this up [before ], but didn’t get any feedback, so here’s another try at it, with some *specific ideas of ho

Re: Feature request: get_first_or_404

2017-11-28 Thread Collin Anderson
Is there a different between get_first_or_none() and the already existing first()? If we do first, some may want get_last_*() for everything too :) On Tue, Nov 28, 2017 at 8:31 PM, Josh Smeaton wrote: > From my experiences, all projects I've worked on have implemented > get_first_or_none and ge

Re: Templates: __html__ method support

2017-09-26 Thread Collin Anderson
I think this is a good idea. Django has used __html__ internally for the last 4 years so it's not something new [0]. I'm surprised this doesn't work out-of-the box. [0] https://code.djangoproject.com/ticket/7261 On Tue, Sep 26, 2017 at 9:26 AM, George-Cristian Bîrzan wrote: > On Tuesday, Septem

Re: New Feature: Allow password reset token to expire in under a day

2017-09-21 Thread Collin Anderson
Seconds is consistent with all of the other settings, even for long ones like CSRF_COOKIE_AGE and SESSION_COOKIE_AGE. It also means you can avoid importing datetime in your settings file. On Thu, Sep 21, 2017 at 8:36 PM, Tom Forbes wrote: > It also seems odd to express it as seconds, it's often

Re: drop support for MySQL 5.5 in Django 2.0?

2017-08-30 Thread Collin Anderson
As a datapoint for MySQL, Most of my websites are on Ubuntu 16.04 (Python 3.5, MySQL 5.7), though I do have one on 14.04 (Python 3.4, MySQL 5.5) that I _would_ upgrade to Django 2.0 if we kept 5.5 support, but it's not a big deal to leave it at 1.11 until I switch to 16.04. On Sat, Aug 26, 2017 at

Re: I would like to discuss my proposal for a working way to call .add() on an m2m with through= model

2017-08-26 Thread Collin Anderson
Hi All, I have a pull request for simple add()/create() etc with m2m through tables if any wants to try it out: https://github.com/django/django/pull/8981 If people are happy with the API, I'll add the docs too. Collin On Mon, Apr 17, 2017 at 3:53 PM, Luis Masuelli wrote: > I'm quite happy t

Re: To keep or not to keep: logging of undefined template variables

2017-08-24 Thread Collin Anderson
I used to do that too (string_if_invalid that raises an exception). What was nice about this, is you could explicitly wrap the variable in an if tag to silence the error if you were ok with it. (I'm not sure if this behavior is still true.) {% if var_that_sometimes_exists %}{{ var_that_sometimes_e

Re: Automatic prefetching in querysets

2017-08-18 Thread Collin Anderson
I like that idea - keep it a private API for now and make it a public API once people have used it a little bit. On Fri, Aug 18, 2017 at 4:01 AM, Shai Berger wrote: > On Friday 18 August 2017 09:08:11 Anssi Kääriäinen wrote: > > Maybe we should just add the queryset method. This is the smallest

Re: Automatic prefetching in querysets

2017-08-17 Thread Collin Anderson
"turn it on/off per model" - I wonder if we just have a custom manager/mixin for the per model case. objects = AutoPrefetchRelatedManager(). The manager can return a queryset with prefetch_related(auto=True) or whatever already applied. On Thu, Aug 17, 2017 at 1:33 PM, Andrew Godwin wrote: > Jus

Re: Automatic prefetching in querysets

2017-08-15 Thread Collin Anderson
Hi Gordon, How is it implemented? Does each object keep a reference to the queryset it came from? Collin On Tue, Aug 15, 2017 at 2:44 PM, Gordon Wrigley wrote: > Sorry maybe I wasn't clear enough about the proposed mechanism. > > Currently when you dereference a foreign key field on an object

Re: Admin actions.js performance

2017-08-04 Thread Collin Anderson
I can confirm it's slightly faster in my case (maybe 20-50ms for 58 rows, 3 inputs per row). I can get it ~15ms faster by making it just one event handler, though it's a bigger change: $('#result_list').on('change', 'td:nth-child(n+2) :input', function() { On Fri, Aug 4, 2017 at 7:29 AM, ecas wr

Re: Default to BigAutoField

2017-06-09 Thread Collin Anderson
I might be wrong, but if the default changes, won't the migrations detect it and migrate it just fine, including foreign keys? All of my migrations have this: ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), So everyone would either need to manual

Re: Value of tightening URLValidator/EmailValidator regular expressions?

2017-05-31 Thread Collin Anderson
Hi All, There's a PR [0] to make validation match HTML. Though there's a question about what to do with domain_whitelist. Here's the background: - Originally Django didn't allow any dotless (non-FQDN) domain names. - People wanted to use "localhost", but the SMTP spec said "Local nicknames or

Re: [JOB POST] Django backend developer per Centre Comune di Ricerca - JRC

2017-05-23 Thread Collin Anderson
(Django-users is a better place for job postings: https://groups.google.com/d/forum/django-users ) On Tue, May 23, 2017 at 5:17 PM, Aymeric Augustin < aymeric.augus...@polytechnique.org> wrote: > Hello Jorge, > > Job postings are inappropriate on this mailing list. > > Thanks for your understandi

Re: Admin and CSS Custom Properties

2017-04-28 Thread Collin Anderson
I suggest supporting IE11+, as that's the latest on Windows 7 and there's not much 9-10 usage. Now's probably a good time to bump them if needed because we're just past an LTS. Though, yes, it doesn't allow CSS variables. On Fri, Apr 28, 2017 at 6:38 AM, Curtis Maloney wrote: > I recently disco

Re: Django test suite taking > 2 hours, gets stuck, have to Ctrl-C

2017-04-22 Thread Collin Anderson
Hi Dylan, Was there a traceback when you pressed ctrl+c? That might show where it's getting stuck. You could try using --parallel=1 to disable multi-process which might also give you some more information. (And does the test suite run fine without your patch? :) I assume you're testing using th

Re: A New Design for the "Congratulations!" Page

2017-04-18 Thread Collin Anderson
I was also reminded of green color the green color discussion. >From the discussion about the admin redesign [0][1]: "makes keeping a visual identity for Django hard to separate from the admin UI" "the admin is part of _your_ site, not ours, and so should have a visually-distinct theme/brand that

Re: A New Design for the "Congratulations!" Page

2017-04-18 Thread Collin Anderson
Beautiful. The Google Font should not be an issue. We're already distributing that as part of the admin, which is installed by default. The page could just reference /static/admin/css/fonts.css. Does a license need to be included for the rocket animation, or is that your own work? I hope the lin

Re: Proposal: make Model __unicode__() default to self.name

2017-04-08 Thread Collin Anderson
gt; diff --git a/django/db/models/base.py b/django/db/models/base.py >>>>> index 3c1cb9a..f58e12b 100644 >>>>> --- a/django/db/models/base.py >>>>> +++ b/django/db/models/base.py >>>>> @@ -504,7 +504,7 @@ class Model(metaclass=ModelBase): >>

Re: Proposal: make Model __unicode__() default to self.name

2017-04-07 Thread Collin Anderson
py >> @@ -504,7 +504,7 @@ class Model(metaclass=ModelBase): >> return '<%s: %s>' % (self.__class__.__name__, u) >> >> def __str__(self): >> -return '%s object' % self.__class__.__name__ >> +return '%s object pk=

Re: Proposal: make Model __unicode__() default to self.name

2017-04-03 Thread Collin Anderson
w: Should it be 'ClassName object > pk=Something' and if pk is None then should it be 'ClassName object > (unsaved)' or 'ClassName object pk=None' ? > > On Sunday, 2 April 2017 23:47:01 UTC+5:30, Collin Anderson wrote: >> >> Makes sense to me. Maybe

Re: Proposal: make Model __unicode__() default to self.name

2017-04-02 Thread Collin Anderson
g "pk" in Model string > representation if it exists. > > On Thursday, 11 July 2013 09:16:25 UTC+5:30, Collin Anderson wrote: >> >> Hi All, >> >> Have you ever quickly set up a model, ran syncdb, and added a few sample >> objects in the admin to only see a bu

Re: Add better support for ManyToMany with intermediary table fields, and reverse relationships, specially in forms

2017-03-30 Thread Collin Anderson
Hi Gabriel, Yes, the hope is to make the situation better and more standard. Here's some of the status: https://code.djangoproject.com/ticket/24317 - real reverse fields. https://code.djangoproject.com/ticket/897 - real reverse many to many fields https://code.djangoproject.com/ticket/12203 - many

Re: Deprecate is_superuser, is_staff and is_active

2017-03-24 Thread Collin Anderson
Hi Thomas, "If the user should have all permissions, then why not give him all these permissions at database level?" - I have some use cases where there are only 3-5 people that need to log into the admin. I don't really need to set different levels of access for different people. I also don't wan

Re: I would like to discuss my proposal for a working way to call .add() on an m2m with through= model

2017-03-20 Thread Collin Anderson
Hi, Check out https://code.djangoproject.com/ticket/9475 Seems like it would be fine if Django allowed add() and let any errors about missing data bubble-up. I personally think passing in a defaults dict (just like get_or_create does) would also be fine, but a callback seems like overkill. Here'

Re: Provide forms field/widget type information for use in templates

2017-03-20 Thread Collin Anderson
Hi, If it helps It looks like there's a widget.input_type attribute, so you can at least do {% if theform.thefield.field.widget.input_type == "checkbox" %} etc. Collin On Mon, Mar 20, 2017 at 9:46 AM, Paweł Adamczak wrote: > Hiya, > > I would like to 'resurrect' ticket #13009 >

Re: Add ability to choose a different secret for PasswordResetToken

2017-03-18 Thread Collin Anderson
"the self-service site is basically a small subset of our internal site. So if somebody would gain access to our interal site, he/she would already have access to a superset of data of the other site. So there is really no point to also take over to the other site." Just curious: why not just use

Re: Removing and renaming Django's Python 2 related helpers

2017-01-30 Thread Collin Anderson
Hi All, django.utils.six _is_ documented, so I think it should go through the normal deprecation timeline. https://docs.djangoproject.com/en/1.11/topics/python3/#writing-compatible-code-with-six Seems fine to me to start the deprecation in 2.0, but I'm sure people would appreciate starting the t

Re: Responsive admin

2017-01-10 Thread Collin Anderson
I think for the admin fonts, we put those in a separate css file: fonts.css, so you could easily disable them by replacing that file with a blank file. We could probably do the same thing with a responsive.css file. (Though if we do give the option to switch, do we now need to support and test eve

Re: Provide a simpler way to default runserver IP/port to 0.0.0.0:8000

2016-12-23 Thread Collin Anderson
If it helps, there's a also a shortcut: ./manage.py runserver 0:8000. Much easier to type. On Mon, Nov 28, 2016 at 8:48 AM, wrote: > This was filed as https://code.djangoproject.com/ticket/27537 , but > moving here for discussion. > > We have the following use case: > * An app uses a VM for the

Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-30 Thread Collin Anderson
Hi, "it could be possible to provide such a widget in contrib.admin". The current PR provides a django.contrib.admin.widgets.AutocompleteSelect widget. Does that work? You could subclass it to use a different URL instead of the built-in admin:autocomplete url if needed. My one worry is that if w

Re: Add HTML5 required attribute on form widgets

2016-05-05 Thread Collin Anderson
orm to validate against. (Login vs Create account, Checkout vs Apply promo code, Use a saved address or add new address, etc.) Thanks, Collin On Thu, May 5, 2016 at 2:34 PM, Jon Dufresne wrote: > On Thu, May 5, 2016 at 11:29 AM, Collin Anderson > wrote: > >> If anyone is runni

Re: Add HTML5 required attribute on form widgets

2016-05-05 Thread Collin Anderson
If anyone is running into hidden required fields preventing forms from submitting (like me), I've been using this jQuery code for a somewhat-hacky quickfix: $(':hidden[required]').removeAttr('required') On Saturday, April 2, 2016 at 12:27:28 PM UTC-4, Jon Dufresne wrote: > > On Wed, Mar 30, 201

Re: Vendoring Select2

2016-04-06 Thread Collin Anderson
Hi All, I'm in favor of this change. This has the potential to replace the raw_id_fields and filter_horizontal which I think would be a huge win. Those widgets are out-dated not only in terms of code, but also from a UI point of view. I'll try to give my answers to some questions before they c

Re: A helpful ImportError for manage.py when Django isn't installed/available

2016-04-03 Thread Collin Anderson
We could also wait til after we remove py2 support in January. That way we can be sure that on py3 it will also print the original exception so it doesn't get hidden. (Right?) On Fri, Apr 1, 2016 at 6:23 AM, Shai Berger wrote: > An idea: Catch the exception; in the handler, try to simply "import

Re: Add HTML5 required attribute on form widgets

2016-03-29 Thread Collin Anderson
Hi All, I think things are kind of quiet because djangocon.eu is starting tomorrow. My opinion: In the past we changed things to use html5 types (number, email, url, etc) and we didn't use a deprecation warning in those cases, just mentioned it in the release notes. I'm sure it will break some pe

Re: relative path in {% extends "...base.html" %} like relative import

2016-03-20 Thread Collin Anderson
Hmm... I suppose the closest alternative we have would be to store the base template name in a variable and pass it in from the view. On Fri, Mar 18, 2016 at 12:42 PM, Vitaly Bogomolov wrote: > Hi, All. > > For django.template.backends.django.DjangoTemplates (filesystem and > app_directories) it

Re: [GSOC] Original Idea/Seeking Mentor: Conditions API (Related to Auth)

2016-03-19 Thread Collin Anderson
Hi Connor, I personally usually avoid class based views whenever possible and stick to function based views whenever possible. Would these Conditions be usable within function based views too? Thanks, Collin On Thursday, March 17, 2016 at 8:00:16 AM UTC-4, Connor Boyle wrote: > > My original

Re: Proposal: change to the way list_editable form data is submitted in the admin

2016-03-19 Thread Collin Anderson
I could see this feature being helpful. (Submitting the original data and comparing it to be sure we don't silently have a merge conflict). On Wed, Mar 16, 2016 at 11:14 PM, John C wrote: > Thanks. #11652 is a good description of the same problem in the context of > the "change" page. I think th

Re: Revisiting multiline tags

2016-03-18 Thread Collin Anderson
Here's the actual code PR https://github.com/django/django/pull/2556 On Sun, Mar 13, 2016 at 1:26 AM, Martijn van Oosterhout wrote: > > On 12 March 2016 at 05:31, Curtis Maloney wrote: > > I think this conversation needs to come to a conclusion, and that >>> conclusion should be simple. Several

Re: Override the default form field for a model field

2016-03-18 Thread Collin Anderson
A few thoughts, just to see if we can solve the problem by documenting some existing code: Would making a subclass overriding formfield() work? class RadioSelectBoolean(models.BooleanField): def formfield(self, *args, **kwargs): kwargs['widget'] = forms.RadioSelect super(Radio

Re: Translate permission Django

2016-03-14 Thread Collin Anderson
Maybe we could have __str__ run the text through _()? I don't do much translating. On Mon, Mar 7, 2016 at 10:21 AM, Tim Graham wrote: > This has been discussed in several tickets ( > https://www.google.com/search?&q=translate+permissions+site%3Acode.djangoproject.com) > and mailing list threads

  1   2   3   >