redirect('%s?%s' % (request.path, q.urlencode()))
> return super(MyModelAdmin, self).changelist_view(
> request, extra_context=extra_context,
> )
>
>
>
>
> On Tuesday, April 25, 2017 at 2:08:33 AM UTC+3, Nate Granatir wrote:
>>
>>
:
> q = request.GET.copy()
> q.setdefault('lang', 'en')
> return redirect('%s?%s' % (request.path, q.urlencode()))
>
>
>
>
> On Monday, April 24, 2017 at 7:12:18 PM UTC+3, Nate Granatir wrote:
>>
>> In my app I have admin
In my app I have admin filters for a field called "language" - language is
a field in several of my models - and I've created them custom, inheriting
from SimpleListFilter, so that I can apply a default of English when none
has yet been specified. This works almost perfectly - the only problem i
I may be speaking a bit out of my depth here, but I wonder if it's maybe
because you haven't created __init__.py files in the directories? I believe
Django (well, Python), requires an empty __init__.py file in directories
when loading them as modules:
https://docs.python.org/3/tutorial/modules.h
I am also not even close to being an expert on this topic, but I do know
that it's super easy to deploy a Django app on Heroku, which will get you
scalable app deployment and Postgres dbs with very little upfront effort.
https://devcenter.heroku.com/articles/deploying-python
Nate
On Sunday, Apr
You should be able to customize the queryset of any form by overriding it in
the init method of the form. In this case, it's a little trickier because
you'll need a custom admin and custom form for the inline. I haven't been able
to test this, but I think you'll need to do the following.
In fo
As demonstrated
here: https://docs.djangoproject.com/en/1.10/topics/db/examples/many_to_many/
If you have a ManyToMany relationship set up in your models, say:
class SerialNumber(models.Model):
serial = models.CharField(max_length=50)
class Item(models.Model):
item_name = models.CharFi
Yes, why are you using SQLAlchemy instead of Django's built-in ORM? I don't
see any reason to even attempt this unless you need to perform operations
outside the context of Django.
On Wednesday, November 2, 2016 at 2:09:18 AM UTC-5, pradam.programming
wrote:
>
> hi,
> I am new to SqlAchemy.My
Or why not just assign certain Users to certain Groups? That seems like a
much more clean and simple way of handling the problem. You'd be able to
easily filter either set of users, and it would require very little custom
code. Plus, doing something like assigning negative IDs disguises what
yo
Just realized this thread was not necessarily about filters for the admin;
in the case of using custom forms/views Django daterange filter may not be
a good option.
On Thursday, March 19, 2009 at 8:37:56 AM UTC-5, Paul Nema wrote:
>
> I've noticed many people new to Django (and sometimes also ne
I just installed Django Daterange Filter 1.3.0
(https://github.com/DXist/django-daterange-filter) on a Django 1.9 project.
Took a little CSS fiddling to get it to display properly with Grappelli,
but other than that it worked like a charm.
Nate
On Thursday, March 19, 2009 at 8:37:56 AM UTC-5,
You could also just join the dicts before passing them to the template. It
looks like it's relatively straightforward (scores is just a list that
contains dicts of a 'Number' and a 'score', right?) Then you could turn
scores into a dict, assuming Numbers are unique:
scores_new = {score['Number'
I've found that virtualenvs are definitely worth the time to set up, there
will be a time down the road when you need to have two different versions
of the same package. Also, I'd strongly recommend storing the project's
dependencies in a requirements.txt file. I have a terrible memory and would
You can put the version for your project in:
my_project/my_project/__init__.py (same folder as settings.py)
like this:
__version__ = '1.0.27'
Then your project acts as a python module, and you can refer to the version
number, for instance in your settings.py, as:
GRAPPELLI_ADMIN_TITLE = 'My Pr
14 matches
Mail list logo