hi, i want set initial value for field when a model insert page loaded in
django admin.
i think i can do this work with get_field_queryset method but in django
there is no toturial for get_field_queryset.
how to do this work?
thanks ...
--
You received this message because you are subscribed to
Hi Carlos,
You probably want to create a new widget and override its label_from_instance
method.
class BModelMultipleChoiceField(forms.ModelMultipleChoiceField):
def label_from_instance(self, obj):
return "%s (%s)" % (obj, obj.count_a)
And then you'll want to change your
Hi all,
I have a model A with a m2m to B:
--
class A(models.Model):
to_b = models.ManyToManyField(B)
class B(models.Model):
name = models.CharField(max_length=100)
--
In a view, I am listing A objects and I
Hello,
Going through Django Unleashed book right now.
Line 12 in blog/views.py page 155 reads:
slug=slug
shouldn't it be:
slug__iexact=slug
Best Regards,
John.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this gr
Yes that's it! Sorry, I lost the words there :D
On Friday, February 17, 2017 at 10:40:14 PM UTC+8, Melvyn Sopacua wrote:
>
> On Friday 17 February 2017 06:24:25 RON MICHAEL wrote:
>
> > No NOT duration. I simply want to get the date_from and the date_to
>
> > which is inside the DateRange.
>
>
>
On Friday 17 February 2017 06:24:25 RON MICHAEL wrote:
> No NOT duration. I simply want to get the date_from and the
date_to
> which is inside the DateRange.
You mean the lower and upper[1].
--
Melvyn Sopacua
[1]
http://initd.org/psycopg/docs/extras.html#psycopg2.extras.Date
Range
No NOT duration. I simply want to get the date_from and the date_to which
is inside the DateRange.
On Friday, February 17, 2017 at 8:13:39 PM UTC+8, Александр Христюхин wrote:
>
> Hi, do you mean to store some kind of duration? There's DurationField for
> that. And you could store datetime.time
On Friday 17 February 2017 01:43:12 MikeKJ wrote:
> As an adder:
>
>
> Each resource has a finite number so is there a way to utilise the
> max number of resources within a resource so that we know how many
> resources are unused?
Hmm, I'd rethink my datamodel. Everything is far easier to hand
You should use staticfiles to include your css, js and image in your page.
You first need to load the module in your template, then you can use
the static tag
{% load staticfiles %}
While you are in dev, static will look into each of your app's static
directory for the path you passed as argumen
Hi, do you mean to store some kind of duration? There's DurationField for that.
And you could store datetime.timedelta there. To get timedelta between two
datetime.datetime objects, you could subtract ine from another:
from django.utils import timezone as tz
now = tz.now()
day_ago = tz.now() -
Here is an exemple, slightly simplified from one of my project
Assuming a "generic" app, generic/templates/base.html would be
something like that
{% load staticfiles %}
{% block title %}myfb{% endblock %}
{% block content %}{% endblock %}
with style.css in generic/static/css/style.css and gene
what i have to do when i have multiple apps
On Friday, February 17, 2017 at 1:28:29 PM UTC+5:30, Jani Tiainen wrote:
>
> Hi,
>
> You need to put static files under static directory within app. Now you
> have static resources at your app root. So layout should be:
>
> users/
> static/
>
Anyone figure out a sort algorithm to do this please?
list =
DateTimeDuration.objects.all().filter(date=now).order_by('resource','start')
max_hours = 8
this produces
Resource – start – duration – user-name
Item - 9 - 4 - T Test
Item- 10 - 4 - Alpha Bravo
Item - 14 - 2 - Herod First
what
I second the need to put js and css files under a static directory. When
going to production, you'll need to look at the management command about
static files.
Also, don't put html files outside templates directory. And unless you have
a good reason not to, put the html files in a subdirectory of
14 matches
Mail list logo