Re: Still having trouble with django-filebrowser

2017-12-17 Thread Mike Dewhirst
Mike On 18/12/2017 11:35 AM, Mike Dewhirst wrote: On 18/12/2017 9:28 AM, Etienne Robillard wrote: Hi Mike, What Django version are you using? Is this happening with Python 2 or 3? Sorry Etienne. Should have mentioned that. Python 3.6 but it also needs to work with Py27 Django 1.11.8 Ha

Re: Still having trouble with django-filebrowser

2017-12-18 Thread Mike Dewhirst
How can I test for valid html? View source and inspect it manually? Which I just did and it looks ok. Thanks for sticking with this. I appreciate it. It is bedtime here. Cheers Mike HTH Etienne Le 2017-12-17 à 22:06, Mike Dewhirst a écrit : This time with version 3.9.2 having climbed a lit

Re: Still having trouble with django-filebrowser

2017-12-18 Thread Mike Dewhirst
I'm confused whether it is a constraint to keep the uploader confined on the source machine or perhaps the area for upload storage on the web server - which would be a download - and anyway that is the MEDIA_ROOT I suspect. Thanks Mike On 18/12/2017 11:26 PM, Mike Dewhirst wrote: On 18/12

Re: Still having trouble with django-filebrowser

2017-12-28 Thread Mike Dewhirst
g I'm doing somewhere which is causing it. Thank you very much for responding. I reckon it sometimes makes the difference between giving up (well, working around) and persisting. Cheers Mike On 18/12/2017 11:26 PM, Mike Dewhirst wrote: On 18/12/2017 8:23 PM, Etienne Robillard wrote: L

Re: Still having trouble with django-filebrowser

2017-12-28 Thread Mike Dewhirst
On 29/12/2017 3:08 PM, James Schneider wrote: However, the same treatment fails on my Windows runserver dev platform. Brand new virtualenv for Py27 and Py36 still fail to show the little browse link on the right-hand end of the Source field. Have you verified that your Windows vir

Re: Still having trouble with django-filebrowser

2017-12-29 Thread Mike Dewhirst
On 18/12/2017 8:23 PM, Etienne Robillard wrote: Looks likes this is using javascript. What does the javascript console says? Is the markup of the page valid HTML? The javascript is slightly different between dev on localhost and staging and I'm totally outta my depth :( In the section of

Re: Still having trouble with django-filebrowser

2017-12-29 Thread Mike Dewhirst
regards, Etienne Le 2017-12-29 à 17:30, Mike Dewhirst a écrit : On 18/12/2017 8:23 PM, Etienne Robillard wrote: Looks likes this is using javascript. What does the javascript console says? Is the markup of the page valid HTML? The javascript is slightly different between dev on localhost and

Re: Django: text, font, and style

2018-01-01 Thread Mike Dewhirst
On 2/01/2018 10:01 AM, Malik Rumi wrote: I even tried putting this at the top of my detail template, inside {& block content %}:         p }
p {

Admin case-insensitive sorting question

2018-01-09 Thread Mike Dewhirst
I have tried every which way to produce a case-insenstive list of substances in the Admin including this: def get_queryset(self, request):     return super(SubstanceAdmin, self).get_queryset(request).order_by(Lower('name').asc()) Which DOES work (as proven via print statement) but doesn't dis

Re: Handling secret keys in digitalocean

2018-01-10 Thread Mike Dewhirst
My requirements are to keep sensitive items out of the repositories and that means out of settings. I keep a separate directory structure for settings as recommended in 2 Scoops. That means the code in my project has to detect which site it is running on (local, staging or production) and then

Re: Admin case-insensitive sorting question

2018-01-10 Thread Mike Dewhirst
mailto:django-users@googlegroups.com] On Behalf Of Mike Dewhirst Sent: Wednesday, January 10, 2018 1:03 AM To: Django users Subject: Admin case-insensitive sorting question I have tried every which way to produce a case-insenstive list of substances in the Admin including this: def get_que

Re: Admin case-insensitive sorting question

2018-01-10 Thread Mike Dewhirst
On 11/01/2018 10:53 AM, Mike Dewhirst wrote: On 11/01/2018 1:22 AM, Matthew Pava wrote: If I'm understanding you correctly, you could use a callable in the list_display definition. That is what I'm doing. Unfortunately a callable for a list_display column prevents sorting the li

Re: I plan to have lots of data tables with similar structure. How do you recommend I model them?

2018-01-10 Thread Mike Dewhirst
On 11/01/2018 12:20 PM, Tom Tanner wrote: Hey everyone, I have a bunch of text files that each have a bunch of columns in common. I plan to import these files into PostgreSQL tables. The website user will be able to send a GET request to query a table and get back data from it. Since most of

Re: Asynchoronous programming and websockets support

2018-01-11 Thread Mike Dewhirst
On 12/01/2018 11:05 AM, muratsert1...@gmail.com wrote: Hello Django community, This is my first post so forgive me if this is out of context or have been discussed already. I've been working with Django for many years and although have the neccesary experience with Javascript I don't want to

Re: How do I exactly change from SQLite to MySQL ?

2018-01-15 Thread Mike Dewhirst
Since no-one has suggested avoiding MySQL I should say that I have a few small websites and every time I check the logs they are full of uglies trying to access phpmyadmin. Every time I see that I'm glad I went for PostgreSQL. From my research it seems Postgres is probably the best option for

javascript transpilers

2018-01-27 Thread Mike Dewhirst
I have avoided javascript like the plague. However it seems I have to bite the bullet. Interestingly, there are now a number of Python -> Javascript transpilers. http://stromberg.dnsalias.org/~strombrg/pybrowser/python-browser.html Where would be a good place to start a discussion on the topic

Re: javascript transpilers

2018-01-28 Thread Mike Dewhirst
; wrote: Hi, You don't describe to what extent you need to use JavaScript - IOW, what problem you need to solve with JavaScript? Depending you needs you might get away with basic knowledge and usage of some helpful JavaScript library/framework.

Re: javascript transpilers

2018-01-29 Thread Mike Dewhirst
r using that would be a large user base, so you can get help. The python transpiled JS versions don't really have the greatest user base :-) Regards, Andréas 2018-01-29 0:00 GMT+01:00 Mike Dewhirst mailto:mi...@dewhirst.com.au>>: That seems unanimous :(

Re: javascript transpilers

2018-01-31 Thread Mike Dewhirst
On 30/01/2018 6:33 PM, Andréas Kühne wrote: 2018-01-30 5:18 GMT+01:00 Mike Dewhirst <mailto:mi...@dewhirst.com.au>>: On 29/01/2018 9:03 PM, Nick Sarbicki wrote: Going SPA when you don't know JS is very much a baptism of fire. Angular is personally my fav

Re: javascript transpilers

2018-01-31 Thread Mike Dewhirst
to:django-users@googlegroups.com] On Behalf Of Mike Dewhirst Sent: Wednesday, January 31, 2018 4:29 PM To: django-users@googlegroups.com Subject: Re: javascript transpilers On 30/01/2018 6:33 PM, Andréas Kühne wrote: 2018-01-30 5:18 GMT+01:00 Mike Dewhirst mailto:mi...@dewhirst.com.au>>: On 29/

Re: javascript transpilers

2018-02-01 Thread Mike Dewhirst
On 30/01/2018 6:33 PM, Andréas Kühne wrote: If you are using django in the "normal" way - you should just be able to add the message to the messages contrib package. Then the message should show when saving? Because when you click on the save button you should post your form and that method sho

Re: javascript transpilers

2018-02-01 Thread Mike Dewhirst
On 2/02/2018 12:54 AM, Jason wrote: https://caniuse.com/#feat=wasm  IIRC wasm is not polyfillable or transpilable, so if you're targeting users on any of those red cells, then wasm is not for you. Agreed. I think it is interesting anyway but I already decided it is not within my event horiz

Re: In the Admin, Is it possible to make filters on foreign keys usable with lots of related objects?

2018-02-02 Thread Mike Dewhirst
On 3/02/2018 5:23 AM, Paul Tiplady wrote: Currently it's simple to configure a filter on a foreign key in the admin: `list_filter = ['theforeignkeyfield']` However in practice this is barely usable in most cases that I've encountered, since the admin uses RelatedFieldListFilter, which fetche

Re: javascript transpilers

2018-02-05 Thread Mike Dewhirst
Much appreciated. I'll definitely take your advice. Cheers M On 6/02/2018 2:26 AM, Matemática A3K wrote: On Thu, Feb 1, 2018 at 8:27 PM, Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: On 2/02/2018 12:54 AM, Jason wrote: https://caniuse.com/#feat=wasm

chemistry character set

2018-02-05 Thread Mike Dewhirst
Chemical names start with both upper and lower case as well as Greek characters. Chemical names also exist in multiple non-western non-latin languages. To get lists of chemicals sorting more or less "correctly" I currently slugify with allow_unicode=True. This for example gets tert-Butyl...

Re: chemistry character set

2018-02-06 Thread Mike Dewhirst
x27;δ', 'd').replace('ε', 'e') return slugify(name, allow_unicode) And back in substance Meta ... ordering = ['slug'] When you request the list of chemicals by name order, you actually use the `sortable_name` field, which will

Re: chemistry character set

2018-02-06 Thread Mike Dewhirst
e our first multinational user but they only operate in the English speaking world so no pressure at the moment. I really appreciate that pointer Cheers Mike On Monday, February 5, 2018 at 6:56:00 PM UTC-5, Mike Dewhirst wrote: Chemical names start with both upper and lower case as we

Re: How do I move a project from one computer to another?

2018-02-12 Thread Mike Dewhirst
On 13/02/2018 11:09 AM, Tom Tanner wrote: I have a Django project that I want to work on with another computer. Do I need to backup my current project's Postgres database and restore it on the other computer's Postgres database to get my project up and running there? Or is there a Django way to

Re: chemistry character set

2018-02-15 Thread Mike Dewhirst
On 15/02/2018 10:19 PM, Hanne Moa wrote: On 2018-02-06 12:51, Mike Dewhirst wrote: Thank you. I think this is where we probably need to go. I asked the original question because I'm hoping the project will reach a tipping point and start to accumulate a growing number of multilingual

Do I need a special widget for multi-choice fields

2018-02-18 Thread Mike Dewhirst
The use case is on-line training software for a trainer entering a bunch of statements as possible answers to a single question. The student user needs to see this as a bunch of corresponding radio-buttons or select drop-down for a single answer selection. I've looked at the docs: https://docs

How do I get dynamic choices to a select widget at render time?

2018-02-19 Thread Mike Dewhirst
Here is an example of get_choices() output ... it comes from a method on the Question model.  [('A', 'A - Once?'), ('B', 'B - Twice?'), ('C', 'C - Four times?'), ('D', 'D - Twelve times?'), ('E', 'E - Continously as changes are made?')] It is available before the the answer form is instantiat

Re: How do I get dynamic choices to a select widget at render time?

2018-02-20 Thread Mike Dewhirst
On 20/02/2018 11:16 AM, Mike Dewhirst wrote: Here is an example of get_choices() output ... it comes from a method on the Question model.  [('A', 'A - Once?'), ('B', 'B - Twice?'), ('C', 'C - Four times?'), ('D', 'D

Re: How do I get dynamic choices to a select widget at render time?

2018-02-22 Thread Mike Dewhirst
On 20/02/2018 11:51 PM, Andy wrote: use django-select2 Had a look at the docs and django-select2 doesn't address this use case. However, I can see I will need it for ORM related selections in the near term. Thanks Andy. Am Dienstag, 20. Februar 2018 01:17:26 UTC+1 schrieb Mike Dew

Re: django admin css not loading in localhost

2018-02-22 Thread Mike Dewhirst
On 23/02/2018 11:49 AM, anurag bhadauriya wrote: i am using django-1.11.6. whenever i open my admin panel and login to it then it looks like the simple html file. no any css files are loading .The interface i am seeing is totally different than that of the tutorials using which i am learning.

Re: Django Multiple Choice questions with Answers linked to users

2018-02-22 Thread Mike Dewhirst
On 23/02/2018 2:56 AM, 'Giles german' via Django users wrote: Dear all I am wondering if you can help me?? I haven't looked too closely at your code but there are a couple of things I would do differently. 1. I don't use Caps for field names. Too easy to confuse myself with identical class

Re: Is there a way to make a field both foreignKey or allow user to fill it in themself?

2018-02-27 Thread Mike Dewhirst
On 28/02/2018 1:26 AM, Alexander Joseph wrote: Is there a way to make a form field or model field either a foreign key reference or allow the user to fill in something themselves? I'm making a fixed assets app and each fixed asset has an owner field, which I would like to assign to an app user

Re: Is there a way to make a field both foreignKey or allow user to fill it in themself?

2018-02-27 Thread Mike Dewhirst
=True and blank=True in the ForeignKey ought to work. Mike Thanks for your reply On Tuesday, February 27, 2018 at 7:45:51 PM UTC-7, Mike Dewhirst wrote: On 28/02/2018 1:26 AM, Alexander Joseph wrote: > Is there a way to make a form field or model field either a foreign &g

Re: When do I need a new app within the site?

2018-02-28 Thread Mike Dewhirst
On 1/03/2018 4:46 AM, Karol Bujaček wrote: On 02/22/2018 09:44 AM, Cictani wrote: Hi, I'm just beginning developing a new app(s) and I'm wondering when I need to add a new app. if one app uses models from another app is that a hint that these two apps are acutally one app or is this still

Re: Is there a way to make a field both foreignKey or allow user to fill it in themself?

2018-02-28 Thread Mike Dewhirst
On 1/03/2018 3:20 PM, Matemática A3K wrote: On Wed, Feb 28, 2018 at 12:46 AM, Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: On 28/02/2018 1:58 PM, Alexander Joseph wrote: Sorry, I think my question was confusing. What I want to do is allow the user

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-02-28 Thread Mike Dewhirst
On 1/03/2018 10:50 AM, Bernd Wechner wrote: Julio, Thanks for giving it some though. But I think you misread me a little. I am using the get() only to illustrate that the precondition is, I have a single object. The goal then is find a neighboring object (as defined by the ordering in the mod

Re: Fetching next and/or prior objects given an arbitrary ordering

2018-03-01 Thread Mike Dewhirst
27;t for people like you there'd be no progress ;) Cheers Mike Regards, Bernd. Mike Dewhirst wrote: On 1/03/2018 10:50 AM, Bernd Wechner wrote: > Julio, > > Thanks for giving it some though. But I think you misread me a little. > I am using the get() only to illust

YesNoWidget(CheckBoxInput) widget woes

2018-03-04 Thread Mike Dewhirst
In some training software a student can use 'Yes', 'No' or any other string as valid answers for up to six questions in a set and all of them have to be answered correctly to get a score. When checking student answers against the set answers, we ignore case and punctuation and leading zeroes if

Re: Template.render(Context) in django 1.10+

2018-03-12 Thread Mike Dewhirst
On 13/03/2018 11:44 AM, Craig de Stigter wrote: Thanks for the reply. So I guess there are actually now two types of templates, and they have incompatible API. Neither is deprecated. Craig I don't think your guess is correct. Or at least I'm missing something if it is! I remember bringing

Re: Template.render(Context) in django 1.10+

2018-03-13 Thread Mike Dewhirst
maybe the old-style Template class just needs to be removed to avoid confusion. On Tue, 13 Mar 2018 at 14:50 Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: On 13/03/2018 11:44 AM, Craig de Stigter wrote: Thanks for the reply. So I guess there are actually now two ty

Resolved a problem with FireFox 59.0 (64-bit)

2018-03-15 Thread Mike Dewhirst
Since getting Firefox 59.0 yesterday some of my sites were not displaying properly. They work normally in Chrome. Admin sites are working OK. Looking at 'View source' everything is there but just not rendered. Comparing source between my efforts and those of the Admin I saw a difference which

Re: Resolved a problem with FireFox 59.0 (64-bit)

2018-03-15 Thread Mike Dewhirst
On 15/03/2018 6:15 PM, Mike Dewhirst wrote: Since getting Firefox 59.0 yesterday some of my sites were not displaying properly. They work normally in Chrome. Admin sites are working OK. Looking at 'View source' everything is there but just not rendered. Comparing source between

Re: chemistry character set

2018-03-15 Thread Mike Dewhirst
. Wow! Thank you. Ain't Python marvellous! Mike - Peter of the Norse On Feb 15, 2018, at 5:55 AM, Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: On 15/02/2018 10:19 PM, Hanne Moa wrote: On 2018-02-06 12:51, Mike Dewhirst wrote: Thank you. I think this is where we probably

suggestions solicited for webm video in html5

2018-03-19 Thread Mike Dewhirst
What is the best way to upload video for display in a Django-based website? It appears FileField is one way to upload the video and html video elements the way to display it. I have used ImageField successfully and wonder if anyone is doing a VideoField? The djangopackages.org site mentions

Re: survey form

2018-03-20 Thread Mike Dewhirst
On 21/03/2018 1:17 PM, sum abiut wrote: Hi, I am planning to build a survey app that allow the administator to add new questioner and the question to be answer by the users.But i am having trouble figuring how to get started. Just wondering if i need to have two models one for the answes and a

Re: Adding seperate static css file for other extended templates.

2018-03-26 Thread Mike Dewhirst
On 27/03/2018 3:09 PM, prince gosavi wrote: I am working on a project where I need to have different styles for different templates. I have a base.html template which gets extended in other templates. Following is the snippet: | base.html {%load static%} Recommendation     href="{%static'mai

Re: Adding seperate static css file for other extended templates.

2018-03-27 Thread Mike Dewhirst
On 27/03/2018 5:08 PM, prince gosavi wrote: Thanks for the reply but it is not working for me. When i check the page source of the loaded page the 'query.css' is not loaded. Is it because of the urls? or path? or something else. here is my static settings: | settings.py STATIC_URL ='/static/' S

Re: A problem about database structure and displacement on django admin

2018-03-27 Thread Mike Dewhirst
On 28/03/2018 3:42 AM, shawn...@gmail.com wrote: Hi everyone, I am currently working on django and get confused about how to design the model. Right now, I have a table named 'Reactionmeta' which structure like below:      1             2              3                     4                  

Re: Decoupling Postgres database credentials in django for deployment.

2018-04-02 Thread Mike Dewhirst
On 2/04/2018 7:59 PM, Cictani wrote: Hi, You could rename your dev settings file to for example 'settings_dev.py' and only commit this file (add settings.py to .gitignore). I wrote a tiny utility to read a file and retrieve credentials for any purpose but especially for keeping database cre

Re: Decoupling Postgres database credentials in django for deployment.

2018-04-02 Thread Mike Dewhirst
On 3/04/2018 8:49 AM, Mike Dewhirst wrote: On 2/04/2018 7:59 PM, Cictani wrote: Hi, You could rename your dev settings file to for example 'settings_dev.py' and only commit this file (add settings.py to .gitignore). I wrote a tiny utility to read a file and retrieve credentia

Re: Django admin without Groups and Permissions. Can "groups and permissions" tables become a bottleneck?

2018-04-03 Thread Mike Dewhirst
On 4/04/2018 6:14 AM, Mateusz Kurowski wrote: I don't need groups and permissions, but i want to use django admin. Ive created this simple AbstractSuperUser that looks to solve this case. But i wonder if thats best idea. Can "groups and permissions" tables become a bottleneck in the future ev

Re: Suggest any document to learn below syntax?

2018-04-10 Thread Mike Dewhirst
On 11/04/2018 7:51 AM, Utpal Brahma wrote: {{ question.question_text }} {% for choice in question.choice_set.all %} {{ choice.choice_text }} {% endfor %} Try this ... https://docs.djangoproject.com/en/2.0/#the-template-layer I got this syntax in Writing your first Django ap

Re: Tips On Migrating DB from other website to django with Postgresql

2018-04-11 Thread Mike Dewhirst
On 11/04/2018 11:40 PM, tango ward wrote: Hi there, This will be my first time to migrate a database in my first programming job. I checked the dump file today and load it in MySQL benchmark to view the ERD. The database that I need to migrate has 48 tables and has existing data already. I

Re: Tips On Migrating DB from other website to django with Postgresql

2018-04-11 Thread Mike Dewhirst
bases. hth Mike On Thu, Apr 12, 2018 at 6:42 AM, Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: On 11/04/2018 11:40 PM, tango ward wrote: Hi there, This will be my first time to migrate a database in my first programming job. I checked the dump file

Re: Tips On Migrating DB from other website to django with Postgresql

2018-04-12 Thread Mike Dewhirst
file of the client. I'm lost on this, sorry. On Thu, Apr 12, 2018 at 8:46 AM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote: On 12/04/2018 9:47 AM, tango ward wrote: Hi Mike, Thanks for the advice. May I ask as wel

Re: How to handle a migration that last too long for being deployed?

2018-04-13 Thread Mike Dewhirst
Does it actually stop users reading? If the entire migration happens in a single transaction, the database (Postgres anyway) should remain accessible until the moment it is committed. Maybe you could announce a maintenance operation which will only interrupt certain actions for a few minutes?

Re: How to handle a migration that last too long for being deployed?

2018-04-13 Thread Mike Dewhirst
Adrien May I start a new thread to discuss with you the costs and benefits for splitting your model. I have some big models (47 up to 76 columns) which I have long thought are just too big. The splits would all have to be 1:1 with the core model. Mike On 13/04/2018 7:05 PM, Adrien Cossa wro

Re: Advice needed: One big model or many apps with highly interlinked data tables?

2018-04-17 Thread Mike Dewhirst
Don't forget that you can also split all your model classes one each into their own separate files. Create a models dir and put them in there. Then in app/models/__init__.py you say ... from .thismodel import ThisModel from .thatmodel import ThatModel And so on. In any view or other file you

Re: Multiple settings files with sites framework

2018-04-17 Thread Mike Dewhirst
On 17/04/2018 8:51 PM, sbarnett wrote: What is the best way to structure multiple settings files when using the Sites framework? I've already got a base settings file along with a local, staging and production file which inherits from this and makes some changes/additions. But now I need to

Re: How to handle a migration that last too long for being deployed?

2018-04-17 Thread Mike Dewhirst
On 17/04/2018 6:27 PM, Adrien Cossa wrote: Hi, On 04/14/2018 02:38 AM, Mike Dewhirst wrote: Does it actually stop users reading? If the entire migration happens in a single transaction, the database (Postgres anyway) should remain accessible until the moment it is committed. Maybe you could

Re: Stripping HTML tags and replacing for newlines

2018-04-17 Thread Mike Dewhirst
On 18/04/2018 6:51 AM, Andréas Kühne wrote: Hi all, I am hoping that someone has stumbled across a solution to a problem that I have currently. I have created an email templating system. Each template can contain placeholders that will be replaced with live data (a bit like the django templ

Re: Multiple settings files with sites framework

2018-04-18 Thread Mike Dewhirst
nd how do I use them for local development? dev-a.py from a import * dev-b.py from b import * On Wednesday, 18 April 2018 04:53:56 UTC+1, Mike Dewhirst wrote: On 17/04/2018 8:51 PM, sbarnett wrote: > What is the best way to structure multiple settings files when using >

Re: How do I move my development data tables to production server?

2018-04-23 Thread Mike Dewhirst
On 24/04/2018 5:50 AM, Tom Tanner wrote: Hey all, I have a bunch of tables on my local Django project. I set up the project on my production server and ran `manage.py migrate`. That set up the tables, but now I want to move the rows from my local tables to the ones on the production server. Bot

Re: How do I move my development data tables to production server?

2018-04-23 Thread Mike Dewhirst
the challenge that your data-base might not allow you to Insert values into a field which is meant to be based on an incrementing sequence. -- Tony On 23/04/18 23:41, Mike Dewhirst wrote: On 24/04/2018 5:50 AM, Tom Tanner wrote: Hey all, I have a bunch of tables on my local Django project. I

Decorator function argument woes

2018-04-29 Thread Mike Dewhirst
I'm pretty sure this is a not-understanding-python problem rather than a Django problem but here goes ... In a (FBV) view I'm trying to pass a function in to the login_required decorator. My function is called 'is_login_needed' and I want the login_required

Re: Decorator function argument woes

2018-04-29 Thread Mike Dewhirst
tion is the the view function? M On Mon, Apr 30, 2018 at 12:26 AM, Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: I'm pretty sure this is a not-understanding-python problem rather than a Django problem but here goes ... In a (FBV) view I'm t

Re: Decorator function argument woes

2018-04-29 Thread Mike Dewhirst
function be wrapped, not the test being done. That all makes sense. Thanks again Cheers Mike On Mon, Apr 30, 2018 at 1:24 AM, Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: On 30/04/2018 3:35 PM, Stephen J. Butler wrote: @login_required doesn't take a test f

Solved Re: Decorator function argument woes

2018-04-30 Thread Mike Dewhirst
as used in urls.py 3. in the view called from urls.py discovered the necessary determinant and returned the appropriate sub-view Works well and it is obvious to me now that this was the right way to proceed in the first place. Cheers Mike On 30/04/2018 4:37 PM, Mike Dewhirst wrote: On 30/04

Re: Admin site and ModelAdmin

2018-05-02 Thread Mike Dewhirst
On 3/05/2018 7:00 AM, jt.oldn...@gmail.com wrote: I'm new to Django and web development in general (C++ background) and I've got amazingly far very quickly, but there's one thing I've been struggling with for a couple days now :-(. Forgive me if I screw up the lingo. I've got a ModelAdmin pag

Re: Admin site and ModelAdmin

2018-05-02 Thread Mike Dewhirst
On 3/05/2018 10:33 AM, Mike Dewhirst wrote: On 3/05/2018 7:00 AM, jt.oldn...@gmail.com wrote: I'm new to Django and web development in general (C++ background) and I've got amazingly far very quickly, but there's one thing I've been struggling with for a couple days now

Re: Admin site and ModelAdmin

2018-05-03 Thread Mike Dewhirst
On 4/05/2018 7:02 AM, jt.oldn...@gmail.com wrote: Thanks for the response Mike. I generally don't like it when a design has to change to fit a framework, I agree. My design is almost entirely in the models. I want an API to be able to work without Django forms. however, in this case I decid

Re: Fixtures: core.serializers.sort_dependencies sorts models in the wrong order for FK constraints

2018-05-05 Thread Mike Dewhirst
On 5/05/2018 1:19 AM, Andrew Wrigley wrote: Hi all, I'm trying to dump a database fixture, and load it again to run tests. When I run `python manage.py test`, I get: You need to --exclude all models with data not used in any tests. Considering that tests should be run with known data, if

Re: Fixtures: core.serializers.sort_dependencies sorts models in the wrong order for FK constraints

2018-05-06 Thread Mike Dewhirst
ot of jurisdictional differences. Excluding all the other models makes sense for me in a test situation because setUp() and tearDown() populate and remove data respectively. It means I get an empty test database except for my reference data. Mike On Sunday, May 6, 2018 at 7:30:31 AM UTC+2,

Re: How Can I Select Date Based on Monday Date?

2018-05-13 Thread Mike Dewhirst
On 13/05/2018 5:00 AM, Alexander Joseph wrote: I'm building a timesheet app for employees and would like the employees to be able to select a day of the week date based on what the date was on Monday. ie. the user inputs the Monday date of the timesheet, then for each row they need to fill ou

Re: How Can I Select Date Based on Monday Date?

2018-05-13 Thread Mike Dewhirst
turn tt On Sun, May 13, 2018, 6:47 PM Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: On 13/05/2018 5:00 AM, Alexander Joseph wrote: > I'm building a timesheet app for employees and would like the > employees to be able to select a day of the week dat

Re: How Can I Select Date Based on Monday Date?

2018-05-13 Thread Mike Dewhirst
time.time(dday) tt = timezone.make_aware( datetime.combine( datetime.fromordinal(dday.toordinal() + days), ttime ), pytz.utc ) return tt On Sun, May 13, 2018, 6:47 PM Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: On 13/

Standard approach

2018-05-15 Thread Mike Dewhirst
This list gets a lot of new people joining. They come from all cultures and degrees of general competence. And list members have always made them welcome and try to help as much as possible. I would say to beginners - without thinking too hard - that the best place to begin is the excellent Dj

Re: Standard approach

2018-05-16 Thread Mike Dewhirst
y, May 15, 2018 at 7:53:58 PM UTC-4, Mike Dewhirst wrote: This list gets a lot of new people joining. They come from all cultures and degrees of general competence. And list members have always made them welcome and try to help as much as possible. I would say to beginners - w

Re: Standard approach

2018-05-19 Thread Mike Dewhirst
On 20/05/2018 3:52 AM, Melvyn Sopacua wrote: On donderdag 17 mei 2018 00:44:32 CEST Mike Dewhirst wrote: More advanced users tend to focus on the more advanced problems and that's the way it should be. Not always true. You tend to focus on things that show research and effort. The lev

Re: Managing multiple user types in Django

2018-05-20 Thread Mike Dewhirst
On 20/05/2018 1:45 PM, Daniel Germano Travieso wrote: There is no really definitive approach to handle this, and you could do it either way. Either option works, but for a philosofical point of view, if there is no significant difference between the user types, the first approach I tend to beli

money field question

2018-05-21 Thread Mike Dewhirst
I have just read ... * Martin Fowler's Money base pattern (P488 to 495) https://martinfowler.com/eaaCatalog/money.html * https://github.com/poswald/python-money * https://github.com/django-money/django-money * https://github.com/limist/py-moneyed ... and I am spoiled for choice. I was going to

Re: money field question

2018-05-23 Thread Mike Dewhirst
Babel yet. But it is on the horizon. I'm beginning to see why Django doesn't (yet?) have a built-in MoneyField and I'm still interested in experience with differences between them. Mike https://github.com/python-babel/babel On Tuesday, 22 May 2018 11:25:04 UTC+10, Mike De

Re: Is there a WYSIWYG app I can use for an inherited Django created website?

2018-05-26 Thread Mike Dewhirst
What does the website do for the visitors/users? Inheriting a site is great fun if you are getting paid. If so maybe someone here can help if you offer something. Otherwise, run pip freeze to see what apps have been installed and that together with the answer to the use-case question might (or

Re: Django

2018-05-26 Thread Mike Dewhirst
Try googling "django audio streaming". Django doesn't have a native audio data type but it does have a FileField which let's you get started. I'm not an expert but I think FileField plus HTML5 is probably what you really want. I found a great deal of help on the html side of things in the Moz

Re: money field question

2018-05-28 Thread Mike Dewhirst
On 24/05/2018 12:03 PM, Mike Dewhirst wrote: On 23/05/2018 12:31 PM, Simon McConnell wrote: I'm in a similar boat at the moment. There is https://github.com/vimeo/py-money too. I looked at that but it probably won't ever support exchange rates. Not sure yet if that is a show stopp

Re: money field question

2018-05-28 Thread Mike Dewhirst
On 29/05/2018 6:06 AM, Simon McConnell wrote: https://github.com/limist/py-moneyed/blob/master/moneyed/localization.py only has the localisation configured for a handful of currencies, and not our precious AUD :). The shortest party would be adding them all in or doing https://github.com/limi

Re: money field question

2018-05-28 Thread Mike Dewhirst
On 29/05/2018 6:06 AM, Simon McConnell wrote: On Mon., 28 May 2018, 7:50 pm Mike Dewhirst, <mailto:mi...@dewhirst.com.au>> wrote: On 24/05/2018 12:03 PM, Mike Dewhirst wrote: > On 23/05/2018 12:31 PM, Simon McConnell wrote: >> I'm in a similar boat at the

Re: Authenticated users should only be able to see their own data

2018-05-28 Thread Mike Dewhirst
On 29/05/2018 11:04 AM, Dylan Moreland wrote: Hello, I'm building an employee performance tracker for my company, and I'd like each employee to be able to view their own infractions (late to a shift, missed punch, etc.) and no one else's, obviously. I plan to use the built-in Django admin int

Re: Authenticated users should only be able to see their own data

2018-05-28 Thread Mike Dewhirst
On 29/05/2018 11:44 AM, Mike Dewhirst wrote: On 29/05/2018 11:04 AM, Dylan Moreland wrote: Hello, I'm building an employee performance tracker for my company, and I'd like each employee to be able to view their own infractions (late to a shift, missed punch, etc.) and no

Re: money field question

2018-05-29 Thread Mike Dewhirst
On 29/05/2018 6:06 AM, Simon McConnell wrote: Work with what you've got (that being procrastination): http://www.structuredprocrastination.com You should see the pile of stuff I'm avoiding. It's worth a PhD in procrastination poswald/python-money does the same and looks interesting. Might

Re: money field question

2018-05-29 Thread Mike Dewhirst
On 29/05/2018 10:10 PM, Melvyn Sopacua wrote: On dinsdag 29 mei 2018 11:03:56 CEST Mike Dewhirst wrote: > Also, despite using decimal.Decimal under the covers it wants its money > as strings. > > Python 3.6.3 > > >>> from money import money > >

Re: Attribute error

2018-05-30 Thread Mike Dewhirst
On 31/05/2018 11:45 AM, Caleb Bryson wrote: I am getting a attribute error when i try to run my server. does anyone know what i can change in this code to fix that? Try indenting the __str__ method so it is within the scope of the Post class from django.db import models class Post(models.Mod

Re: href not working

2018-05-31 Thread Mike Dewhirst
On 31/05/2018 1:56 PM, Caleb Bryson wrote: So i am trying to create a directory with a Home,Blog,and Contact selection. But every time i click on one of them they all go back to the home page. It feels like your urls.py is insufficiently fleshed out or maybe your home page url isn't fully for

Re: dumpdata fails with crytpic error

2018-05-31 Thread Mike Dewhirst
On 1/06/2018 2:22 PM, Bernd Wechner wrote: Just tried this: | $ python3 manage.py dumpdata --format json --indent 4>data.json CommandError:Unableto serialize database:'NoneType'objecthas noattribute 'is_authenticated' | Anyone seen this before. How does one diagnose this given the vague natu

Re: Simple django api

2018-06-05 Thread Mike Dewhirst
Take a look at Django REST Framework http://www.django-rest-framework.org/ Haven't used it myself but I'm planning to one of these days. Cheers M On 6/06/2018 11:35 AM, Django Girls Bauchi wrote: Hello Response pls On Tue, Jun 5, 2018, 10:46 PM Django Girls Bauchi mailto:bau...@djangogirls

Re: restore migration files

2018-06-06 Thread Mike Dewhirst
Maybe you can find an old backup of your models and create a new database from them. Then overwrite the old models with your latest ones and make migrations again. Those should suffice to replace the deleted migrations. Connected by Motorola Leif wrote: >Dear Django Experts: > > >Somehow I de

<    4   5   6   7   8   9   10   11   12   13   >