Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Installing Django==2.1.1 from requirements.txt
I am attempting to install from requirements.txt and I get the following exception Could not find a version that satisfies the requirement Django==2.1.1 (from -r requirements.txt (line 12)) (from versions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.4.21, 1.4.22, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11, 1.5.12, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8, 1.6.9, 1.6.10, 1.6.11, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.10, 1.7.11, 1.8a1, 1.8b1, 1.8b2, 1.8rc1, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.8.10, 1.8.11, 1.8.12, 1.8.13, 1.8.14, 1.8.15, 1.8.16, 1.8.17, 1.8.18, 1.8.19, 1.9a1, 1.9b1, 1.9rc1, 1.9rc2, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7, 1.9.8, 1.9.9, 1.9.10, 1.9.11, 1.9.12, 1.9.13, 1.10a1, 1.10b1, 1.10rc1, 1.10, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.11a1, 1.11b1, 1.11rc1, 1.11, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.11.5, 1.11.6, 1.11.7, 1.11.8, 1.11.9, 1.11.10, 1.11.11, 1.11.12, 1.11.13, 1.11.14, 1.11.15, 1.11.16, 2.0a1, 2.0b1, 2.0rc1, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9) No matching distribution found for β¦ -
Firebase Messageing for Notification using pyfcm
print(dietitian.dtoken) # recieving registration id here. push_service = FCMNotification(api_key="API-KEY") # registration_id = (dietitian.dtoken) registration_id = json.dumps(dietitian.dtoken) message_title = "xyz" message_body = "Hi " result = push_service.notify_single_device(registration_id=registration_id, message_title=message_title, message_body=message_body) print(result) For this i am getting InvalidRegistration {'multicast_ids': [6833421978764843449], 'success': 0, 'failure': 1, 'canonical_ids': 0, 'results': [{'error': 'InvalidRegistration'}], 'topic_message_id': None} I want to know whether I am sending RegistrationId right or not. I am saving idToken from firebase of users, is it the registrationid or is it something else? -
How to find Only the logged in user content in django?
`class User(auth.models.User,auth.models.PermissionsMixin): def __str__(self): return '@{}'.format(self.username) class placement(models.Model): name=models.CharField(max_length=150, blank=True, null=True) ad_space=models.CharField(max_length=100, blank=False, null=False) PID_TYPE = ( ('FN','FORMAT_NATIVE'), ('FNB','FORMAT_NATIVE_BANNER'), ('FI','FORMAT_INTERSTITIAL'), ('FB','FORMAT_BANNER'), ('FMR','FORMAT_MEDIUM,RECT'), ('FRV','FORMAT_REWARDED_VIDEO'), ) format = models.CharField(max_length=3,choices = PID_TYPE,default = 'FN',blank=False, null=False) pid=models.CharField( max_length=50,default='',blank=False, null=False) cpm=models.IntegerField(default=0,blank=False, null=False) ADS_TYPE=( ('FB','FACEBOOK'), ('G','GOOGLE'), ) source=models.CharField(max_length=2,choices=ADS_TYPE,default='FB',blank=False, null=False) comments=models.TextField(default='',blank=False, null=False) objects=models.Manager() def __str__(self): return self.name def get_absolute_url(self): return reverse("dashapp:disp")` Now what should i do to only get only the logged in user content to be displayed on the template.As currently all the stored data is being fetched . That is logged out user for data is being displayed. I'm Basically a beginner so i dont have any advance idea about this. Full explanation are needed. -
Loop Through List in Django Template
I have a json file 'data' which is a list of dictionaries. One of the keys in every dictionary is 'title' whose value is a a list of titles. How do I display just the first 'title' in this list for every dictionary? The json is as follows: [{'title':['title1','title2,..],'other data':'xyz',...,}...{'title n':['title n1','title n2,..],'other data n1':'xyz n2',...,} This is my views.py: def bill_status(request): data = Status.objects.all() context = {'data':data} return render(request,'billstatus.html',context) In my template I am rendering this as: {% for datum in data %} <h3>{{datum.title}}</h3> {% endfor %} However, the output in html is the entire list for every dictionary: ['title1','title2,..] How do I just output 'title1' rather than the entire list? -
Django - Multiple user types management
I have three user types (differentiated with a non-null user_type field) inherited from the in-built User model. Should I supply a default value for user_type since the βcreatesuperuserβ command fails otherwise? Will this be a problem as by default, an adminβs user_type will be given but the is_superuser will still be False? An article suggested having all account types under the inherited User model. I have separate sign up pages. Should I have separate login pages too? Whatβs considered a good practice in the industry? Currently Iβm using βdomain//homeβ like URLs. I think urls like β.domain.comβ are much cleaner. How can this be implemented in django? P.s: Django 2.0, Python 3.6, A beginner. -
How to download a file when a django function is called by javascript instead of navigation to the url?
I have a page where several buttons process different functions like sending a sms (via API), sends a file by email, or downloads a PDF file. Button actions dont use forms, but uses ajax requests via javascript. I used to create a pdf file using javascript (jspdf), but have written code which generates a pdf file by python on the server. Now I need to allow download when the button is clicked. Server code snippet: with NamedTemporaryFile(mode='w+b') as temp: from django.http import FileResponse doc = SimpleDocTemplate(temp.name, pagesize=A4, rightMargin=20, leftMargin=20, topMargin=20, bottomMargin=20, allowSplitting=1, title="Prescription", author="MyOPIP.com") doc.build(elements) print(f'Generated {temp.name}') return FileResponse(open(temp.name, 'rb'), content_type='application/pdf') The above code is supposed to download a pdf file, if called by navigating to the url. On my javascript side, I tried to determine what I'm receiving: $.ajax({ url: `/clinic/${cliniclabel}/prescription/download/patient/${patient_id}`, dataType: "html", data: data, type: 'POST', success: function (data) { console.log("Received data from server..type is ", typeof(data)) console.log(data) } }); And I get: Received data from server..type is string userjs/main.js:2067 %PDF-1.4 %οΏ½οΏ½οΏ½οΏ½ ReportLab Generated PDF document http://www.reportlab.com 1 0 obj << /F1 2 0 R /F2 5 0 R >> endobj 2 0 obj.... Apparently django sends this as a file stream. How can I get the file β¦ -
Django with Channels 2.1.1 Error During WebSocket handshake 404
I am working on a project using Django and Channels 2.1.1. Everything is working splendidly on my home PC but when I deploy to AWS I get the error: 'WebSocket connection to 'ws://IP/ws/lobby/' failed: Error during WebSocket handshake: Unexpected response code: 404 ' which originates from the line in my HTML where I establish the chat socket : var chatSocket = new WebSocket( 'ws://' + window.location.host + '/ws/' + roomName + '/' ); I am using nginx and gunicorn to run my Django application on the host machine. When I went to the Channels 2 tutorial it has a section for testing communication between the channels layer and Redis using the Django Shell which I tested and works. My full code can be seen at https://github.com/Rob-Fox/Chat2 Thank you -
Django Order by on 'related_name' after filtering last record
This is how the sample model looks like models.py class Foo(models.Model): name = models.CharField(max_length=16) class Bar(models.Model): foo = models.ForeignKey(Foo, related_name="get_bars") name = models.CharField(max_length=16) timestamp = models.DateTimeField(auto_now_add=True) Sample Data hello_foo hello_bar Objective: Find all foos sorted by its timestamp in the last connected bar record. (foo is connected to bar with one to many relationship) What I tried I know how to filter foo based on bar foos = hello.models.Foo.objects.filter(get_bars__name="foo1-bar1") I can also order foo based on bar name foos = hello.models.Foo.objects.order_by("-get_bars__name") But how do I use this to perform order by on latest bar record? Sample plain SQL I would write it like this: select foo.name, bar.last_ts from hello_foo as foo inner join (select foo_id, max(timestamp) as last_ts from hello_bar group by foo_id) as bar on foo.id = bar.foo_id order by bar.last_ts desc I am using django 1.11 and python3 -
Why does Django add 'IS NOT NULL' to SQL clause?
I have model: class Profile: ... phone = models.CharField(max_length=50, blank=True, null=True) ... When I run queryset: Profile.objects.exclude(phone='', phone__isnull=True).values('phone') It create SQL code: SELECT "user_profile_profile"."phone" FROM "user_profile_profile" WHERE NOT ("user_profile_profile"."phone" IS NULL AND "user_profile_profile"."phone" = '' AND "user_profile_profile"."phone" IS NOT NULL); args=('',) And it is wrong because it return all phone include phone=None and phone=''. -
DJNAGO add spatial database postgred/postgis error
i try to add a postgresql/postgis in my django app without success. 1.i install GDAL via gohlke. 2.install psycopg2 3.install postgres/postgis database and create a new database if i try to use manage.py for migrate then show me error : django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal201", "gdal20", "gdal111", "gdal110", "gdal19"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings. ok i define in settings.py :GDAL_LIBRARY_PATH='C:/Python27/Lib/site-packages/osgeo' And now if i try to use again manage.py then i take this error : Failed to get real commands on module "un2": python process died with code 1: Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2017.1.5\helpers\pycharm\_jb_manage_tasks_provider.py", line 25, in <module> django.setup() File "C:\Python27\lib\site-packages\django\__init__.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Python27\lib\site-packages\django\apps\registry.py", line 108, in populate app_config.import_models() File "C:\Python27\lib\site-packages\django\apps\config.py", line 202, in import_models self.models_module = import_module(models_module_name) File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module __import__(name) File "C:\Python27\lib\site-packages\django\contrib\auth\models.py", line 4, in <module> from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager File "C:\Python27\lib\site-packages\django\contrib\auth\base_user.py", line 52, in <module> class AbstractBaseUser(models.Model): File "C:\Python27\lib\site-packages\django\db\models\base.py", line 124, in __new__ new_class.add_to_class('_meta', Options(meta, app_label)) File "C:\Python27\lib\site-packages\django\db\models\base.py", line 325, in add_to_class value.contribute_to_class(cls, name) File "C:\Python27\lib\site-packages\django\db\models\options.py", line 214, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) File "C:\Python27\lib\site-packages\django\db\__init__.py", line 33, in __getattr__ return getattr(connections[DEFAULT_DB_ALIAS], item) File β¦ -
Django admin page
I am relatively new to programming and would like to create a note sharing app with django. Is it possible to customize admin page for multiple type of users(super, regular, ordinary(read only) etc) and use it as a base for my application? and if yes, then how? -
how to pass many values through the same variable in Django template
I have a customized search form which has many inputs. Each input comes under specific category. This is about searching for a car. Hence, as a user, you can search for specific car condition, color, size and so on. each category(e.g condition) has many options that you can select from. You can select many conditions. The question is: How can I pass many values (e.g user can select car condition to be new, like new, good) through the same variable (e.g variable name is condition)? also, is it possible to pass all values from different category(e.g car condition, car color, car size) through only one variable(e.g variable name condition)? the last question: what is the best practice to do that? I mean assign each value to different variable or many values with the same category to the same variable or assign all values from different categories to only one variable, if this is possible how can many values be extracted in Django view function? for only one value it can be done by: condition = request.GET.get('condition') Here is portion of the form: <form method="GET" action="{% url 'some url' %}" data-action="" name="options_search" enctype="multipart/form-data" formnovalidate > <ul class="att-list"> <li class="checkbox "> <label> β¦ -
OpenCV Python, Django and HTML / HTML5?
I am a beginner in OpenCV, Python and Django. I have played around in webcam video capturing and saving the video using OpenCV and python. My question will be, and if someone can provide me simple illustration or code where I can integrate the video capturing and loading of the save video captured into a HTML or web page? I wanted this to be a webpage application where rendered via html or html5? Not sure if it make sense but will be like a dashboard where I can capture, and record the webcam video recordings. Or links to an example will be very helpful. Thanks guys! -
datetime.datetime.strptime('2018-12-16', "%Y-%m-%d").date() doesn't work in my Django query
I can get a queryset by executing on my python console: ClusterHosts.objects.filter(cluster=cluster_id). filter(create_date__gte=datetime.date.today()). filter(create_date__lte=datetime.date.today()). count() I get 49 as the result. But in my serializer I get passed a string for start_date and end_date which both equal '2018-12-16'. So I convert that string to a date like so: sd = datetime.datetime.strptime(start_date, '%Y-%m-%d').date() ed = datetime.datetime.strptime(end_date, '%Y-%m-%d').date() qs = ClusterHosts.objects.filter(cluster=cluster.id). filter(create_date__gte=sd). filter(create_date__lte=ed) But I get an empty query set. What am I doing wrong? -
Python/Django - How to annotate a QuerySet with a value determined by another query
Django 1.11, python 2.7, postgresql I have a set of models that look like this: class Book(Model): released_at=DateTimeField() class BookPrice(Model): price = DecimalField() created_at = DateTimeField() Assuming multiple entries for Book and BookPrice (created at different points in time), I want to get a QuerySet of Book annotated with the BookPrice.price value that was current at the time the Book was released. Something like: books = Book.objects.annotate( old_price=Subquery(BookPrice.objects.filter( created_at__lt=OuterRef('released_at') ) .order_by('created_at') .last() .price ) ) When I try something like this, I get an error: This queryset contains a reference to an outer query and may only be used in a subquery. I could get the data with a for loop easily enough, but I'm trying to prepare a large chunk of data for a CSV download and I don't want to iterate through every book if I can help it. -
How To? django model field whose value is a choice of a manytomany field of the same model
I have a django model called company with a manytomany field where company members are added. I have another field, called 'company_contact' where I want to be able to choose from one of the company_members as if it was a ForeingKey to company_members. Is there an easy way of doing this without customized forms, ajax request, django-autocomplete-light, etc? I intend to fill this model using django admin. Thanks class Dm_Company(models.Model): company_name = models.CharField(max_length=80, blank=True, verbose_name="Razon Social") company_members = models.ManyToManyField(conf_settings.AUTH_USER_MODEL, verbose_name="Miembros") #company_contact = models.ForeignKey(conf_settings.AUTH_USER_MODEL, related_name="company_members", on_delete=models.CASCADE) company_phone = models.CharField(max_length=80, blank=True, verbose_name="Telefono compania") company_email = models.CharField(max_length=80, blank=True, verbose_name="Email compania") -
Django ModuleNotFoundError: No module named 'ui'
I am trying to start up a very basic web app with Django and getting ModuleNotFoundError: No module named 'ui' My django project is frontend_project and the app is ui Tree: front_end βββ front-end/Pipfile βββ front-end/Pipfile.lock βββ front-end/README.md βββ front-end/db.sqlite3 βββ front-end/frontend_project β βββ front-end/frontend_project/__init__.py β βββ front-end/frontend_project/apps β β βββ front-end/frontend_project/apps/ui β β βββ front-end/frontend_project/apps/ui/__init__.py β β βββ front-end/frontend_project/apps/ui/admin.py β β βββ front-end/frontend_project/apps/ui/apps.py β β βββ front-end/frontend_project/apps/ui/migrations β β β βββ front-end/frontend_project/apps/ui/migrations/__init__.py β β βββ front-end/frontend_project/apps/ui/models.py β β βββ front-end/frontend_project/apps/ui/tests.py β β βββ front-end/frontend_project/apps/ui/urls.py β β βββ front-end/frontend_project/apps/ui/views.py β βββ front-end/frontend_project/settings.py β βββ front-end/frontend_project/urls.py β βββ front-end/frontend_project/wsgi.py βββ front-end/manage.py Installed_apps: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'ui.apps.UiConfig', ] And my frontend_project urls.py looks like: from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('ui.urls')), ] ui urls.py from django.urls import path from .views import homePageView urlpatterns = [ path('', homePageView, name='home'), ] I'm just trying to get a simple web app working for right now and my python version is 3.6.7 Thanks all! -
Django assertTemplateUsed fails after redirect
I am working on a Django 2.1 practice project. Last line of my test keeps failing. Is it true that assertTemplateUsed check won't work if redirection happens? Traceback (most recent call last): File "test_views.py", line 24, in test_home_page_not_login_redirect self.assertTemplateUsed(resp, 'users/home.html') File "testcases.py", line 554, in assertTemplateUsed self.fail(msg_prefix + "No templates used to render the response") AssertionError: No templates used to render the response test_views.py def test_home_page_not_login_redirect(self): resp = self.client.get('/') self.assertEqual(resp.status_code, 302) self.assertRedirects(resp, '/accounts/login/?next=/') self.assertTemplateUsed(resp, 'users/home.html') urls.py url(r'^login/$', auth_views.LoginView.as_view( template_name='users/login.html', redirect_authenticated_user=True), name='users_login'), settings.py LOGOUT_REDIRECT_URL = '/accounts/login/' -
The password is not encrypted at django admin login page
Hello I started using django framework recently. One thing that is bothering me is when I login from admin page. The password is being sent in plain text format without any encryption. Is it normal? IMHO shouldn't the password be encrypted before sent over network? -
django issue cant insert comment from url
I have been following django girls tutorial and I run into comment issue. I can add comment to the post from Admin interface but I cant add it from the form. Here is my model: class Comment(models.Model): post = models.ForeignKey('blog.Post', on_delete=models.CASCADE, related_name='comments') author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) #author = models.CharField(max_length=200) ctext = models.TextField() created_date = models.DateTimeField(default=timezone.now) approved_comment = models.BooleanField(default=False) def approve(self): self.approved_comment = True self.save() def __str__(self): return self.ctext Here is my form: class CommentForm(forms.ModelForm): class Meta: model = Comment fields = ('ctext',) And a view: def add_comment_to_post(request, pk): post = get_object_or_404(Post, pk=pk) if request.method == "POST": form = CommentForm(request.POST, instance=post) if form.is_valid(): comment = form.save(commit=False) comment.author = request.user comment.post = post comment.save() return redirect('post_detail', pk=post.pk) else: form = CommentForm() return render(request, 'blog/add_comment_to_post.html', {'form': form}) Any advice will be helpful. Thank you. -
Django related_name not querying the data in template
I have two models, Transaction and Subscription. Transaction has a FK to Subscription with the related name="subscription_transaction". I am trying to query the transaction.amount on a SubscriptionDetailView. Why is my template query not working. Neither work subscription_detail.html <td class="text-dark ">{{ subscription.subscription_transaction.timestamp.all }}</td <td class="text-dark"> {{ subscription.subscription_transaction.amount }}</td>` models.py class Subscription(models.Model): id = models.CharField(max_length=36, unique=True, default=uuid.uuid4, primary_key=True, editable=False) user_membership = models.ForeignKey(UserMembership, on_delete=models.CASCADE) stripe_subscription_id = models.CharField(max_length=40) active = models.BooleanField(default=True) def __str__(self): return self.user_membership.user.username @property def get_created_date(self): subscription = stripe.Subscription.retrieve(self.stripe_subscription_id) return datetime.fromtimestamp(subscription.created) @property def get_next_billing_date(self): subscription = stripe.Subscription.retrieve(self.stripe_subscription_id) return datetime.fromtimestamp(subscription.current_period_end) class Transaction(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="user_transaction") order_id = models.CharField(max_length=36, unique=True, default=uuid.uuid4, primary_key=True, editable=False) subscription = models.ForeignKey(Subscription, on_delete=models.SET_NULL, null=True, blank=True, related_name="subscription_transaction") amount = models.DecimalField(max_digits=100, decimal_places=2) success = models.BooleanField(default=True) timestamp = models.DateTimeField(auto_now_add=True, auto_now=False) -
Docker container set up for Django & VueJS
Good afternoon, I am looking for some guidance on where to concentrate my efforts. I keep getting off down these rabbit holes and cannot seem to find the path I am looking for. I have developed a couple small internal django apps but wish to integrate VueJS into the mix for more dynamic front end. My goals are: I want to use Django-restframework for the backend calls I want to use VueJS for the front end and make calls back to the REST API. I want all of this to live in Docker container(s) that I can sync using Jenkins. My questions / concerns: I keep trying to build a single docker container for both VueJS and Django but starting with either Node or Python, I seem to end up in dependency hell. Does anyone have a good reference link? I can't decide if I want it completely decoupled or to try to preserve some of the Django templates. The reason for the latter is that I don't want to lose the built in Django authentication. I am not skilled enough to write the whole authentication piece so I would rather not lose that already being done. If I am β¦ -
How can I use database information to map in Leaflet in the Django framework?
I have an issue with showing SQL query results in a Leaflet map (JavaScript) in the Django framework. I am attempting to (1) query a postgresql database then (2) use those results to plot geographic information on a map using the geoJSON format. This image shows how I am querying the data in my views.py file. My HTML document shows the following code: When I open my website, my map disappears as shown below. The map is supposed to be inside the dotted lines. Can anyone help me find what I am doing wrong? I have also included partial query results below: -
Celery task signal handler doesn't work with sender filter
I'm working on a project that uses Celery with Django. I have a celery task defined as follows @shared_task def some_task(): response = requests.post(some_url, data=some_data) if response.status == 400: raise Exception("Bad Request") In order to save the cases when bad requests occur, I've written a signal handler based on what I read here: http://docs.celeryproject.org/en/latest/userguide/signals.html @task_failure.connect(sender=some_task) def some_task_failure_handler(args=None, **kwargs): # Save to db However, this does not work for me. In order to get it to work, I end up having to remove the sender filter. @task_failure.connect def some_task_failure_handler(args=None, **kwargs): # Check for sender name here. if kwargs['sender'].name == 'proj.module.some_task': # Save to db I would expect to be able to connect to a specific sender rather than having to write a single handler for task_failure for all tasks. What am I doing wrong in the example where I specify the sender? -
Query set with Annotate using Concat is giving an error
I'm trying to use query set with Django, I want to have an id as month-day which I'm trying to use concat functions from django.models.function and gives me an error. My idea is basically to group by id( which month-day in string) and total cost. Any help will be greatly appreciated. qs=queryset.annotate(id=Concat(str(ExtractMonth('start_time')),Value('/'),str(ExtractDay('start_time')))).values('id','code')\ .annotate(total_cost=sum('total_cost')) Error: Cannot resolve keyword 'ExtractMonth(F(start_time))' into field. Choices are:x,y,z...