Re: Is it possible to write generic module?

2017-03-27 Thread Melvyn Sopacua
ree. Why would you need yet another way? -- Melvyn Sopacua [1] http://mezzanine.jupo.org/docs/configuration.html -- 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,

Re: Update dict JsonField Postgresql

2017-03-27 Thread Melvyn Sopacua
e problem. We don't even know how you determined it's not working (get an exception, value isn't changed, save doesn't get called, form errors ... ). Here's my shot in the dark: Django's JSONEncoder only accepts dicts as outermost structure. -- Melvyn Sopacua --

Re: Update dict JsonField Postgresql

2017-03-27 Thread Melvyn Sopacua
> > That's wrong? Not sure, but as you typed it, it's a set, not a dict (there is no 'key':), so if python thinks any of the lists are identifcal, it'll be missing. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/request-response/#jsonres

Re: Update dict JsonField Postgresql

2017-03-27 Thread Melvyn Sopacua
model that it's data has changed, as the reference doesn't change. You need to manipulate the data as it's own structure, then assign it: data = objectitem.data data[0]['processed'] = True objectitem.data = data objectitem.save() If the above don't work: objecitem.s

Re: Update dict JsonField Postgresql

2017-03-28 Thread Melvyn Sopacua
ONFields... This would simplify things quite a bit. That said, I would try data__contains={'processed': True}, but if that doesn't work, your problem is that your outer structure is a list, not an object, making filtering a lot harder. -- Melvyn Sopacua -- You received

Re: django sample projects

2017-03-28 Thread Melvyn Sopacua
project and after running createdb is a fully functional site with user accounts, blog, gallery and editable pages. In the end though, a Django project is a collection of apps tied to urls. If you can write an app, all you need to do is tie them to urls and add the homepage and global navig

Re: Django signup problem Urgent

2017-03-28 Thread Melvyn Sopacua
erything yourself that's already abstracted. Use at minimum generic.FormView[1] 2) The image field: it is required and you're not passing request.FILES to the form. And maybe a third: encoding type of the form should be set correctly. -- Melvyn Sopacua [1] https://ccbv

Re: NoReverseMatch when trying to use get_absolute_url with custom template tag

2017-03-29 Thread Melvyn Sopacua
') name = viewEvent > Sorry about the load of code posted. Any chance anyone knows what > might have caused this issue? Do you see it now? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Django forks

2017-04-20 Thread Melvyn Sopacua
te. You can. What I don't get is that the label is still coupled with the field instead of the widget. This would've been a chance to move it, so that we can render proper form groups for custom widgets. Oh well. -- Melvyn Sopacua -- You received this message because you are su

Re: I can't understand this NoReverseMatch

2017-04-20 Thread Melvyn Sopacua
27;, 'option': 'error_view'}' because underscore > > ['saule/taiga/import/(?P[0-9]+)/display/(?P[a-z]+) is not in [a-z]+ -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubsc

Re: Dynamic Selector with Django/Jquery

2017-04-20 Thread Melvyn Sopacua
change="this.form.submit()". And tie page_size to the Paginator (paginate_by attribute on ListView) through urls.py. If you need more dynamic filtering (sort order / color filter etc), you may want to look at one of these: https://djangopackages.org/grids/g/filters/ -- Melvyn Sopacua

Re: SelectDateWidget dosent work

2017-04-25 Thread Melvyn Sopacua
template but it is only > a regular input Did you set the form_class[1] attribute? -- Melvyn Sopacua [1] https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/FormMixin/ -- You received this message because you are subscribed to the Google Groups "Django users"

Re: NoReverseMatch

2017-05-01 Thread Melvyn Sopacua
On Friday 28 April 2017 16:31:57 shahab emami wrote: > your url must be like this: > > url(r'^events/((?P\d+))/delete/$', views.delete_event, name= > 'delete_event'), No, it MUST not. That just changes the problem from args to kwargs. -- Melvyn Sopacua -- Y

Re: NoReverseMatch

2017-05-01 Thread Melvyn Sopacua
rwise, arguments would be '('123456',)'. -- Melvyn Sopacua -- 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...@g

Re: Django feedback

2017-05-01 Thread Melvyn Sopacua
On Monday 01 May 2017 13:47:10 goskoomer tarasenko wrote: > The third day I suffer with the form of feedback Did you configure the settings related to EMAIL_[1]? -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.11/ref/settings/#email-backend -- You received this mess

Re: Update FileField: what is the name of the old file

2017-05-08 Thread Melvyn Sopacua
solve it, is to put the old file name in the form as a hidden widget. -- Melvyn Sopacua -- 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-user

Re: NoReverseMatch, Not working in Production Server

2017-05-08 Thread Melvyn Sopacua
ned to read it and didn't dive down the rabbit hole. -- Melvyn Sopacua -- 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..

Re: NoReverseMatch, Not working in Production Server

2017-05-08 Thread Melvyn Sopacua
well. It's probably the data that changed - but you're not showing the for loop and view part that fills faculty_name. > >> Reverse for 'rrs_class_lists_faculty' with arguments '()' and > >> keyword > >> arguments '{'faculty_id'

Re: OperationalError:no such table

2017-05-08 Thread Melvyn Sopacua
will be migrated correctly using all individual migrations but new installs will only use the squashed migration. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving ema

Re: Admin css question for 1.10.7

2017-05-08 Thread Melvyn Sopacua
573eb4d31a70c250fddf8 M django bisect run success Happy hunting. -- Melvyn Sopacua -- 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-user

Re: makemigration detect error

2017-05-08 Thread Melvyn Sopacua
ct a fix: > 1) Provide a one-off default now (will be set on all existing rows > with a null value for this column) > 2) Quit, and let me add a default in models.py > Select an option: Just curious - what is not clear about the language used here and what made it clear from the answe

Re: Doesn't generate apps.py (polls tutorial)

2017-05-08 Thread Melvyn Sopacua
.djangoproject.com/en/1.11/intro/tutorial01/ And what's your Django version? -- Melvyn Sopacua -- 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 djang

Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Melvyn Sopacua
ents are unavailable until I enter the password on the console. Unfortunately, that doesn't prevent theft at runtime, which is the primary case for encrypting "documents". I used to do something like this with svn passwords, using a file- backed mdconfig store and geli. -- Melvyn So

Re: field cannot be specified for model form as it is a non-editable field

2017-05-08 Thread Melvyn Sopacua
t in a model form, since the update case is unhandled. However, this has always (at least 1.8.x and up) been the case for the field and as you say, it now exposes a bug. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users

Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Melvyn Sopacua
alize devices without having to manage another server component. With IoT security being under a microscope these days, I can see the potential. And from experience, Django runs fine on a Raspberry Pi and is an easy way to provide a user interface that is accessible from anywhere. -- Melvyn Sop

Re: NoReverseMatch, Not working in Production Server

2017-05-08 Thread Melvyn Sopacua
On Monday 08 May 2017 14:22:27 Melvyn Sopacua wrote: > On Monday 08 May 2017 03:16:30 miguel vfx wrote: > > I got it to work but with a different approach by not passing > > > arguments: > This isn't the right fix, something else changed. The error message > shows

Re: django 1.11 login user

2017-05-08 Thread Melvyn Sopacua
e,password=password) > if user is not None: > login(request,user) > #Redirect to dashboard page > return render(request,'dashboard.html') > else: > # return invalid login message > return HttpResponse( 'Y

Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Melvyn Sopacua
y mode 500 owned by root. But I feel we're going off-topic now. -- Melvyn Sopacua [1] https://en.wikipedia.org/wiki/FIPS_140-2#Level_1 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this gr

Re: field cannot be specified for model form as it is a non-editable field

2017-05-08 Thread Melvyn Sopacua
del kwargs['editable'] return name, path, args, kwargs def get_internal_type(self): > > [0] https://code.djangoproject.com/ticket/22995 > > On Monday, May 8, 2017 at 10:47:25 AM UTC-4, Melvyn Sopacua wrote: > > On Monday 08 May 2017 04:07:09 Tim Gr

Re: sqlite3 database encrytion for Django.

2017-05-09 Thread Melvyn Sopacua
vailable, but only after the exam. Using time-lapse cryptography[1], I can make the answers only available after a certain time :). Anyway - there's enough food for thought in here, so I'm out, unless the OP explains his use case and needs more help. -- Melvyn Sopacua -

Re: Admin css question for 1.10.7

2017-05-09 Thread Melvyn Sopacua
On Tuesday 09 May 2017 17:48:43 Mike Dewhirst wrote: > On 9/05/2017 11:45 AM, Mike Dewhirst wrote: > > On 8/05/2017 11:02 PM, Melvyn Sopacua wrote: > >> On Monday 08 May 2017 03:57:01 Tim Graham wrote: > >> > You need to clone the Django repository and run the bisect

Re: Unicode error in __unicode__(self) function

2017-05-09 Thread Melvyn Sopacua
he error using ascii codec for the debug output (I haven't chased it down any further and I should really report it). As said, your real error is somewhere else and that will probably make more sense. -- Melvyn Sopacua -- You received this message because you are subscribed to the Goog

Re: Problem with CircularDependency Model

2017-05-09 Thread Melvyn Sopacua
). Make sure you remove the import of Institute or it won't help. If you're interested in the topic of resolving models at runtime, take a loot at django.apps.Apps, specifically get_model. But all the work for foreign keys is already done for you. -- Melvyn Sopacua -- You receive

Re: How to fix i18n fallback , from variant xx-YY to xx and from xx to en the translatino is not available.

2017-05-09 Thread Melvyn Sopacua
itch language and you have one of those language switchers in your site it should always be prefered over Accept-Language header in my opinion. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: vs {{ form }}

2017-05-09 Thread Melvyn Sopacua
Bootstrap for css, you're much more helped by using the bootstrap3 package[1]. Example: {% csrf_token %} {% bootstrap_form form %} {% buttons submit='Go!' %}{% endbuttons%} -- Melvyn Sopacua [1] https://djangopackages.org/packages/p/django-bootstrap3/ -- You rec

Re: Unicode error in __unicode__(self) function

2017-05-10 Thread Melvyn Sopacua
print the error using ascii > > codec for the debug output (I haven't chased it down any further > > and I should really report it). > > > > > > > > As said, your real error is somewhere else and that will probably > > make more sense. > > >

Re: vs {{ form }}

2017-05-10 Thread Melvyn Sopacua
On Tuesday 09 May 2017 14:08:44 Jani Tiainen wrote: > And to use bootstrap you don't need any special package, you can do it > without it just fine. To render a webpage, you don't need Django you can do just fine typing HTML. What's your point really? -- Melvyn Sopacua

Re: CPU usage by workers

2017-05-10 Thread Melvyn Sopacua
filename or network address / port number can be that candle in the dark. -- Melvyn Sopacua [1] http://www.man7.org/linux/man-pages/man1/strace.1.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this gro

Re: SaveFig(graph_filename) VS canvas.print_png(graph_filename)

2017-05-10 Thread Melvyn Sopacua
On Wednesday 10 May 2017 09:03:51 Thames Khi wrote: > I have a small app which generates a graph and saves it to a file. The > file is then displayed using a reference. Consider saving some CPU cycles: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#p roxy_store -- Melvyn S

Re: "In menu" does not work - Can anybody help?

2017-05-10 Thread Melvyn Sopacua
On Wednesday 10 May 2017 08:06:59 lisa.frisc...@tenag.de wrote: > Hi, > > I am just using the Django CMS. :) Could list INSTALLED_APPS in the settings.py? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: Permissions for Anonymous Users in Django

2017-05-10 Thread Melvyn Sopacua
lement a custom user model, but be aware, that you will have to delete staff accounts or unmark them as staff if they are no longer allowed to access to the admin. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Localization with thousand separator makes foreign key id invalid in forms

2017-05-11 Thread Melvyn Sopacua
On Thursday 11 May 2017 08:39:41 Alti wrote: > With localization and thousand separator active, my foreign keys ids > are rendered with a thousand separator in django forms and give me an > invalid field during validation. Is this a regression? Same code works in 1.10? -- Melvy

Re: trouble with setting static for img and css

2017-05-11 Thread Melvyn Sopacua
st reading the settings as all they see is STATIC_URL. -- Melvyn Sopacua [1] https://en.wikipedia.org/wiki/Web_server#Path_translation -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Permissions for Anonymous Users in Django

2017-05-12 Thread Melvyn Sopacua
quiredMixin or the corresponding decorator. -- Melvyn Sopacua -- 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 pos

Re: Permissions for Anonymous Users in Django

2017-05-12 Thread Melvyn Sopacua
On Friday 12 May 2017 02:38:23 James Schneider wrote: > On May 12, 2017 12:32 AM, "Melvyn Sopacua" > wrote: > On Thursday 11 May 2017 21:59:48 Constantine Covtushenko wrote: > > Let us check terms: > > > > Anonymous User - is one that is not authenticated.

Re: vs {{ form }}

2017-05-17 Thread Melvyn Sopacua
On Tuesday 16 May 2017 00:51:07 guettli wrote: > Am Mittwoch, 10. Mai 2017 10:56:56 UTC+2 schrieb Melvyn Sopacua: > > On Tuesday 09 May 2017 14:08:44 Jani Tiainen wrote: > > > And to use bootstrap you don't need any special package, you can > > > do it &

Re: vs {{ form }}

2017-05-17 Thread Melvyn Sopacua
ackage, is that it produces the correct HTML 9 outof 10. Do I need it? No. Does it save me time? Yes, definitely. And it keeps structure of templates readable. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To u

Re: Problem with CircularDependency Model

2017-05-17 Thread Melvyn Sopacua
to do with *model* dependencies. Two *migrations* depend on each other: play and port, both 0001_initial. Do you have any idea how you got into that jam? Did you fiddle with django_migrations table? Maybe run --fake? -- Melvyn Sopacua -- You received this message because you are subscribed

Re: vs {{ form }}

2017-05-17 Thread Melvyn Sopacua
ob to do that. Not sure if flexibility really is the original intent, but the Form class is badly named when you think of it as HTML forms. It is *not* an abstraction of the HTML tag, it's closest to an abstraction of the DOM HTMLFormElements collection. Once you see that distinction, th

Re: Problem with CircularDependency Model

2017-05-19 Thread Melvyn Sopacua
EL) institute = models.OneToOneField(Institute, related_name='master_user') > On Wednesday, May 17, 2017 at 5:41:41 PM UTC+2, Melvyn Sopacua wrote: > > On Wednesday 17 May 2017 05:57:57 Tobias Dacoir wrote: > > > Thanks Melvyn, > > > > > >

Re: Custom Model Manager

2017-05-25 Thread Melvyn Sopacua
is the default. > Any help on how to correct this would be appreciated. The trick to Django is knowing where to find the relevant documentation bit[1]. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.11/ref/models/options/#base-manager-name -- You received this message b

Re: null value in column violates not-null constraint

2017-05-25 Thread Melvyn Sopacua
rNeededMixin doesn't change that. The user field is commented out in your model so this error and the quoted code are not in sync. But it could also be the slug. Without more of the error message it's hard to tell. -- Melvyn Sopacua -- You received this message because you are sub

Re: null value in column violates not-null constraint

2017-05-25 Thread Melvyn Sopacua
n Product.fields. The error should actually be about a field called 'seller', but because it is not in the form, it is not passed to the ORM and the old table complains about the user field, as it is the one that it still has. -- Melvyn Sopacua -- You received this message because

Re: best practices for handling charts

2017-05-25 Thread Melvyn Sopacua
en the problem description. -- Melvyn Sopacua -- 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 g

Re: Building correct queryset

2017-05-25 Thread Melvyn Sopacua
27;s how I read it too. But the code says score is on Brand model, not Product. Which is correct? -- Melvyn Sopacua -- 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

Re: Should I store offline calculation results in the cache?

2017-05-28 Thread Melvyn Sopacua
ync readers go for the 2nd. Unlock, lock+write second and you're done. This can be done with one store and 2 keys or - in a larger environment - with replicated stores, where things pretty much work automagically. -- Melvyn Sopacua -- You received this message because you are subsc

Re: Multiple uwsgi apps in one project

2017-05-28 Thread Melvyn Sopacua
/open/(*f, *"rb")*.read*()) else:/print/("WARNING: no such local module: {}: File does not exist"*.format*(*f*)) * Now your repo can have public_settings.py, admin_settings.py etc, and use env[1] in uwsgi configuration to select the correct one. The main settings.py contains shar

Re: Django rest framework JWT and custom authentication backend

2017-05-28 Thread Melvyn Sopacua
t am I missing? Why is it that its working while loggin to the > django admin site, but get error when getting token with django rest > framework jwt? Shot in the dark: Your payload is not json. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Group

Re: UI for a legacy database

2017-05-28 Thread Melvyn Sopacua
roblem, but even then, you can override get_context_data if want to provide a cleaner context for your template. What happens now is that you use {{ instance }} in your template and that coerces instance into it's string representation. But you're free to use {{ instance.columname.na

Re: append language-code tot variable name

2017-05-28 Thread Melvyn Sopacua
to solve what Django Modeltranslation[1] already did. Allthough, it can be hard working with it in the beginning stage of a project as models change structure a lot, it should be a breeze when data model is stable. -- Melvyn Sopacua [1] https://djangopackages.org/packages/p/django-mo

Re: Restricting the user from closing the browser tab so that the server side APIs are called.

2017-05-31 Thread Melvyn Sopacua
through our end-call button. So fix that design flaw. If the user experiences a power outage or loss of internet connectivity, no JS / browser hacking will save you. As with any 2-way connection, code for disconnects through timeouts, then do your cleanups. -- Melvyn Sopacua -- You received

Re: count from multiple tables in a single query?

2017-06-01 Thread Melvyn Sopacua
ern is that this results in two different queries to the > database. Can it be done with a single query call? Why is that a concern? This isn't the kind of thing to optimize. Query optimization is about loops and relations. Not about getting information you need - it comes at a price. Have yo

Re: Is it possible to swap 1.8 and 1.10/1.11 Admin static files

2017-06-01 Thread Melvyn Sopacua
l a completely different, well-maintained admin theme free of charge. It is less annoying to start fresh, then to adjust to slightly different placement / look of something that looks like the old. The latter triggers muscle memory that no longer works. -- Melvyn Sopacua -- You received this m

Re: uWSGI ModuleNotFoundError Django 1.11

2017-06-01 Thread Melvyn Sopacua
om the > command line I get: ... > chdir() to /home/user/env/project/project/ ... > And I don't know whether it's a path or import thing or what. Thanks. It's a chdir thing. Move up one, so /home/user/env/project. -- Melvyn Sopacua -- You received this message because you are su

Re: uWSGI ModuleNotFoundError Django 1.11

2017-06-01 Thread Melvyn Sopacua
t does work, try starting uwsgi from a different terminal tab, where the virtual environment is not activated. If you run into "can't find settings", add --env DJANGO_SETTINGS_MODULE=project.settings -- Melvyn Sopacua -- You received this message because you are subscribed

Re: Generic Search for any Django Model

2017-06-02 Thread Melvyn Sopacua
On Friday 02 June 2017 07:10:15 guettli wrote: > There are several libraries which enable you to do fancy pagination of > django queryset. > > See this grid: https://djangopackages.org/grids/g/pagination/ And try looking at this grid: https://djangopackages.org/grids/g/filters/

Re: uWSGI ModuleNotFoundError Django 1.11

2017-06-02 Thread Melvyn Sopacua
/bin \ /usr/local/etc/rc.d/uwsgi start and it still works (and no leakage of shell env of user to wsgi requests). I'm on FreeBSD, so hence no init.d but rc.d. Principle is the same though. -- Melvyn Sopacua -- You received this message because you are subscribed to the Googl

Re: Django URL dispacher

2017-06-03 Thread Melvyn Sopacua
s, you would need to do this in a view or .... create your own resolver (see django.urls.resolvers). Also think about the fact that just to resolve your URL, you would need at minimum n database queries, where n is the number of models matching. That don't scale well. -- Melvyn Sopacua -- Y

Re: Installing Django

2017-06-05 Thread Melvyn Sopacua
e "Requirement > >> already satisfied: django in c:\program files\python > >> 35-32\lib\site-packages\django -1.10.6-py3.5.egg" 2) I'm betting it's 1.10.6 on Python 3.5 (32-bits, shooting for the bonus points). -- Melvyn Sopacua -- You received this message becau

Re: Authentication backend - serialization

2017-06-05 Thread Melvyn Sopacua
*/callable/**(/getattr/(*obj, *'model_to_dict')):return *obj.model_to_dict*(*exclude*=*self.get_excluded_fields*(*obj*))elif /isinstance/(*obj, models.Model*):return *self.model_to_dict*(*obj*)else: return /super/()*.default*(

Re: Same tutorial different day

2017-06-06 Thread Melvyn Sopacua
n top of that, polls.urls is referenced by string, so importing won't fix a thing. The tutoral could probably be improved by listing the complete tree after creating polls app, showing mysite as sister directory, but honestly, it told you exactly what to do twice. -- Melvyn Sopacua -- Y

Re: makemigrations running for all apps defined in INSTALLED_APP

2017-06-06 Thread Melvyn Sopacua
so the correct fix, as Daniel pointed out is to declare the model as such. And to clarify, why returning false in the router doesn't help: The router check is one of 3 checks done. If any of the checks return True, it will attempt to make a migration. -- Melvyn Sopacua -- You received

Re: Filefield uploads in django admin

2017-06-06 Thread Melvyn Sopacua
ays overwrite existing files if a file with that name already > exists? That's a bit dangerous, but you can accomplish it by writing > a custom storage. Or you can use a callable to upload_to if you don't care about being storage backend (filesystem) agnostic. -- Melvyn Sopacua --

Re: Django settings - customize attributes per Site from admin

2017-06-06 Thread Melvyn Sopacua
h? Take a look at mezzanine.conf[1] for inspiration. -- Melvyn Sopacua [1] https://github.com/stephenmcd/mezzanine/tree/master/mezzanine/conf -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and s

Re: makemigrations running for all apps defined in INSTALLED_APPS

2017-06-07 Thread Melvyn Sopacua
t. Then change the related name and it should no longer make a migration. -- Melvyn Sopacua -- 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 dja

Re: Django in Production and Virtualenv

2017-06-07 Thread Melvyn Sopacua
ttings > Project > Project Interpreter. -- Melvyn Sopacua -- 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. T

Re: Django graceful database errors

2017-06-07 Thread Melvyn Sopacua
{"error": trans("We encountered a problem")}, > status=status.HTTP_503_SERVICE_UNAVAILABLE, > ) > > Any ideas? Because your timeout hits before your code gets to except. -- Melvyn Sopacua -- You received this message because you are subscri

Re: How to Add radio selection in tabularInline - admin

2017-06-07 Thread Melvyn Sopacua
the "correct answer" in a multiple-choice test? Or is it supposed to be the "answer given by someone answering the question"? (In both cases this isn't the way to do it). -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups

Re: Extending the user model and accessing fields in template context

2017-06-07 Thread Melvyn Sopacua
al[1] on the User model and create a profile, without requiring profile information. It's either that, or you have to augment the things in your project that create users with the required profile data. By default that is the admin and the createsuperuser command. -- Melvyn Sopacua ---

Re: Django graceful database errors

2017-06-07 Thread Melvyn Sopacua
ngo/core/handlers/ > base.py" in _get_response > 185. response = wrapped_callback(request, > *callback_args, **callback_kwargs) > > File > "/Users/damian/Development/mirustatus/mirustatus/accounts/utils.py" > in as_view > 10. if request.

Re: Django graceful database errors

2017-06-08 Thread Melvyn Sopacua
r to try again in 5 minutes. Granted, for a normal public website, you've lost the user already. But for a web application used by subscribers, they will grab a coffee and convo at the watercooler and try again. -- Melvyn Sopacua -- You received this message because you are subscribed to th

Re: Adding a attribute to a model property

2017-06-08 Thread Melvyn Sopacua
se PyDev > and it brilliantly lets me select almost anything and press F3 and > takes me to its definition, but not for this 'property' keyword). And > yet it's not documented here: > > https://docs.python.org/3.1/library/stdtypes.html Nope, because it&

Re: request.GET as an OrderedDict

2017-06-08 Thread Melvyn Sopacua
; how one might extend Django to supply an OrderedDict when requested? Bad idea. What are you trying to solve that requires an ordering in parameters? If you're deadset on it, you can always grab the original query string (request.META.query_string) and split it's components yours

Re: request.GET as an OrderedDict

2017-06-08 Thread Melvyn Sopacua
JSON as transmission format with POST as request method. P.S. If you're building this query string over the course of several requests, consider using sessions (though that's not a guarantee it becomes less complex, just a different way of doing it). -- Melvyn Sopacua [1] https://w

Re: Source Code for Django + Python + Postgres

2017-06-08 Thread Melvyn Sopacua
gopackages.org/grids/g/ecommerce/ But if you're not set on Django, ERPNext and Odoo are alternatives, however ERPNext is built on MariaDB. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Problems with migrations cleaning up a date field

2017-06-10 Thread Melvyn Sopacua
like that in a while. When you *remove* a default, there is no need to migrate existing rows, as they have a default. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiv

Re: Problems with migrations cleaning up a date field

2017-06-10 Thread Melvyn Sopacua
em. Is it possible for you to rollback to before this migration or has this hit production already? -- Melvyn Sopacua -- 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,

Re: Same form saving to related models

2017-06-10 Thread Melvyn Sopacua
ideal, as half of the parents end up in the divorce, so contact details and so on, become a mess again. ManyToManyField is the best fit here. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Same form saving to related models

2017-06-10 Thread Melvyn Sopacua
; later but I think yingis suggestions are smoother > > On Jun 10, 2017 2:39 PM, "Melvyn Sopacua" wrote: > > On Saturday 10 June 2017 13:20:11 yingi keme wrote: > > > The variable for foreign key is supposed to be declared under > > > Student > >

Re: Filter queryset based on another model's foreign key in a class based view.

2017-06-10 Thread Melvyn Sopacua
This creates a property 'answer_set' on the Topic model, which is a model manager (to be precise, a RelatedManager[1]). So you can do queryset methods on it. > urls.py > > url(r'^$', login_required(views.IndexView.as_view()), Consider moving this to the view d

Re: What is the best approach

2017-06-10 Thread Melvyn Sopacua
estionable gender choices aside). Work out how the rooms need to be filled and the data model will come to you. The most obvious being, that Students don't have a "year of enrollment" or "student type" to indicate the rooms they can apply for. In your specification above

Re: Django Real time Notifications

2017-06-11 Thread Melvyn Sopacua
how to detect a change in your model. -- Melvyn Sopacua -- 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

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Melvyn Sopacua
tem" WHERE ("todo_item"."project_id" > = '...' AND "todo_item"."deleted_at" IS NULL); > > django.db.backends: (0.883) SELECT "photos_photo"."version", *... all > item properties ...* FROM "photos_photo" WHERE >

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Melvyn Sopacua
r make more API calls for photo's they don't have yet) you paginate, but it's not very flexible and scales bad. The proper desgin pattern here would be to hash your photo's, use that as identifier in the API and put the burdon on the consumer to only request photo's

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Melvyn Sopacua
it in the long run. - Ditch DRF serialization and get the querieset as values(), dumping to json instantly and thus eliminate both serialization objects and model objects. It's easy to test the performance gain of the 2nd, especially if you can stream the json (as opposed to in-memory-then-flus

Re: SelectDateWidget when DateField is not required

2017-06-12 Thread Melvyn Sopacua
t; > 1) if the through_date is completely empty. > > 2) if it is completely filled. > > If it is partially filled, form validation is ignored completely. The > program explodes at CreateView. Do you have a backtrace? -- Melvyn Sopacua -- You received this message because

Re: Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)

2017-06-12 Thread Melvyn Sopacua
et_or_create()[1] is tuple(obj: models.Model, created: bool). So your if check is useless as it is always true. But your method signature is incorrect as well. You're not supplying defaults. On top of that, you fetch the user profile twice and both cases can blow up if no profile exists. -

Re: How to know when a record is added to or removed from a many to many relationship?

2017-06-13 Thread Melvyn Sopacua
x27;action' keyword argument). -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.11/ref/signals/#m2m-changed -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: Despite what django doc says, multiple inheritance with a common ancestor causes an error(models.E005). I found a tricky solution, but are there any better solutions?

2017-06-14 Thread Melvyn Sopacua
; Is there any solution with no redundant field? Sorry, but you haven't convinced us you've implemented the common ancestor part properly. It means you have at minimum 4 models in play and none of them can be abstract. The most common error is to mark the grandparent abstract and t

Re: User has no dcf_profile : RelatedObjectDoesNotExist

2017-06-16 Thread Melvyn Sopacua
.post_save[1] could be used to create or update related models as appropriate. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.11/ref/signals/#django.db.models.signals.post_save -- You received this message because you are subscribed to the Google Groups "Django u

<    1   2   3   4   5   6   7   >