Re: Simple Join with no matching primary keys

2017-03-08 Thread Melvyn Sopacua
the join needs to do. Find duplicates? Get all of them in either table? Provide the right question and Django will do the right join. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: Simple Join with no matching primary keys

2017-03-08 Thread Melvyn Sopacua
roblem is easily solved. Since the two models are identical, why would you use two models? Your problem starts with your design - rethink it. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Postgres (sqlmigrate) FK to M2M without RunPython

2017-03-08 Thread Melvyn Sopacua
ot *creating* migrations, you're *applying* migrations. Please review the difference between "makemigrations" and "migrate" command. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Error running Django tutorial

2017-03-08 Thread Melvyn Sopacua
Hi, On Tuesday 07 March 2017 01:24:02 Vanja Falck wrote: > urlpatterns = [ > url(r'ˆpolls/', include('polls.urls')), > url(r'^admin/', admin.site.urls), > ] Easy to see this way. You didn't type a caret but some unicode sign that

Re: Postgres (sqlmigrate) FK to M2M without RunPython

2017-03-07 Thread Melvyn Sopacua
python code: python manage.py sqlmigrate app_label migration_name |psql dbname Or save the output, put it on db server and load it there. I don't see why though. Just run migrate on the server that runs django. -- Melvyn Sopacua -- You received this message because you are subscri

Re: stop backgroundworker

2017-03-06 Thread Melvyn Sopacua
t location for an updated value. I recommend Redis for this > purpose. +1. In fact, I would not use Django to set the "stop looping" flag, since there is no advantage to that, unless the stops need to be tied to content in the database. But to just alter a value in redis, I'd use

Re: Chart library for django

2017-03-06 Thread Melvyn Sopacua
- graph type often depending on data - title, legend, labels All this is dictated by the content at the server and has to be injected into js via template rendering. The packages in that grid aim to do just that (and I cound 3 that use highcharts). -- Melvyn Sopacua -- You received this messa

Re: Issue with Django-axes

2017-03-06 Thread Melvyn Sopacua
_BACKENDS[1] reject inactive users." >From the docs[2]. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/settings/#std:setting-AUTHENTICATION_BACKENDS [2] https://docs.djangoproject.com/en/1.10/topics/auth/default/ -- You received this message because you ar

Re: Chart library for django

2017-03-06 Thread Melvyn Sopacua
On Sunday 05 March 2017 22:10:07 Luvpreet Singh wrote: > I am looking for some solution to display django database queryset to > django admin over graphs. https://djangopackages.org/grids/g/charts/ Problem is, the majority is abandonware. -- Melvyn Sopacua -- You received this m

Re: How do you populate an update form in a Bootstrap Modal?

2017-03-05 Thread Melvyn Sopacua
form media in the AdditionalFormsManager, so it certainly isn't production quality yet - but it will work just fine for illustration purposes or base for your own code. -- Melvyn Sopacua [1] https://gist.github.com/melvyn-sopacua/2e848fa5b8be0f53c2a5267ba68d570e -- You received this

Re: How do you populate an update form in a Bootstrap Modal?

2017-03-05 Thread Melvyn Sopacua
to prepopulate the form in the modal you need to provide the instance argument and assign it the model instance. I assume you know what model instance you need to update. -- Melvyn Sopacua [1] https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/ModelFormMixin/ --

Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error

2017-03-05 Thread Melvyn Sopacua
u either: 1/ Do a redirect, which is the simplest 2/ Request your resources incorporating the session id I still would go for 1/, simply because that fixes the disconnect between template path / view path and requested url. -- Melvyn Sopacua -- You received this message because you are subscr

Re: How to keep track of online users?

2017-03-02 Thread Melvyn Sopacua
tatus" you'd need to use your own session store to store the additional "last_online" field and middleware to update it automatically. Code above contains ample hints for you to start digging. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/topics/htt

Re: Django context translations with dynamic variables

2017-03-02 Thread Melvyn Sopacua
code? Wel, you can create your own commands: https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/ And your own tags: https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/ So if waiting for a next release that may or may not have this functionality does not fit

Re: Django context translations with dynamic variables

2017-03-02 Thread Melvyn Sopacua
Then makemessages should generate a string with msgctxt for each of the choices. You could do this already, by rolling your own "trans" tag and "makemessages" command. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "

Re: Django Migrations?

2017-03-02 Thread Melvyn Sopacua
If you: - ran migrate --fake - created a new migration fixing the error Then yes, it will still bother you when deploying a new instance. Don't see how that could bother you on a database that is already migrated though. -- Melvyn Sopacua -- You received this message because you are sub

Re: Django Migrations?

2017-03-01 Thread Melvyn Sopacua
is largely depending on the error. -- 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: good 404 vs bad 404

2017-03-01 Thread Melvyn Sopacua
A different approach would be to treat the notification mails the way you treat spam. Notifications that are "user errors" are "spam", notifications that are "application errors" are "ham". Using baysian filtering, the number of "user errors" should dem

Re: database update after paypal payment

2017-03-01 Thread Melvyn Sopacua
ayPal: - Check for success / failure - If success: set paid to True, redirect to /thank-you - else: display error and cart -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: Template packages for simple data entry and table data management for business applications

2017-02-25 Thread Melvyn Sopacua
n objects[3] * Tighter permissions[4] * RichText Editor: CkEditor[5] / TinyMCE[6] -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.Mode lAdmin.list_display [2] https://djangopackages.org/grids/g/admin-interface/ [

Re: Benefit of 'return Foo.objects.all()' in a ListView

2017-02-25 Thread Melvyn Sopacua
hod() is True ] group2 = [ obj for obj in qs if obj.boolean_method() is False ] # update the context context.update( { 'group1': group1, 'group2': group2 } ) # and return it

Re: Benefit of 'return Foo.objects.all()' in a ListView

2017-02-25 Thread Melvyn Sopacua
return self.model.objects.filter(user=self.request.user) -- 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...@goo

Re: Connecting to a database with logged in user credentials

2017-02-23 Thread Melvyn Sopacua
ink was posted: https://github.com/ambitioninc/django-dynamic-db-router So no, they're not static. This package may not suit your needs, but it's mechanism with a custom router should help you along. -- Melvyn Sopacua -- You received this message because you are subscribed to the Goog

Re: Many to Many in Django Admin

2017-02-23 Thread Melvyn Sopacua
On Thursday 23 February 2017 05:22:25 José Vicente Jonas França wrote: > I Like to know if its possible to display the many-to-many field in > both pages of Model at Django Admin. > If it is possible how can i do this? All available in the documentation[1]. -- Melvyn Sopacua --

Re: Flattening model relationships (in APIs)

2017-02-23 Thread Melvyn Sopacua
use it to render easily. You can then use AddressSerializer to provide the full structured address, so it can be used for writes. You may need to customize how it flattens the models, but that's what DRF's documentation[1] is for. -- Melvyn Sopacua [1] http://www.django

Re: Issues saving hex format data to binaryfield

2017-02-23 Thread Melvyn Sopacua
ot even Model(not_editable_value='foo'). It merely means, that you will implement saving the value without the help of ModelForm. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from th

Re: Issues saving hex format data to binaryfield

2017-02-23 Thread Melvyn Sopacua
et_rfid not save(). If you call save() after calling set_rfid, the value isn't saved? -- 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 emai

Re: Models/Foreign Keys best practice

2017-02-22 Thread Melvyn Sopacua
es for each role. These are reasons to use Foreign Keys. Otherwise, just use a CharField. If you don't need to record anything special about roles, there's also the middle ground using a field's choices[2]. You use choices instead of a Foreign Key if they hardly ever change and

Re: Initial data, tests and migrations

2017-02-22 Thread Melvyn Sopacua
o_otp.tests import SuperTest class SuperTestWithMyData(SuperTest): fixtures = ['my_data'] -- 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

Re: Initial data, tests and migrations

2017-02-22 Thread Melvyn Sopacua
On Wednesday 22 February 2017 14:22:36 'Tom Evans' via Django users wrote: > On Wed, Feb 22, 2017 at 12:47 AM, Melvyn Sopacua wrote: > > On Tuesday 21 February 2017 19:00:42 'Tom Evans' via Django users wrote: > >> What is the "correct&quo

Re: Is this possible with Django, new to this!

2017-02-22 Thread Melvyn Sopacua
This isn't in my project requirements, so I'm only recording stock mutations. If I had to, I'd switch my custom mutations to one of these audit trail packages[5]. So in conclustion it certainly is possible, but do it for the right reasons :). -- Melvyn Sopacua [1] h

Re: Subquery has too many columns

2017-02-21 Thread Melvyn Sopacua
> > from model_mommy import mommy > > from core import models > > class FaturamentoTest(TestCase): > > def test(self): > faturamento = mommy.make(models.Faturamento) > produto = faturamento.produto_servico > try: > produto.save(

Re: Initial data, tests and migrations

2017-02-21 Thread Melvyn Sopacua
run? All explained in the docs[1]. Either redeclare the same fixtures for different test cases or reorganize your testcases to share the same fixture(s). -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/topics/testing/tools/#django.test.TransactionTe stCase.fixtures --

Re: Timeout when saving model in django admin page

2017-02-21 Thread Melvyn Sopacua
ing a WSGI request that come into play. Increasing those, also means you tie up resources and are more succeptable to denial of service, so if celery is an option, take it. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users"

Re: authenticate function is always returning none in views.py

2017-02-21 Thread Melvyn Sopacua
#x27;') > user = auth.authenticate(username=username, password=password) > placeholder="Password"> -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Subquery has too many columns

2017-02-21 Thread Melvyn Sopacua
test_base_manager_update(*self*): *self.cart.items.update*(*is_shipped*=True) *shipped *= *self.cart.items.filter*(*is_shipped*=True)*.count*() *self.assertEqual*(*shipped, 2*) * > On Saturday, February 18, 2017 at 9:20:03 PM UTC-3, Melvyn Sopacua wrote: > >

Re: Implementing a basic search for my website

2017-02-20 Thread Melvyn Sopacua
nding the 2 conditions, which should be fast and the second somewhat more complex: where NOT the anded condition and the OR condition. Which to pick, is really a matter of performance: which method does best under pressure and what resource can you scale cheaper / faster? -- Melvyn Sopacua

Re: any idea for get_absolute_url in m2m categories

2017-02-20 Thread Melvyn Sopacua
return reverse('mymodel_detail', args=(), kwargs=kwargs) urls.py: urlpatterns = ( url( '^(?P[a-z0-9-A- Z_-]+)/(?[0-9]+)-(?P[a-z0-9-A-Z_-]+)/$', views.MyModelDetailView.as_view(), name='mymodel_detail'

Re: any idea for get_absolute_url in m2m categories

2017-02-20 Thread Melvyn Sopacua
e, this still is probably incorrect, since this doesn't contain the app prefix). -- 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 t

Re: Subquery has too many columns

2017-02-18 Thread Melvyn Sopacua
t=True) > descricao = models.TextField() > objects = ProdutoServicoManager() > > class Meta: > base_manager_name = 'objects' Cause this doesn't actually do anything, beside being explicit. -- Melvyn Sopacua -- You received this message because you are s

Re: Extract Date-From and Date-To in DateRangeField django

2017-02-17 Thread Melvyn Sopacua
On Friday 17 February 2017 06:24:25 RON MICHAEL wrote: > No NOT duration. I simply want to get the date_from and the date_to > which is inside the DateRange. You mean the lower and upper[1]. -- Melvyn Sopacua [1] http://initd.org/psycopg/docs/extras.html#psycopg2.extras.Date

Re: A sort algorithm?

2017-02-17 Thread Melvyn Sopacua
intersect: Room 1 for today: start: 9 hours: 4 becomes set(9, 10, 11, 12) Room 2 for today: start 11: hours: 2 becomes: set(11, 12) Room 3 for today: start: 12 hours: 4 becomes set(12, 13, 14, 15) Target: start: 11 becomes set(11) Room 1 and 2 intersect with target. Room 3 is needed at 12 becau

Re: Is it possible to save children before parents?

2017-02-15 Thread Melvyn Sopacua
On Wednesday 15 February 2017 19:17:55 Mike Dewhirst wrote: > On 14/02/2017 12:14 PM, Melvyn Sopacua wrote: > > P.S. I left two bugs in there, for now I'll leave them in as an > > exercise for the reader. > > Three bugs ... and 2 questions: > > 1. You obviously f

Re: Is it possible to save children before parents?

2017-02-13 Thread Melvyn Sopacua
P.S. I left two bugs in there, for now I'll leave them in as an exercise for the reader. -- 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, se

Re: Is it possible to save children before parents?

2017-02-13 Thread Melvyn Sopacua
as to what ImageField does with it's width and height fields. Here's an example: https://gist.github.com/melvyn-sopacua/1b4e4585ab15ffc176798c083470cf04 -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: How can I solve the broken home page in the root folder?

2017-02-03 Thread Melvyn Sopacua
p like any other. It is only special because it is the entry point of the project, but nothing prevents you from adding models and views there as well. When homepages become complicated this is exactly what people do. Either that, or they create a "homepage" app. -- Melvyn Sopacu

Re: Web-based Voting System for our capstone project

2017-02-03 Thread Melvyn Sopacua
an I customize my admin page and make some > > dashboard about the students(who have already voted and those who > > haven't yet), -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.Mode lAdmin.list_display [2

Re: Link to urls containing slug

2017-02-03 Thread Melvyn Sopacua
se is needed. Slug, ideally, is also unique, so pick one, not both. -- 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+unsub

Re: formset in form_class

2017-02-03 Thread Melvyn Sopacua
aram': 'a', > 'choosen': 'value'}] > return form_class(initial=initial) -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop re

Re: DJANGO images(upload/download)

2017-02-03 Thread Melvyn Sopacua
rested in the GIS module[1]. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/gis/ -- 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: set_language language switcher with 3 languages

2017-02-03 Thread Melvyn Sopacua
ld be set in the view's context. This ensures you stay at the same page - just in another language. So if the language isn't set properly, something else is going wrong. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users&quo

Re: Limiting choices in a lookup by exclusion

2017-02-01 Thread Melvyn Sopacua
the choices of phone numbers for > > Locations to those that aren't 'C' (cell phones) - I've found some > > hints,> > > but they're all for older versions of Django - it seems like: > > phone = models.ManyToManyField(Phone, limit_choices_to = &g

Re: good doc and example on how to use bootstrap with DJango

2017-02-01 Thread Melvyn Sopacua
ve/django-bootstrap3 > Is there any decent documentation and examples of using locally > installed bootstrap with django? Answered by Andreas. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Issue with Tutorial pt 5 "Fixing the bug"

2017-01-29 Thread Melvyn Sopacua
awesome_factory function - so this works. The result is that in the outer scope Awesome and Magnificent are identical models with a different name and that TheBomb has a name field that enforces uniqueness. Hope this sheds some light on things :) -- Melvyn Sopacua -- You received this mes

Re: set_cookie raise exception when the value contains Unicode charset

2017-01-29 Thread Melvyn Sopacua
project.com/en/1.10/ref/settings/#default-charset I believe your default charset is set to 'iso-8859-1'. -- 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: Django Debug Toolbar installation

2017-01-29 Thread Melvyn Sopacua
at's the same problem since you're pushing settings.py to the server. And for that, see how Mezzanine solved it using a local_settings.py that is not pushed to the server. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django us

Re: form_invalid

2017-01-29 Thread Melvyn Sopacua
la" for demo_code in the form and you will see form_invalid being called. *def clean(*self*):if *self.data[*'demo_code'*] *!= 'valid':raise *ValidationError*('{}: Invalid demo code'*.format*( *self.data[*'demo_code'*]

Re: limiting the drop down option of a one-to-one relationship in the admin app. is that possible ?

2017-01-29 Thread Melvyn Sopacua
est.user) qs = > modelStudent.objects.filter(school=schoolInstance) return qs > > def get_form(self, request, obj=None, **kwargs): This self isn't the form. It's the model admin and should return a ModelForm. The docs I linked has a complete example you can build on. -- Me

Re: limiting the drop down option of a one-to-one relationship in the admin app. is that possible ?

2017-01-28 Thread Melvyn Sopacua
, set the user to request.user. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#adding-custom-validation-to-the-admin -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group a

Signals and dispatch uid

2017-01-28 Thread Melvyn Sopacua
_hash within hash_field(), which is less then ideal as it requires the consuming model to alter it's __init__(). Am I missing an option to do this with dispatch_uid from within the field? -- Melvyn Sopacua /# noinspection PyUnresolvedReferences /*class HashDescriptor(/object/):def update

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-27 Thread Melvyn Sopacua
nuar 2017 18:32:23 UTC+1 schrieb Melvyn Sopacua: > > On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users wrote: > > > Also I used the tutorial just that I abstracted the concept since > > > I > > > > > > think the tutorial is more th

Re: MultiValueDictKeyError on 'for' loop

2017-01-27 Thread Melvyn Sopacua
otal_forms_count is not in sync with the number of formsets. How? Too much template code and ajax deps to figure out for me, but start here[1]. My gut says you're off-by-one because of forloop.counter usage. -- Melvyn Sopacua [1] http://localhost/doc/py-django/html/topics/forms/for

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-27 Thread Melvyn Sopacua
On Monday 16 January 2017 07:49:00 'Peter Müller' via Django users wrote: > Also I used the tutorial just that I abstracted the concept since I > think the tutorial is more than bad. Awaiting your PRs. -- Melvyn Sopacua -- You received this message because you are subscrib

Re: Multiple (limited) Admin feature for each registered user - Best Approach.

2017-01-26 Thread Melvyn Sopacua
ermissions per object. Finer-grained control can be achieved with custom permissions[3] and the user_passes_test decorator[4]. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.Mode lAdmin.has_change_permission [2] https://docs.d

Re: Comparing two lists

2017-01-26 Thread Melvyn Sopacua
return hasattr(self, 'addresses') and \ self.addresses.filter(street__pk=patientid).count() > 0 Remember that Django Template Language strives to keep programming out of the template, so either do the above in your model or in your view when buil

Re: Extended user model to add Profile class want to slugify first_name last_name in profile class

2017-01-25 Thread Melvyn Sopacua
*viewname *= *self._detail_view_name *or '{}_detail'*.format*(*model_name*)return *viewname, [*/str/(*self.slug*)*] absolute_url *= /property/(*get_absolute_url, doc*="Permalink") class Meta:*abstract *= True * -- Melvyn Sopacua [1] https://docs.

Re: Validating and cleaning related models ...

2017-01-25 Thread Melvyn Sopacua
ists without >albums, so maybe implementing a procedure that generates that list for content maintainers to process is the better way to guard integrity, since that also covers the case of a DBA "deleting all albums before 1970". -- Melvyn Sopacua [1] http://loc

Re: Extended user model to add Profile class want to slugify first_name last_name in profile class

2017-01-25 Thread Melvyn Sopacua
value from a custom callable # (ex. usage: user profile models) slug = AutoSlugField(populate_from=lambda instance: instance.user.get_full_name()) Which is basically what you try to accomplish in the admin. -- Melvyn Sopacua [1] https://pypi.python.org/pypi/django-autoslug -- You received

Re: Multiple forms in the same template

2017-01-25 Thread Melvyn Sopacua
uses UpdateView[1] which pulls in ModelFormMixin. So this view needs a fields attribute: class M MFormsView(LoginRequiredMixin, StaffuserRequiredMixin, UpdateView, MFView): fields = ['foo', 'bar', 'baz'] -- Melvyn Sopacua [1] https://ccbv.co.u

Re: Issue with Tutorial pt 5 "Fixing the bug"

2017-01-24 Thread Melvyn Sopacua
On Monday 23 January 2017 08:22:28 John Wall wrote: > > class QuestionAdmin(admin.ModelAdmin): > fieldsets = [ and whoops: > class QuestionAdmin(admin.ModelAdmin): You have 2, sir. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Gro

Re: Multiple forms in the same template

2017-01-24 Thread Melvyn Sopacua
t ModelJSONEncoder >>> ModelJSONEncoder.__mro__ (, , , ) -- Melvyn Sopacua [1] https://ccbv.co.uk/projects/Django/1.10/django.views.generic.base/ContextMixin/ [2] https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/ProcessFormView/ [3] https://ccbv.co.uk/projects/Django

Re: Multiple forms in the same template

2017-01-23 Thread Melvyn Sopacua
eems. What's the relation between the forms? If they're unrelated, implement get_context_data() to assign them, and form_valid() to process them. Also, bookmark this: https://ccbv.co.uk/ -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.9/releases/1.8/#miscellaneous [2] htt

Re: audit trail functionality in database model

2017-01-23 Thread Melvyn Sopacua
l functionalities. Don't reinvent the wheel. There's more then enough to choose from: https://djangopackages.org/grids/g/model-audit/ -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this gr

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Melvyn Sopacua
hat uniquely identifies the object and then override get_object() to work with that. Note that little added security is gained from hiding the PK, but if user-friendly URLs is what you're after, slugs (or some other field(s) with unique=True) are the way to go. -- Melvyn Sop

Re: prepopulate form with model instance values using UpdateView and ModelForm

2017-01-18 Thread Melvyn Sopacua
t with field values from the instance. Any missing values get assigned defaults. * Delete view: gets an instance ID and removes it. Field values typically do not come into play. Does this conflict with what you're trying to accomplish? -- Melvyn Sopacua -- You received this messa

Re: How to make a queryset into a database, starting from a template html

2017-01-18 Thread Melvyn Sopacua
There's a reusable app that has solved this and I know is stable: https://github.com/digi604/django-smart-selects There's also: https://github.com/lehins/django-smartfields but seems to become abanonware and I've never used it so can't comment on how well it works. -- M

Re: models foreign key

2017-01-15 Thread Melvyn Sopacua
" is not the problem. Use: python manage.py sqlmigrate to show the SQL created for that migration. If you see no foreign key being created in the SQL, then follow-up with the code of the migration file and the SQL shown by above command. > On Sun, Jan 15, 2017 at 12:16 AM, Mel

Re: Override base filter for model's queryset (Django 1.6)?

2017-01-15 Thread Melvyn Sopacua
is doesn't set the default filter to 'general', but it does make filtering transparent (and allows access to objects which are not 'general'). P.S.: The reason I pointed to 1.10 docs is simple: 1.6 is no longer supported by the Django Project and it's documentation ha

Re: Override base filter for model's queryset (Django 1.6)?

2017-01-14 Thread Melvyn Sopacua
On Saturday 14 January 2017 21:20:32 Derek wrote: > and I also want to override the base filter for > the model's > queryset to limit what is displayed. This is covered in the Manager documentation[1] in detail. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/

Re: Issue whe migrate with relation between tables in different schemas

2017-01-14 Thread Melvyn Sopacua
mented at the project level, not on a table level and for a specific purpose. And finally, there's this approach[3], where you'd have to write the routing yourself - trivial to do and when done correctly should be easy to refactor to any solution Django comes up with in fu

Re: Decrease amount of identical "Email reports"

2017-01-14 Thread Melvyn Sopacua
o this kind of thing. It's best to look there and not in the web framework. Chances are your admins already have some sort of monitoring in place, so look for something that ties in (can be tied in) with that. -- Melvyn Sopacua -- You received this message because you are subscribed t

Re: models foreign key

2017-01-14 Thread Melvyn Sopacua
How did you determine there's no connection? What database are using? If using MySQL do you have InnoDB storage engine enabled? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group an

Re: Get current site inside model

2017-01-14 Thread Melvyn Sopacua
self._meta.object_name.lower*())return *reverse*(*viewname*) /@/classmethoddef set_site_for_model(*cls, site_id_or_obj*):if /isinstance/(*site_id_or_obj, Site*):*cls._site_id *= *site_id_or_obj.pk*else: *cls._site_id *= *site_id_or_obj */

Re: Problem in django tutorial 5 , 1044 Access denied for user @'localhost' database error

2017-01-12 Thread Melvyn Sopacua
tabase 'test_myproject'") > I also ran ,"GRANT ALL PRIVILEGES ON test_myproject TO > 'myprojectuser'@'localhost';" , in mysql This isn't the same as: GRANT ALL PRIVILEGES ON test_myproject.* TO ...; which is what you need. Yes, I'm ma

Re: Question Is Django Rest Framework only for APIs or can i Use it to create Users for a website?

2017-01-10 Thread Melvyn Sopacua
* to *your application*. Django Rest Framework exposes your *internal API* to *other applications*. -- 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 e

Re: Method Flowchart for Generic Editing Views

2017-01-10 Thread Melvyn Sopacua
wever, for the generic editing views this seems to be missing. ... > Is there a place where I can see the method flowchart for the generic > editing views? I believe you missed the link in the documentation: https://ccbv.co.uk/ It's probably more than one can do in the documentation. --

Re: Advise for first project in Django

2016-12-30 Thread Melvyn Sopacua
I'd like to know if it's feasible or not ? Do you mean that users can login, upload their music and listen to it anywhere? Here's some starters: * HTML 5 multimedia[1] * Streaming Server[2] * Django Accounts[3] / Mezzanine Accounts[4] -- Melvyn S

Re: Djnago project to installer

2016-12-28 Thread Melvyn Sopacua
ground. The Django part is easy, even having a pre-set settings.py can be done and a pre-filled SQLite database can be shipped as well. The hard part is to fire it up and shutdown when you need it to. Is this for presentation of a new website or for an stand-alone application? -- Melvyn Sopacua --

Re: Subclassing Models in non model class

2016-12-28 Thread Melvyn Sopacua
class parameters. > > Idea is to create a model and use that model with non db reference in > admin.py. Following is the code: It's quite unclear what you want and why you want it especially. What does this other Address model represent? -- Melvyn Sopacua -- You received this messag

Re: bug of session middleware --- session never expires

2016-12-28 Thread Melvyn Sopacua
7;t know about it anymore. So the old session *could* be taken over by someone listening on the wire. This is why encryption is paramount and browser now support Strict Transport Security[1]. -- Melvyn Sopacua [1] https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Bes

Re: How to display user's photo that i follow in post's list in Django

2016-12-25 Thread Melvyn Sopacua
if *self.following.get*(*user*=*user*)*.count*() > *0*:return *user.profile.photo.url*return Noneexcept *user.ObjectDoesNotExist*:return Noneelse:return *user.profile.photo -- Melvyn Sopacua -- You received this message b

Re: How do I translate site.name to other languages?

2016-12-25 Thread Melvyn Sopacua
but since Site is a Django Model, have a look at Django Model Translation[1]. I suspect once you get the idea, you'll use it throughout the project. -- Melvyn Sopacua [1] http://django-modeltranslation.readthedocs.io/en/stable/registration.html -- You received this message b

Re: bug of session middleware --- session never expires

2016-12-25 Thread Melvyn Sopacua
is the reason you want this? It's almost never a good a thing. Only good case I can think of is in game or test settings, where you need to complete certain tasks within a set timeframe. -- Melvyn Sopacua [1] https://docs.djangoproject.com/en/1.10/topics/http/sessions/#browser-len

Re: How to display user's photo that i follow in post's list in Django

2016-12-22 Thread Melvyn Sopacua
ay their photo. * in Profile.get_photo() you set users to self.photo. I don't think you wanted to do that. -- 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, sen

Re: Postgres SQL vs SQLite vs MS SQL vs MY SQL

2016-12-22 Thread Melvyn Sopacua
s simple: What can MSSQL do, that you actually *use* that others cannot. When you put the emphasis on feature use, a lot of propriety software becomes schockingly expensive and cheap to work around / do differently in perspective. -- Melvyn Sopacua -- You received this message because you a

Re: Unique app name error problem when building a Wagtail multisite solution

2016-12-22 Thread Melvyn Sopacua
example Mezzanine) that is. Especially one that uses the multi-tenancy that is built-in to django through the sites module. Don't work against the flow :) -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To un

Re: strategies for adding a custom group permission

2016-11-09 Thread Melvyn Sopacua
ttps://docs.djangoproject.com/en/1.10/topics/auth/default/#django.contrib.auth.decorators.user_passes_test> -- 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 i

Re: Admin - saveasnew to another database

2016-11-09 Thread Melvyn Sopacua
to use serialization with natural keys and a job scheduler. Cron will do, but there's plenty other schemes allowing you to provide feedback about the job queue and expected time of completion. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups &qu

Re: Canonical way of handling multiple types of users? (Profiles vs subclassing django.contrib.auth.models.AbstractUser)

2016-11-09 Thread Melvyn Sopacua
e/password. Another is having different authentication servers and what server to use is depending on a field that isn't in the user model, like "faculty" or "signup_date.year". Hope this helps, -- Melvyn Sopacua -- You received this message because you are subscribed to t

Re: Need help to catch "cart_id" based on session.

2016-11-07 Thread Melvyn Sopacua
ss a cart id SHALL be present in the session and as such we need to error out hard and not suppress. This is a configuration issue by OP or a bug in the software, but I'm not familiar enough with doorsale to say which. At first glance though, the view handling it and the views preceeding t

<    1   2   3   4   5   6   7   >