Questions tagged [datefield]

307 questions
3
votes
1 answer

Django: Give date field default value of one month from today

In Django, you can have a date field and set the default value to today. start_date = models.DateField(default=timezone.now, blank=True, null=True) How do you set the default date to 1 month from today?
Micah Pearce
  • 1,805
  • 3
  • 28
  • 61
3
votes
1 answer

Subtract django.db.models.DateField from python's datetime.date to get age

In django, I want to get the age (in days) of an instance of a class. I tried doing that by subtracting its creation date field from today, but it does not seem to work properly. date.today() works fine, but DateField is giving me trouble. I looked…
arturomp
  • 28,790
  • 10
  • 43
  • 72
3
votes
1 answer

DateField doesn't take date.today as default

Python version 2.7 Django version 1.11 Trying to make my first Django app saving documents, here the part of models.py class Docs(models.Model): FacilityRef = models.ForeignKey(Facility) Date = models.DateField(default=date.today) Type =…
alexeyk0
  • 35
  • 1
  • 3
3
votes
1 answer

SilverStripe. Search by date-range in ModelAdmin

I have date-property in my DataObject. How can I search by date-range in ModelAdmin? For example: "search all items where date is more than 2007-13-01 and less than 2007-17-01" or "search all items where date is between 2007-13-01 and…
FlamyTwista
  • 447
  • 5
  • 17
3
votes
1 answer

Django Monthly/quartarly grouping of DateField() data

I've got a django model which contains, among other things, a DateField() attribute: class Table(): date = models.DateField() value = models.FloatField() I'm writing a view that groups this data by week, month Quarter and year. I've…
0atman
  • 3,298
  • 4
  • 30
  • 46
3
votes
1 answer

J2ME: Get only year/month/day from DateField

I'm trying to use dateField to display which year, month or day has been selected in the calendar. public DateField getDateField() { dateField = new DateField("dateField", DateField.DATE); dateField.setDate(new…
Peter
  • 33
  • 1
  • 3
3
votes
1 answer

SOLR date faceting and BC / BCE dates / negative date ranges

Date ranges including BC dates is this possible? I would like to return facets for all years between 11000 BCE (BC) and 9000 BCE (BC) using SOLR. A sample query might be with date ranges converted to ISO…
Nigel_V_Thomas
  • 907
  • 13
  • 27
3
votes
1 answer

Rounding the corners of a DateField in Flex 4?

I'm using Flash builder, with flex 4 sdk and am trying to create a DateField in which the TextInput component has rounded corners. I have tried the following code that doesn't work:
john
  • 1
  • 1
  • 4
3
votes
1 answer

How to validate a DateField correctly in Vaadin?

I'm having some trouble with validating DateFields. In my application I have a table with DateField properties that the users should be able to edit by pressing an edit button. I also have an OK-button that commits the fields and a cancel-button…
Roger
  • 2,684
  • 4
  • 36
  • 51
3
votes
1 answer

Inspite of setting (null=True, blank=True) for ModelForm field, I get validation error on leaving the field blank

I have following models.py code: class try(models.Model) date = models.CharField(max_length=10, blank=True, null=True) # statement no. 1 #also tried this instead of statement no.1 : #date = models.DateField(blank=True, null=True) …
Vabbs
  • 107
  • 14
3
votes
0 answers

Symfony empty date field is not required with single_text widget

I created form with date field using single_text widget. I'm choose this one over choice because I'm using Bootstrap datepicker Problem I have is that field is always populated with current date instead of being empty. According to this it should…
Gustek
  • 3,680
  • 2
  • 22
  • 36
3
votes
2 answers

ExtJS DateField gets blanked out when selected

I have a grid with a Column configured like... { ... editor:new Ext.form.DateField({format:'m/d/Y'}), renderer: function (val){return val ? Ext.util.Format.date(val, 'm/d/Y') : ''} ... } It works fine, except that when I click on a cell…
dublxdad
  • 153
  • 1
  • 12
3
votes
2 answers

ExtJS DateField - initialising date

I have an ExtJS Date field. During some operation in the application, min value and max value get assigned to the date field. The min value and max value are 4 years prior to the current dat, but when the date picker opens up, it opens to the…
Zaje
  • 2,281
  • 5
  • 27
  • 39
2
votes
2 answers

Django save string to date field

In my Django application I have a DateField (format 'YYYY-MM-DD'). When I try to save the string '2011-11-01' I get no error but my fields gets the NULL value. I tried to do that with strptime function from datetime and time libraries but with the…
bogtan
  • 825
  • 2
  • 13
  • 23
2
votes
1 answer

How to get start date and end date of current month in AS3

I have 2 DateFields named startDate and endDate I want to set startDate's Selected date to Current months start date and endDate's Selected date to Current months End date. How can I achieve this? Thanks in advance...
Santhosh Nayak
  • 2,312
  • 3
  • 35
  • 65
1 2
3
20 21