Hello everyone, having problems with making my statent reflecting uptodate average balances and also making debits and credits in this microfinance app am trying to develop any help and modifications to make it better will be highly appreciated
On Fri, Sep 27, 2013 at 4:06 PM, <django-users@googlegroups.com> wrote:
Group: http://groups.google.com/group/django-users/topics
- Homepage in Django [3 Updates]
- example for project with user login [2 Updates]
- Multiple django web applications [2 Updates]
- How to do 2-ModelForm-in-1-CVB right? [2 Updates]
- How to use selenium test against different browsers using LiveServerTestCase [5 Updates]
- Bootstrap - django-bootstrap3 or django-crispy-forms [4 Updates]
- IntegrityError with proxy model but not with parent? [1 Update]
- Recommended dev environment for a Django project deployed to Linode [1 Update]
- Django query Advanced [1 Update]
- Responsive design [2 Updates]
- django admin: integrate django-modeltranslation + django-ckeditor into 3rd party module [1 Update]
Iuri Machado <imet.ilm@gmail.com> Sep 27 05:54AM -0700
Hello everyone, I've got a silly question.
Let's say I've create a project called CAFis. My folder structure should be
like:
CAFis
- CAFis
| - __init__.py
| - settings.py
| - urls.py
| - wsgi.py
If I want to create a homepage for my project, should I create a views.py,
inside the subfolder CAFis, with only a function called index and then
create a templates/static subfolder inside the subfolder CAFis?
(New structure)
CAFis
- CAFis
| - templates
| | - index.html
|
| - static
| | - foo.js
| | - foo.css
|
| - __init__.py
| - settings.py
| - urls.py
| - views.py
| - wsgi.py
Thanks in advance!
I.
"Rafael E. Ferrero" <rafael.ferrero@gmail.com> Sep 27 10:02AM -0300
Thats its one aproach other its to handle directly with your webserver. I
delegate to webserver all static stuff and leave django to handle dinamic
thing.
see ya!
2013/9/27 Iuri Machado <imet.ilm@gmail.com>
--
Rafael E. Ferrero
Iuri Machado <imet.ilm@gmail.com> Sep 27 06:04AM -0700
Thank you buddy! :)
Em sexta-feira, 27 de setembro de 2013 10h02min27s UTC-3, vicherot escreveu:
Joachim Wuttke <j1wuttke@gmail.com> Sep 27 02:47AM -0700
Could you kindly point me to a code example for a Django project with user
login?
- Joachim
"Rafael E. Ferrero" <rafael.ferrero@gmail.com> Sep 27 09:42AM -0300
Please, can you be more specific?
Did you mean on Admin Interface? (just activate admin)
In your views? (use decorator)
in your templates? (use request.user.is_authenticated() on a if block)
Are more complex ways to do this by your own or you have apps to do this
like allauth (who give you a way to your visitors to login with facebook
id, or twitter, etc)
hope to help you on this
2013/9/27 Joachim Wuttke <j1wuttke@gmail.com>
--
Rafael E. Ferrero
drakko <gundars.m@gmail.com> Sep 27 01:54AM -0700
Hello django gurus!
I wanted to kindly ask if there is a way how to keep two django web
application on the same server?
I have heard that it might be possible by using virtualenv. But as I'm new
to python and web development I wanted to find out if what kind of
approaches there are to achieve this goal.
Thank You!!
drakko
"Rafael E. Ferrero" <rafael.ferrero@gmail.com> Sep 27 09:35AM -0300
I'm not a guru but...
If you want to run two differents django projects with different versions
of django then i think that virtualenv can help you... are some tutorial
somewhere.
If you want to run two differentes django projects with same version of
django then just use virtual on appache (i do this on my server for two
small projects) or similar stuff for nginx or lighttpd.
Hope to help you
2013/9/27 drakko <gundars.m@gmail.com>
--
Rafael E. Ferrero
Yu Chen <robin.chenyu@gmail.com> Sep 26 06:03PM -0700
Inlineformset may solve your problem, and this
http://haineault.com/blog/155/ is a good example.
在 2013年9月26日星期四UTC+8下午1时19分41秒,Adam写道:
Adam <jiang.adam@gmail.com> Sep 27 02:26AM -0700
2013年9月27日金曜日 10時03分09秒 UTC+9 Yu Chen:
> Inlineformset may solve your problem, and this
> http://haineault.com/blog/155/ is a good example.
In the sample code, CBV has to attached to FormView and has to provide one
'form_class' member. Another extra form is set by context_data. It is still
not perfect. For example, consider a dynamic formset with which you can
create new objects by adding new forms in UI. In this case, it is not easy
to handle all forms in one view.
/Adam
Tianyi Wang <wty52133@gmail.com> Sep 26 09:46AM -0700
Hi guys,
So follow the Django doc example,
https://docs.djangoproject.com/en/dev/topics/testing/overview/#django.test.LiveServerTestCase
In the example, the test only test against Firefox. How can I test against
different browsers without duplicate the example code?
Thanks
Tianyi
"Rafael Durán Castañeda" <rafadurancastaneda@gmail.com> Sep 26 07:18PM +0200
Hi,
I don´t know any out-of-the-box solution for this, but sure you can write your own test runner/suite, so any selenium test is run by multiple browsers (maybe just using settings to select the browser). However, if you are really concerned about testing on multiple browsers, multiples version for each one, multiple OS,… you might look at any of the available solutions for cross browser testing as a service.
HTH
Evan Leis <evan.explodes@gmail.com> Sep 26 11:55AM -0700
Alright, tested tried and True:
The following code provides the ability to decorate tests so that a whole
list of drivers is used... see the docs for examples...
import functools
def test_drivers(pool_name='drivers', target_attr='selenium'):
"""
Run tests with `target_attr` set to each instance in the `WebDriverPool`
named `pool_name`.
For example, in you setUpClass method of your LiveServerTestCase:
# Importing the necessaries:
from selenium import webdriver
### In your TestCase:
# Be sure to add a place holder attribute for the driver variable
selenium = None
# Set up drivers
@classmethod
def setUpClass(cls):
cls.drivers = WebDriverList(
webdriver.Chrome(),
webdriver.Firefox(),
webdriver.Opera(),
webdriver.PhantomJS,
)
super(MySeleniumTests, cls).setUpClass()
# Tear down drivers
@classmethod
def tearDownClass(cls):
cls.drivers.quit()
super(MySeleniumTests, cls).tearDownClass()
# Use drivers
@test_drivers()
def test_login(self):
self.selenium.get('%s%s' % (self.live_server_url, '/'))
self.assertEquals(self.selenium.title, 'Awesome Site')
This will run `test_login` with each of the specified drivers as the
attribute named "selenium"
"""
def wrapped(test_func):
@functools.wraps(test_func)
def decorated(test_case, *args, **kwargs):
test_class = test_case.__class__
web_driver_pool = getattr(test_class, pool_name)
for web_driver in web_driver_pool:
setattr(test_case, target_attr, web_driver)
test_func(test_case, *args, **kwargs)
return decorated
return wrapped
class WebDriverList(list):
"""
A sequence that has a `.quit` method that will run on each item in the
list.
Used to easily "quit" a list of WebDrivers.
"""
def __init__(self, *drivers):
super(WebDriverList, self).__init__(drivers)
def quit(self):
for driver in self:
driver.quit()
On Thursday, September 26, 2013 10:46:43 AM UTC-6, Tianyi Wang wrote:
Arnold Krille <arnold@arnoldarts.de> Sep 26 09:32PM +0200
On Thu, 26 Sep 2013 09:46:43 -0700 (PDT) Tianyi Wang
> https://docs.djangoproject.com/en/dev/topics/testing/overview/#django.test.LiveServerTestCase
> In the example, the test only test against Firefox. How can I test
> against different browsers without duplicate the example code?
I would propose this:
In your classes __init__ (or in the init of your mixin specially for
this) check for an environment-variable or a django-setting to tell you
the browser to use. With a fallback if nothing is defined.
Then when you run the tests locally, you can decide which browser to
use. And when run in jenkins, the browser is a matrix-variable giving
you functional tests with all the defined browsers.
Have fun,
Arnold
Tianyi Wang <wty52133@gmail.com> Sep 27 01:46AM -0700
Thanks for all your answers.
On Thursday, 26 September 2013 17:46:43 UTC+1, Tianyi Wang wrote:
Nigel Legg <nigel.legg@gmail.com> Sep 26 01:53PM +0100
Hi, I've been looking into using Bootstap3 on the django app I'm working
on. It seems you can do this with both django-bootstrap and crispy-forms.
Am I right in thinking that django-bootstap allows you to use bootstrap
across the whole site, while crispy forms is just for forms? So you can
use both together? Or am I missing something?
Cheers, Nigel
07914 740972
Sam Lai <samuel.lai@gmail.com> Sep 27 09:23AM +1000
Yep. django-bootstrap-* and django-crispy-forms only provide helpers
for outputting HTML with bootstrap CSS classes. Neither are really
necessary to use Bootstrap (just makes it slightly easier), which is
applied through HTML and CSS and Django doesn't place any restrictions
on how your HTML/CSS is structured.
Lachlan Musicman <datakid@gmail.com> Sep 27 03:19PM +1000
this is probably the answer you want:
http://stackoverflow.com/a/11795186
L.
--
Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013:
When you used to be punk, and now you are still punk but not as punk,
are you post-punk or decaying punk or ex-punk or just not punk anymore
Nigel Legg <nigel.legg@gmail.com> Sep 27 07:41AM +0100
Thanks both.
Cheers, Nigel
07914 740972
"Rafael Durán Castañeda" <rafadurancastaneda@gmail.com> Sep 27 12:08AM +0200
Hi,
As long as I know, a model form needs the fields to be included in order to get validation working, so I suspect you did something like this:
class ProxyForm(forms.ModelForm):
class Meta:
model = models.Myproxy
fields = ('name', )
Since stuff field is not included in the form fields validation doesn't work for it, however you can get it working with something like this:
class ProxyForm(forms.ModelForm):
stuff = forms.CharField(widget=forms.HiddenInput, initial='stuff')
class Meta:
model = models.Myproxy
fields = ('name', 'stuff',)
Thought you probably need customize validation/error messages or you will get messages like:
Parent with this Name and Stuff already exists.
for a form that does´t include stuff as a hidden input.
HTH
Ezequiel <ediazpacheco@gmail.com> Sep 26 10:54AM -0700
On Wednesday, September 25, 2013 3:06:55 PM UTC-3, Jorge Arevalo wrote:
> Fine. I don't think my boss is going to pay for PyCharm license, so I'll
> probably go for Eclipse now (I don't really like it too much, but if works,
> it's ok for me)
PyCharm, which is my favorite IDE, has now a Free Community
Edition: https://twitter.com/pycharm/status/382549991165673472
Best,
Ezequiel
http://flickrock.com/mikelpierre
"Hélio Miranda" <helio13m@gmail.com> Sep 26 08:54AM -0700
I am trying a query like this:
result = json.dumps([a.get_json() for a in Player.objects.filter((Q(name=namepost) | Q(surname="Coimbra")))])
return HttpResponse (result, content_type = 'application / json')
But it gives me the following error: Not a query object: (AND: ('surname', 'Coimbra'), ('name', u'Rui ')). Did you intend to use key = value?
get_json def (self):
return {
'name': self.name,
'surname': self.surname,
'country': [{'name': b.name} for b in self.country]
}
If I do well
result = json.dumps([a.get_json() for a in Player.objects.filter(name=namepost)])
works well
What am I doing wrong? Someone can help me?
"Rafael E. Ferrero" <rafael.ferrero@gmail.com> Sep 26 10:32AM -0300
And you can use bootstrap with Django Bootstrap
Toolkit<https://github.com/dyve/django-bootstrap-toolkit>
2013/9/26 Rafael E. Ferrero <rafael.ferrero@gmail.com>
--
Rafael E. Ferrero
Christiano Anderson <christiano.anderson@gmail.com> Sep 26 11:14AM -0300
Django gives you all the freedom to create responsive layouts or not.
To be responsive or not is not related to Django, but to the templates you
create. You can also use a CSS framework like Bootstrap, BluePrint or your
favourite to create your templates as you like.
Cheers
--
Christiano Anderson
http://christiano.me/
http://twitter.com/dump/
"Roberto López López" <roberto.lopez@uni.no> Sep 26 04:14PM +0200
--
Hi,
I want to integrate django-modeltranslation into the cmsplugin_news
package. I mean, register some fields in the News class to have a
translation in the DB for each of the settings.LANGUAGES defined.
class NewNewsForm(forms.ModelForm):
class Meta:
model = News
fields = ('title', 'slug', 'excerpt', 'content',
'is_published', 'pub_date')
widgets = {
'content': CKEditorWidget(),
'excerpt': CKEditorWidget(),
}
class NewNewsAdmin(TranslationAdmin):
form = NewNewsForm
class Media:
js = (
'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js',
'modeltranslation/js/tabbed_translation_fields.js',
)
css = {
'screen':
('modeltranslation/css/tabbed_translation_fields.css',),
}
admin.site.register(News, NewsAdmin)
This works ok, if we just take into account django-modeltranslation. But
the django-ckeditor widget is not loading. Using firebug I have seen
that some static files are not loaded, so I tried loading them manually
by modifying the Media class. Anyhow the editor continues not working:
class Media:
js = (
'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js',
'modeltranslation/js/tabbed_translation_fields.js',
'ckeditor/ckeditor/ckeditor.js',
'ckeditor/ckeditor/config.js?t=D26D',
'ckeditor/ckeditor/styles.js?t=D26D',
)
css = {
'all': [cms_static_url(path) for path in (
'css/rte.css',
'css/pages.css',
'css/change_form.css',
'css/jquery.dialog.css',
'css/plugin_editor.css',
)],
'screen':
('modeltranslation/css/tabbed_translation_fields.css',),
}
Does anyone have any idea about how to make the editor work? Thank you
very much!
Regards,
Roberto
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment