Re: Logs bloated by template variable not found in DEBUG level

2017-02-08 Thread Derek
If the variable does not exist at all (which is strange, because you should be passing in all the variables needed by the template, from the view that calls it), then the docs say: If you use a variable that doesn’t exist, the template system will insert the value of the TEMPLATE_STRING_IF_INVA

Re: No installed app with label 'province'.

2017-02-12 Thread Derek
Not preaching (as I often fall into this trap myself) but just copy&paste from others' examples, without understanding what is the intent of the code, can lead to problems. In this case, the docs are useful (for understanding how to construct the `app_label`, for example): https://docs.djangop

Re: Is it possible to save children before parents?

2017-02-12 Thread Derek
Mike Not sure I understand your scenario completely, but can you not just add a post-save trigger that updates the parent field (in which the total is saved) after all the other saves have happened? On Sunday, 12 February 2017 00:55:52 UTC+2, Mike Dewhirst wrote: > > A mixture has a number of

Re: set initial value for field when a model insert page loaded in django admin

2017-02-18 Thread Derek
I have cut and trimmed this from of some of my own code, so may not be 100%: class MyModelForm(ModelForm): class Meta: model = MyModel def __init__(self, *args, **kwargs): super(MyModelForm, self).__init__(*args, **kwargs) self.fields['my_field'].initial= 'some_va

Re: Tweaking the admin title to display the model name

2017-03-19 Thread Derek
Good point; with some work (e.g. adding actions), the admin can cover 80 to 90% of what most DB-focused projects will need - the django-suit interface also makes it look pretty slick! On Saturday, 18 March 2017 09:54:37 UTC+2, Andréas Kühne wrote: > > Yeah I know - the django admin platform is r

Re: GeoDjango

2017-03-20 Thread Derek
One option is to use Geoserver on the backend to manage your spatial data (in files or databases), and then to serve this via Django. See: https://www.youtube.com/watch?v=rU_Jh6RcY24 On Saturday, 18 March 2017 15:21:55 UTC+2, sbrunel62 wrote: > > Hello, > > I’m new on GeoDjango, I need to know

Re: Tweaking the admin title to display the model name

2017-03-21 Thread Derek
, > > Andréas > > 2017-03-20 7:39 GMT+01:00 Derek >: > >> Good point; with some work (e.g. adding actions), the admin can cover 80 >> to 90% of what most DB-focused projects will need - the django-suit >> interface also makes it look pretty slick! >> >&g

Re: GeoDjango

2017-03-25 Thread Derek
t; not much use. > > On Monday, 20 March 2017 13:07:10 UTC+5:30, Derek wrote: >> >> One option is to use Geoserver on the backend to manage your spatial data >> (in files or databases), and then to serve this via Django. >> >> See: >> https://www.youtube.

Re: what do i have to do first

2017-04-12 Thread Derek
If you're new to Python as well, you may need to look here first: https://www.python.org/about/gettingstarted/ (Django assumes some familiarity with the basics of Python) On Monday, 10 April 2017 16:17:19 UTC+2, Cyprus Carolyne wrote: > > I am new to this platform, anyone help me find out how t

Testing Django Admin with Selenium

2017-04-16 Thread Derek
Python 3.5; Django 1.10.7 I am struggling to get access to the admin pages via Selenium. I assume the issue is with the user login not being set properly - I don't want to go via the login page/form every time, so was attempting the session approach. Below is the code that shows the problem. Th

Re: How to set mysql database in setting up django setup in eclipse ?

2017-04-24 Thread Derek
I'd avoid a more complex tool like Eclipse when starting out - and try using a simple text editor like Atom or Sublime Text; that way you get a much more "hands on" understanding of Django. (Also - maybe don't MySQL when starting out & just stick to SQLite - its fine for learning purposes) On

Re: Split an existing app up into multiple apps.

2017-05-02 Thread Derek
There is a post on SO which seems to address this: http://stackoverflow.com/questions/42059381/django-migrate-change-of-app-name-active-project Maybe try renaming before you split; but moving models to a new app should be the same kind of process as renaming. On Monday, 1 May 2017 17:15:07 UTC+

Re: what on earth is this and how do I access 2 particular values to 2 keys

2017-05-16 Thread Derek
That does not appear to be a valid Python structure; I assume its generated by some third-party process - perhaps try and get it from them as a valid JSON file? On Monday, 15 May 2017 17:06:09 UTC+2, MikeKJ wrote: > > (cardInfo){ >ShellData = > (ShellData){ > availableShellAc

Re: Is an upgrade from 1.6 to 1.11 as complicated as migrating from 1.1 to 1.6?

2017-05-17 Thread Derek
What I found was that many third-party apps did not (yet) seem to support 1.11. So a move to 1.10 was most pragmatic for us, with the assumption that migrating to 1.11 would be straightforward in about a year or so. And, yes, work in Python 3 unless a very good reason not to. > Thanks Andr

Re: Database Routing

2017-05-18 Thread Derek
You'll need to post actual code and error stack traces if you want people to help. On Wednesday, 17 May 2017 15:08:55 UTC+2, Joe wrote: > > I am in the process of setting up a django server. I am trying to connect > our 4 legacy DBs to her. I have created a separate app for each DB, added > the

Re: import different entries using filter

2017-06-21 Thread Derek
Your clue is in the word "variable" that you used. The "variables" for a Django model are its fields; so what you are looking for is a value stored in your model's field. e.g. service = food.objects.get(restaurant-name__icontains='burger-place').values_list('type_of_service', flat=True) T

Help with styling: form for a many-to-many inline admin

2017-06-27 Thread Derek
s SampleAdmin(admin.ModelAdmin): # ... inlines = (SampleObjectiveInline, ) ​ The image (above) shows that the default text for the section name, as well as the labels, is not very user-friendly. How do I alter/overwrite these? Thanks Derek -- You received this message because you are subscribed to th

Re: Creating list of sub-objects where...

2017-07-02 Thread Derek
There is almost too much information here, but not enough actual details on your errors to help someone help you debug your logic. One thing I can suggest is that the admin functionality should look more like: class ExportFunction(admin.ModelAdmin): ... actions = ['export_all_as_yaml',

Re: How to create reusable components in django

2017-07-26 Thread Derek
You can include a template snippet into the body of the main template that is rendering your current view. That snippet in turn can either be passed data (such as a user count) from the view that calls the main template - see http://code.runnable.com/UpeQSkq7JxN6AANF/dynamic-content-in-a-templ

Re: How to insert a row in another table once a user is created

2017-08-12 Thread Derek
I am not exactly sure about your use case description, but it seems as if your EmailAddress table is incomplete - suggest: class EmailAddress(models.Model): user = models.OneToOneField(User, unique=True, related_name ='profile') verified = models.BooleanField(verbose_name=_('verified'), d

Re: How to save an invoice document with new record creation in the database

2017-08-16 Thread Derek
You may want to initiate the .docx creation via a trigger in the post_save function; see: https://docs.djangoproject.com/en/1.11/ref/signals/#post-save Also, I would move the "utility" code for creating the invoice number into a separate function, as its easier to test and (possibly) call from

Re: Polls tutorial suggested mysite/mysite/urls.py improvement

2017-08-26 Thread Derek
request? I may be speaking out of turn, as I am not a maintainer; but I am sure if you add the above explanation to your submission it will be favorably considered. Derek On Saturday, 26 August 2017 09:51:51 UTC+2, Mike Dewhirst wrote: > > A potential new Django user (a programmer of many d

Testing file upload via a form?

2017-08-29 Thread Derek
m = forms.RequestForm(data=data) self.assertTrue(form.is_valid()) The form validation fails i.e. it does not seem to recognise that file data has been suppplied. I have also tried with the "fake_file" for the data but without success. Any help or pointers appreciated. Thanks

Re: Testing file upload via a form?

2017-09-01 Thread Derek
the documentation of the test client > <https://docs.djangoproject.com/en/1.11/topics/testing/tools/#django.test.Client.post> > it > is all spelled out how to test file uploads. > ​ > ​ > > On Tue, Aug 29, 2017 at 8:48 PM, Derek wrote: > >> (Python 3.5 and Django 1

Re: Testing file upload via a form?

2017-09-01 Thread Derek
Thanks James, I will try that. On 1 September 2017 at 09:27, James Schneider wrote: > > > On Aug 29, 2017 11:49 AM, "Derek" wrote: > > (Python 3.5 and Django 1.10) > > I am trying to test a Django form that enables a required file upload. > > The form is

Re: Testing file upload via a form?

2017-09-01 Thread Derek
n. > > That said, James is right on the money with the payload. It doesn't > however tell you file uploads are going to work, only that a correctly > bound file passes validation. > > > On Fri, Sep 1, 2017 at 9:07 AM, Derek wrote: > > Thanks Melvyn > > &

Re: Testing file upload via a form?

2017-09-03 Thread Derek
ke trivial knowledge to people who have already done all this, but I struggle to see the full picture of what a whole test suite should look like, and what the details of all the tests would be. On 3 September 2017 at 09:07, James Schneider wrote: > > > On Sep 1, 2017 3:00 PM, "D

Re: How to pre-load model data?

2017-09-09 Thread Derek
"If you dump data directly in to models or the database, then you risk dumping in data that hasn't been evaluated by your application which may produce subtle bugs of the worst kind where things work in dev and break in prod because your input channel is different." If this is happening its bec

Re: Testing file upload via a form?

2017-09-10 Thread Derek
rieved and passed on to a processing method, and then the flow redirected to the right URL. I have got hung up on the "mechanics" of form testing instead of seeing that they only play a small role in the project. I will however, persist until I get the grammar correct. Derek On 3 Sep

Re: changing row color in django admin model

2017-09-12 Thread Derek
If you use django-suit as a custom (and much upgraded!) admin interface, this facility is built-in. See http://djangosuit.com/ and look for the section "List row and cell attributes" On Tuesday, 12 September 2017 08:54:01 UTC+2, vishnu bhand wrote: > > hello ,How should i change entire row col

Re: Problem testing user is None when extending auth backend.

2017-09-28 Thread Derek
Note that user.is_authenticated() has become user.is_authenticated in Django 1.10 Otherwise if user is really (or could really) be None, then try... except may be better: try: if user.is_authenticated() and user.is_staff: do something else: do something else except

Re: Add value to database without using forms in django

2017-09-30 Thread Derek
Yes, its a strange question. You can of course always add a new method to the City class: class City(models.Model): ... def get_cities(self): return ''.join([self.city1, self.city2, self.city3, self.city4, self.city5])) and then store those in Name; but from a design POV, proba

Re: Bulk update instances to different values

2017-10-05 Thread Derek
ttps://github.com/saxix/django-adminactions This app allows for what is termed "mass updates". On Thursday, 5 October 2017 05:50:45 UTC+2, David Foster wrote: > > I would like to update many model instances at a time in the database. > > If I could select all such instances using a single query a

Re: Can I use Django for client-server communication ?

2020-04-24 Thread Derek
Its unclear what you are trying to achieve; in a client-server architecture, the clients will call the server, which in turn may start up processes on their behalf and return responses to them. The reverse is not true. A server cannot install or startup up processes on independent client machi

Re: Django Admin Custom View Query Generation

2020-04-27 Thread Derek
ttons" (aka clickable links) to Django and Django admin. There are many places in Django you can add such features. On Sunday, 26 April 2020 19:42:40 UTC+2, Ram wrote: > > Hello Derek, > > Thanks for providing good references for Django Admin Customization. I'm > look

Re: Question regarding Interactive Python shell response and django

2020-04-27 Thread Derek
I think you are better off creating a proper API for your Django project, using something like DRF. The Django shell is meant for direct use by an administrator working on the server. On Sunday, 26 April 2020 16:05:02 UTC+2, Michael Karikari wrote: > > So I find myself in a pickle. > I'm using

Re: Question regarding Interactive Python shell response and django

2020-04-30 Thread Derek
s from shell, so I was trying to work around that fact >> >> On Monday, April 27, 2020 at 10:51:10 AM UTC-4, Derek wrote: >>> >>> I think you are better off creating a proper API for your Django >>> project, using something like DRF. >>> >>>

Re: How to omit Admin field verbose name

2020-05-07 Thread Derek
I do something similar but not exactly the same. Perhaps like this (WARNING: untested code) under the class MyModelAdmin: def get_form(self, request, obj=None, **kwargs): form = super(MyModelAdminForm, self).get_form(request, obj, **kwargs) if form.base_fields: f

Re: Create a function which fill automatically a field in my models

2020-05-07 Thread Derek
Its unclear what you mean by "last ID" - and I cannot see the value of storing such as they are available in the database... But have a look at https://stackoverflow.com/questions/12649659/how-to-set-a-django-model-fields-default-value-to-a-function-call-callable-e The example is: from datet

Re: How to push data fetched from excel to DB using Django?

2020-05-08 Thread Derek
If you can, use an existing app: https://github.com/wq/django-data-wizard On Friday, 8 May 2020 14:57:43 UTC+2, Kasper Laudrup wrote: > > Hi Ratnadeep, > > On 08/05/2020 14.03, ratnadeep ray wrote: > > Hi all, > > > > Can anyone let me know how to push the fetched data from an excel to any

Re: Getting a error

2020-05-08 Thread Derek
Hi Ravi You have typed: $pip --version It should be: pip --version When blogs or manuals use the $ sign, its usually to indicate the last character of the command prompt often seen on a Linux machine e.g. user@machine:/path/to/current/directory$ (so for a shortcut people just write $) HT

Re: Can I use a JS Framework to display small JS tasks in a Django project?

2020-05-13 Thread Derek
Its not clear why you need JS at all. The app can load content from directories on the server side (back-end) and write these to a DB. Django could then load these from the DB and show in the normal way. Page generation can be done via normal views (Django/Python code). (PS Both react and ang

Re: Django Model

2020-05-14 Thread Derek
>>> from django.apps import apps >>> apps.all_models['app_name'] So if your app is called, for example, products, then: >>> apps.all_models['products'] Will create a dictionary with all the model classes from that app. On Thursday, 14 May 2020 14:03:40 UTC+2, muazzem_ hossain wrote: > > how to

Re: HOW TO PROTECT SOURCE CODE DEPLOYED TO A REMOTE SERVER

2020-05-19 Thread Derek
Yes - short answer is you cannot really "protect" Python code directly (see: https://python-compiler.com/post/how-to-distribute-python-program ) Long answer - don't sell your code to anyone that you do not trust with it. Obviously, there is a legal route, but there is also the "name and shame

Re: HOW TO PROTECT SOURCE CODE DEPLOYED TO A REMOTE SERVER

2020-05-21 Thread Derek
No; a container is not going to hep with this - see: https://stackoverflow.com/questions/51574618/preventing-access-to-code-inside-of-a-docker-container (they specifically mention Python in the answer). On Wednesday, 20 May 2020 17:20:24 UTC+2, James Shen wrote: > > try to deploy using a container

Re: Database audit fields in Django

2020-05-24 Thread Derek
There are many things available "by default" in other frameworks; but Django has chose to keep the core focused on doing key things well (I won't say "simple"). For everything else, the plugin/app approach can be used to support your project's specific needs. So "auditing" is actually a comple

Re: JSON file

2020-05-24 Thread Derek
I am not sure about the field names part, but you could probably create that manually very easily. For the data section, you need a list of lists, which you can get from code like: import json data_ready_for_json = list(mail_item_count_deliveries_perDate.objects.values_list('countDeliveries','

Re: function model which generate a code for model field

2020-05-26 Thread Derek
Its not clear what you mean by "last"; do you mean a record that already exists in the database and has a ID value - or do you want the ID of the current record? Either way, the code field should not be resetting the '0' to a '1' as this is then misrepresenting the actual data. PS The logic to

Re: Regarding redering data in html templates

2020-05-27 Thread Derek
Lots of examples out there, but here is one: https://www.gun.io/blog/how-to-list-items-in-a-dictionary-in-a-django-template For working with static files (such as CSS or images), have a look at: https://scotch.io/tutorials/working-with-django-templates-static-files On Monday, 25 May 2020 17:06:

Re: Can we use python related api's on the Django templates ?

2020-05-27 Thread Derek
While you cannot use Python operators and functions directly in the templates, you can write your own "wrappers" around those you need: https://docs.djangoproject.com/en/3.0/howto/custom-template-tags/ On Wednesday, 27 May 2020 15:57:34 UTC+2, Daniel Roseman wrote: > > On Wednesday, 27 May 2020

Re: function model which generate a code for model field

2020-05-28 Thread Derek
The suggested code will not work because, at this point, the "id" has not yet been generated by the database (unlike the other data which is typically entered by the user). You will need to move this code to a post_save signal function - https://docs.djangoproject.com/en/3.0/ref/signals/#post-s

Re: function model which generate a code for model field

2020-05-29 Thread Derek
I would not assume what "previous" means. Rather use post_save to get the actual ID of the current recording. On Friday, 29 May 2020 12:43:19 UTC+2, Anselme SERI wrote: > > Hello Derek, > Is it possible to retrieve the id of the previous recording from this > functio

Re: Need Dashboard in Django Admin only

2020-05-31 Thread Derek
There are numerous ways to design a front-end dashboard; this a highly contested domain on the web! Just some examples, using Django + various other tech are: * https://www.highcharts.com/blog/tutorials/create-a-dashboard-using-highcharts-and-django/ * https://dreisbach.us/articles/building-d

Re: Need Dashboard in Django Admin only

2020-05-31 Thread Derek
PS - Should be "Django REST Framework" ( https://github.com/encode/django-rest-framework ) PPS - Please don't use pie charts, especially 3D, for your visuals ( https://www.businessinsider.com/pie-charts-are-the-worst-2013-6?IR=T ) On Sunday, 31 May 2020 17:05:16 UTC+2, Derek w

Re: Getting exception while importing data though Django Admin

2020-06-25 Thread Derek
This seems to be an error raised by a third-party library; you'd probably get a quicker / better response by contacting their devs. On Thursday, 25 June 2020 00:25:18 UTC+2, Sasi Tiru wrote: > > Exception: > > \lib\site-packages\import_export\resources.py", line 581, in import_data > raise Im

Re: Suggestions Front tool

2020-07-07 Thread Derek
You are better off using Django for what is it designed for - web-based systems - and rather use other Python alternatives for desktop-based GUIs e.g. pyQT (see various resources such as https://blog.resellerclub.com/the-6-best-python-gui-frameworks-for-developers/ ) On Tuesday, 7 July 2020 14

Re: Suggestions Front tool

2020-07-08 Thread Derek
cribed (but not because of the GUI aspect). On Wednesday, 8 July 2020 13:59:46 UTC+2, kishore wrote: > > Hi Derek, > > thanks a lot for the suggestion, but i would not get good GUI in terms of > theme, buttons, and give the colors for specific verdicts. > and in future i might hav

Re: My first question

2020-07-19 Thread Derek
This would make a great blog post! And in future, we can all refer directly to it, when someone asks a similar question. On Saturday, 18 July 2020 16:13:53 UTC+2, Liu Zheng wrote: > > Hi. Doesn't sound like a Django question, but I assume you came across > this question when writing Django code

Re: Intensive access and modification of database table

2020-07-19 Thread Derek
s..."). You can use product ID as the key, linked to a pair of "current DB available; current total In-carts" values. This would make lookups quick and you only need DB access/change when, as you say, an actual transaction is concluded. This is just a possibility; and one of many

Re: Admin list sorting problem

2020-07-30 Thread Derek
ame(self): return '%s' % self.name _name.admin_order_field = 'display_name' In the Admin, only show "_name" and not "sort_name" or "name". HTH Derek On Thursday, 30 July 2020 08:51:01 UTC+2, Mike Dewhirst wrote: > > I have looked closely

Re: Admin list sorting problem

2020-07-30 Thread Derek
Apologies for lack of proof reading; the example code should be: def _name(self): return '%s' % self.name _name.admin_order_field = 'sort_name' On Friday, 31 July 2020 08:21:45 UTC+2, Derek wrote: > > I've had to do something similar to handle sp

Re: Need the create statements for my Django models

2020-08-11 Thread Derek
"I was recently porting a legacy DB to Django by using the inspectdb command" - is there any reason why you cannot just stop here? Why do you think the "inspectdb" would fail? I would just go on creating the app and if any issues arise, I'd look at the specific model and see if it is because

Re: Check out what we've build

2015-08-07 Thread Derek
Your $20 plan says: * Unlimited backups * Your AWS storage * 3 licenses Is that unlimited backups from multiple servers; or do you need a license/server? If not, what are the licenses for? On Wednesday, 5 August 2015 23:36:14 UTC+2, Tom Cooper wrote: > > Hey, guys > > Our team is using Django

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread Derek
This Python wiki (https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Choose_the_Right_Data_Structure) suggests: * Membership testing with sets and dictionaries is much faster, O(1), than searching sequences, O(n). When testing "a in b", b should be a set or dictionary instead of a list

Re: Learning Python and Django and should I?? (I have a year of 10 or so hours a week)

2015-08-15 Thread Derek
I was only ever briefly a PHP user (came to Python from 8 years of using Java/Cocoon) so I cannot speak to that. I did also have to use Ruby for a short project, but found the syntax non-intuitive. Obviously on this list we are biased toward Python/Django - but I would say its worth the time

Re: Electronic Notebook (ELN)

2015-09-03 Thread Derek
On Thursday, 3 September 2015 15:57:49 UTC+2, Cowdawg wrote: > > On Wed, Sep 02, 2015 at 07:39:14PM -0700, Aref wrote: > > I am looking for an electronic notebook for general engineering notes. > It > > seems that this would be a good candidate application for Django. Does > > > You might want

Re: Dynamically alter a list based on selections on other widgets

2015-09-10 Thread Derek
Try using Django smart selects: https://pypi.python.org/pypi/django-smart-selects/1.1.1 On Tuesday, 8 September 2015 18:45:07 UTC+2, Baktha Muralidharan wrote: > > Hello > > I am looking to develop a GUI (Form?) in which I can display a list the > contents of which change on the fly as the user

Re: Any good tutorials for django-rest-framework and React.Js?

2015-09-11 Thread Derek
I am curious - in a previous thread, many respondents pointed out Angular as being a good framework to use, and one poster said "a quick Google search shows that React is barely supported yet (in terms of available Django apps)" - so why are you choosing that route? Given you already said "I a

Re: Django admin suitable for external users?

2015-09-28 Thread Derek
I'd say for non-technical users, you may want something custom; particularly if they are only working with a smaller sub-set of the data. We have users that are fairy technical (working in the science domain) that are used to large grid-like data displays (typically in spreadsheets). So, for t

Re: Django admin suitable for external users?

2015-10-06 Thread Derek
What is the difference between a customer and client - I assume the former is paying? On Monday, 5 October 2015 22:12:14 UTC+2, ta...@pingmd.com wrote: > > Has anyone opened Django admin to customers, not just clients? If so, what > warranted such decision as appose to only exposing partial func

Re: Using Django and R in a production environment?

2015-10-06 Thread Derek
: > > Hi Derek, > > Did you find the solution to your problem? > I ran to a similar issue. I am wondering if RServe will work for me. > > > On Tuesday, April 30, 2013 at 12:40:01 PM UTC-7, Derek wrote: >> >> Thanks Nick; RStudio looks like a really good tool for de

Re: Django admin suitable for external users?

2015-10-09 Thread Derek
(with some user-friendly tweaking) can be used. I am also assuming that, in all likelihood, that other tools such as queries, data capture and visualisation tools will be built as is appropriate. On Tuesday, 6 October 2015 17:29:14 UTC+2, ta...@pingmd.com wrote: > > Derek, my distinctio

Re: Django admin add related object doesn't open popup window?

2015-10-23 Thread Derek
Disable the popup ... a suggestion was made in https://code.djangoproject.com/ticket/9071 which is: class ProductAdmin(ModelAdmin): def get_form(self, request, obj=None, **kwargs): """ Don't allow adding new Product Categories """ form = super(ProductAdmin, s

Re: Django admin multipleselect filter

2015-11-04 Thread Derek
This project does not seem active, but maybe you could still make use of it: https://github.com/kevwilde/django-adminfilters Otherwise some other suggestions: http://stackoverflow.com/questions/7834990/selecting-multiples-choices-in-django-admin-filter-list-filter On Monday, 2 November 2015 16

Re: How to clean up character database fields with leading and trailing spaces

2015-11-04 Thread Derek
Lots of ideas here: http://stackoverflow.com/questions/5043012/django-trim-whitespaces-from-charfield On Tuesday, 3 November 2015 16:31:26 UTC+2, DJ-Tom wrote: > > > It worked! Basically it was a one-liner as well :-) > > > -- You received this message because you are subscribed to the Google

Re: Need a Tutorial

2015-12-06 Thread Derek
http://learnpythonthehardway.org/book/ is also available for free online; I second Andrew's recommendation of it... On Saturday, 5 December 2015 18:43:58 UTC+2, Andrew Farrell wrote: > > Python tutorials: > The tutorial I first learned python from was Think Python >

Re: a bug in model.Manager.values_list?

2015-12-12 Thread Derek
"Its not a bug, its a feature." See: https://docs.djangoproject.com/en/1.9/ref/models/querysets/#when-querysets-are-evaluated If you were designing Django's internals, you might have decided that the Queryset "should behave" in a certain way, but the designers have chosen this approach. There

Re: Customizing Admin Layout and templates

2015-12-17 Thread Derek
You are better off not trying to change the admin; rather write your own templates and views which can customised to create the exact layout you want. Admin is really designed to be used "as is" and populate the "back end data" of your application. On Tuesday, 15 December 2015 21:05:31 UTC+2,

Delete confirmation page in Django admin not displaying child records

2015-12-31 Thread Derek
, because it was part of Django, I would not need tests for this.) Any ideas why this happening and how to "revert" to the expected behaviour? Thanks Derek -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Is it a bad idea to start a project using Django 1.7 at this moment?

2016-01-03 Thread Derek
"Explaining everything" is too much of a generalisation to be a useful criticism. Django has been built incrementally, with a high degree of backwards-compatibility, so many older tutorials will still be valid. The docs are *always* up-to-date and highlight clearly where new features have bee

Re: How to show a list of products as checkboxes?

2016-01-07 Thread Derek
You may want to look at Django crispy forms as a way to simplify form creation and layout; For example, handling of checkboxes: http://django-crispy-forms.readthedocs.org/en/latest/layouts.html#bootstrap-layout-objects On Wednesday, 6 January 2016 06:39:31 UTC+2, Michael Molloy wrote: > > My

Re: excel file upload to MySQL database

2016-01-18 Thread Derek
You could also try: https://django-import-export.readthedocs.org/en/latest/ On Wednesday, 13 January 2016 16:30:04 UTC+2, girija sameera wrote: > > Hello, > I am a Django beginner working on a web application wherein I am > required to provide back-end support. I am expected to take an excel

Re: Code organisation

2016-01-23 Thread Derek
Utilities app is the way to go - and attach ALL business logic to your models; this will save you headaches in the long run... On Friday, 22 January 2016 23:06:44 UTC+2, Benj wrote: > > Yes, I didn't thought about creating a whole app for utilities, but it is > indeed the way to go. Tks > > On F

Re: How to write Scripts

2016-02-01 Thread Derek
Here's a good introduction: http://www.tutorialspoint.com/python/python_database_access.htm On Monday, 1 February 2016 14:22:05 UTC+2, Rajkumar P wrote: > > how to write python scripts for storing external database > -- You received this message because you are subscribed to the Google Groups "

Re: How to show python data on html

2016-02-08 Thread Derek
Depending on what your console app does or needs to do, you can also look at Flask as a way of serving up HTML pages to your browser; see http://flask.pocoo.org/docs/0.10/quickstart/ - you then do not have to use a database with models if those are not needed. Django is great but not always a

Re: How to use selenium automated testing in django projects

2016-02-28 Thread Derek
I would separate out the two kinds of testing; one test to check the form functionality (and you do not have to use Selenium for this, btw); and one test to simulate how the Excel file is processed once it is loaded. For testing Excel, we use pre-created sheets with known, fixed data and test

Re: Integrate appliction into Django

2016-02-28 Thread Derek
In addition, I am not sure you have to use Django here; a simpler Python web-framework like Flask might be more suited (there you don't have to have models; just views). You could write a view that loads the text file and converts it (via a jinja template) into an HTML table, for example. Th

Re: Development of web based image processing package

2016-03-05 Thread Derek
Hi Please realise that satellite image processing and analysis is a whole specialised field on its own; relying on the user's deep understanding of how and why the image was created, and also assumes they already are well-trained and experienced in all things geospatial. Having said that, if y

Re: Python on the web

2016-03-11 Thread Derek
Do you offer a discount because its not PEP-8 compliant ;) On Wednesday, 9 March 2016 19:25:22 UTC+2, Mario R. Osorio wrote: > > There you are: http://hlevkin.com/Shell_progr/hellopython.htm > > Please send the $20 to my paypal account... > > On Monday, March 7, 2016 at 10:51:53 AM UTC-5, Gregg Tu

Re: Design hints for a sanity checker

2016-04-15 Thread Derek
You probably want to use Celery for asynchronous processing e.g. see http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html (plus a TON on material on the web...). PS We welcome all refugees from the "static-only-HTML" 1990's here ;) On Friday, 15 April 2016 14:23:51 UTC+2,

Re: How to customizing CSS in djangocms-table

2016-04-16 Thread Derek
Is this project being maintained; looks like last change was nearly a year ago..? On Friday, 15 April 2016 20:18:51 UTC+2, Régis Silva wrote: > > I use djangocms-table . And > this plugin return > > > Tabela exemplo > > >

Error with urlresolvers.reverse when running tests for admin

2016-04-16 Thread Derek
v/tests/trees/test_admin_fail.py", line 7, in test_action_tree_mark_dead change_url = reverse('admin:trees_alivetrees_changelist') File "/.virtualenvs/s2/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 536, in reverse return iri_to_uri(resolver._r

Help with testing of custom Django admin actions

2016-04-21 Thread Derek
seful Pointers appreciated. Thanks Derek -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, se

Re: Queryset calculation and then filter/exclude/limit data rendered

2018-06-29 Thread Derek
Its not completely clear what you are doing. You need to avoid logic in your template; but you say "excluding data from the the queryset in the for loop which is easy in other languages, but this also seemed to be a no go". That is not the case if your logic is written in the correct way. In

Using multiple keyword arguments with reverse()

2018-07-08 Thread Derek
turn view_func(request, *args, **kwargs) shows that the kwargs now only holds: {'view': 'site'} (for reference, the browser address shows: http://127.0.0.1:8000/uploads/details/site/3 ) I am not sure how to pass through both keyword arguments in a way that Django retai

Re: Using multiple keyword arguments with reverse()

2018-07-08 Thread Derek
Hi I am not quite sure what you are suggesting? Do you think the url() in the urlpatterns should be changed - I have not seen a format like that? Perhaps you can give an example as it relates to the code I posted. Thanks Derek On Sunday, 8 July 2018 16:10:22 UTC+2, mottaz hejaze wrote

Re: Using multiple keyword arguments with reverse()

2018-07-09 Thread Derek
Thanks Melvyn The call to reverse() *was* included in my original code snippets: see below. > return HttpResponseRedirect( > reverse('uploads:upload_details', > kwargs={'view': view, 'mid':result.pk}) And that call does not wo

Re: Upgrading Django

2018-07-13 Thread Derek
See: https://docs.djangoproject.com/en/1.10/ref/templates/upgrading/ On Friday, 13 July 2018 14:36:52 UTC+2, Ghiath ghanem wrote: > > I'm working on small project, (Automatic Calender for the near future > events from Tweets). > I have upgraded to Python 3.4.3, and Now i would like to upgrade D

Re: How to verify if is new record or update record on django template?

2018-07-13 Thread Derek
You can pass in the ID (primary key) of the object from the view to the template. On Thursday, 12 July 2018 15:58:45 UTC+2, Fellipe Henrique wrote: > > How to verify if is new record or update record on django template? How > can i do that? > > Thanks! > > -- You received this message because

Re: App structure : "One file - One object" - Is there a better way ?

2018-07-14 Thread Derek
you do this. YMMV. Derek On Sat, 14 Jul 2018 at 16:59, Mickael Barbo wrote: > Hi Anthony 😊 > > Thanks for sharing your experience. > > "1 file one object doesn't mean what you think it means." > > I hope you get the meaning I described 😉 > > &qu

<    2   3   4   5   6   7   8   9   10   >