Friday, May 31, 2019

Re: TemplateSyntaxError

you do not have ended for loop

On Fri, May 31, 2019 at 7:41 PM anchal agarwal <agarwalanchal72@gmail.com> wrote:
I am creating a simple form in which when a user will select a particular song and press Favorite button a star image will get pop up in front of that song. 
But it is showing TemplateSyntaxError. 
Please correct me where I am wrong
here is my template

<img src="{{ album.album_logo.url }}">

<h1>{{ album.album_title}}</h1>
<h3>{{ album.artist }}</h3>

{% if error_message %}
<p><strong>{{ error_message }}</strong></p>
{% endif %}

<form action="{% url 'music:favorite' albums_id %}" method="post">
{% csrf_token %}
{% for song in album.song_set.all %}
<input type="radio" id="song{{ forloop.counter }}" name="song" value="{{song.id}}">
<label for="song{{ forloop.counter }}">
{{ song.song_title }}
{{% if song.is_favorite %}}
{{% endif %}}
</label><br>
<input type="submit" value="Favorite" >
</form>

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMT%3DisUed7dkD%2BPCgis7bBZSAveti1Wy4WgNSoPA7Dm6kKLO3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA6pdZ-yw6hsS7aOj4czvEY5uCeb5NdYOuUiY50SvGvhyPA5_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: python manage.py makemirations


On Wed, May 29, 2019 at 11:52 PM yavoucko lye <yavouckolye@gmail.com> wrote:
i think you forget to add your application in setting.py

On Wed, May 29, 2019 at 6:19 PM Robert Wahoo <randmwheeler@gmail.com> wrote:

Did you make model changes?

 

From: "django-users@googlegroups.com" <django-users@googlegroups.com> on behalf of sagar ninave <sagarninave@gmail.com>
Reply-To: "django-users@googlegroups.com" <django-users@googlegroups.com>
Date: Wednesday, May 29, 2019 at 2:17 PM
To: Django users <django-users@googlegroups.com>
Subject: python manage.py makemirations

 

i have created new project and i am defining model and doing makemigratins but it is showing no changes detected what is problem i don't understand

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e30905f2-77c4-4b07-9d75-47f9d645a1e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/BL0PR01MB4354271DF09678BD7C241D00F41F0%40BL0PR01MB4354.prod.exchangelabs.com.
For more options, visit https://groups.google.com/d/optout.


--
YAVOUCKO YANGALA Liyé
Pdg de Teranga-Food
Mobile: (+221) 778399425
Fixe: (+221) 338232086
Adresse: Dakar (Cité Keur Gorgui, Lot 31)

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHKysxjOR59q6xAZUFDdACWEMLvorka_1iNO000R4xsL8eWEyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA6pdZ9mw0foaDHOTyhM1wpSBd%2BDZB667m_XjzL6ZpHDMrjwOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

WhiteNoise configuration is incompatible 'Heroku'

hii .. I deployed one Django project on Heroku.The project was running on my local server .. but it doesn't appear good on heroku
i typed : git add . then git commit -am "Implement database connection" then git push heroku master it as result
....
remote: -----> $ python manage.py collectstatic --noinput
remote:        119 static files copied to '/tmp/build_0838ade65ccacd5bcbe3b7ce7f5e5049/staticfiles', 3 unmodified, 286 post-processed.
......
so i go to app directory and typed :
heroku logs -n 200
2019-05-29T13:09:38.000031+00:00 app[web.1]: ImportError:
2019-05-29T13:09:38.000033+00:00 app[web.1]:
2019-05-29T13:09:38.000034+00:00 app[web.1]: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0
2019-05-29T13:09:38.000036+00:00 app[web.1]: This can be fixed by following the upgrade instructions at:
2019-05-29T13:09:38.000037+00:00 app[web.1]: http://whitenoise.evans.io/en/stable/changelog.html#v4-0
and in requirements.txt like :
dj-database-url==0.5.0
Django==2.2.1
django-heroku==0.3.1
django-social-share==1.3.2
gunicorn==19.9.0
Pillow==6.0.0
psycopg2==2.8.2
pytz==2019.1
sqlparse==0.3.0
whitenoise==4.1.2

and this is my settings
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)


i searched but i didn't find solution
thanks in advance

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/97228e9f-1923-4068-92fc-fb9d971a9d56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

WhiteNoise configuration is incompatible Heroku

hii .. I deployed one Django project on Heroku.The project was running on my local server .. but it doesn't appear good on heroku
i typed : git add . then git commit -am "Implement database connection" then git push heroku master it as result
....
remote: -----> $ python manage.py collectstatic --noinput
remote:        119 static files copied to '/tmp/build_0838ade65ccacd5bcbe3b7ce7f5e5049/staticfiles', 3 unmodified, 286 post-processed.
......
so i go to app directory and typed :
heroku logs -n 200
2019-05-29T13:09:38.000031+00:00 app[web.1]: ImportError:
2019-05-29T13:09:38.000033+00:00 app[web.1]:
2019-05-29T13:09:38.000034+00:00 app[web.1]: Your WhiteNoise configuration is incompatible with WhiteNoise v4.0
2019-05-29T13:09:38.000036+00:00 app[web.1]: This can be fixed by following the upgrade instructions at:
2019-05-29T13:09:38.000037+00:00 app[web.1]: http://whitenoise.evans.io/en/stable/changelog.html#v4-0
and in requirements.txt like :
dj-database-url==0.5.0
Django==2.2.1
django-heroku==0.3.1
django-social-share==1.3.2
gunicorn==19.9.0
Pillow==6.0.0
psycopg2==2.8.2
pytz==2019.1
sqlparse==0.3.0
whitenoise==4.1.2
i searched but i didn't find solution
thanks in advance

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/06152e85-1c94-4796-b6c3-ada900a31448%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: SOLUTION FounD : How to restore Models original Properties - Problem in Models column Exclude

Hi Balaji,

Sorry but I don't understand what do you mean with "If we put this code with necessary care".

All I can say is that your code is not thread safe and it may break. How likely is this to happen depends on the usage patterns of your app. How serious it will be depends on the leaked data. Depending on context/constraints it might be a perfectly good enough solution. It's up to you deciding if it's worth fixing it.

That being said, overriding get_exclude works for me: it hides/shows some fields in an admin form depending on some condition (and it's thread safe). It requires django 1.11 or newer and it may be affected by fields and readonly_fields defined in the model admin and in the model form. Please, provide the relevant code, errors etc. if you require further assistance with this.

Another approach would be overriding get_form as shown in the django docs[1].

The point is that neither of those solutions makes changes to shared state (the admin).


HTH


Missatge de Balaji Shetty <balajishetty@gmail.com> del dia dv., 31 de maig 2019 a les 16:42:
Dear Alexis Roda Sir

Thank You very Much.

definitely Race Condition may arise if we do not put code inn critical section. But your suggested approach did not work and i found another alternative which is working fine. If we put this code with necessary care than will it be ok?



On Tue, May 28, 2019 at 8:33 PM Alexis Roda <alexis.roda.villalonga@gmail.com> wrote:
No, it isn't. It's not thread safe.

Changes in shared state in multi-threaded code may lead to race conditions[1].

Depending on your usage it may be very unlikely, but under the right circumstances root may end up having some missing fields in the form or dgp may see fields that it is not intended to see.

Either protect the critical section[2] with some kind of lock or, as I suggested in my previous answer, create non-shared (request local) state.



--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMDYoXa16C5goSadFbSoXQg1-v2zh9vrq%2BAk%3Dkqbq1rk%3DsgSQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Mr. Shetty Balaji S.
Asst. Professor
Department of Information Technology,
SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India
  Mobile: +91-9270696267

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAECSbOvKUK0H2mrt_S%2BhmbVmmeneQXXc%2BR9a%3DFGHE7XOVmOK-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMDYoXb%3D7D99YNQrAos%2BVWaxqxq%2B4z9m_kw3nLPZ28bfrZ-Ujw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Accessing request from form



Don't beat yourself up :)

It's actually slightly cathartic and humbling to do that every once in a great while. ;-)


No-one stops looking and just waits for the answer. You have to assume your own motivation to find it is stronger than everyone else's. It is just good manners to report back so others can stop looking. And it would be bad manners to say you fixed it without revealing the fix.

Yeah, that's a pet peeve of mine so I made sure to include the answer.


Actually, no-one else even looks unless they are particularly interested or they encountered the same problem within recent memory.

Can't say I'm not guilty of doing that as well. I'm a college lecturer in one of my many positions, so I do like the academic challenge that some of these questions pose, even if I haven't needed it myself. However, on more than one occasion I have run into one of the landmines that I've helped out on in the past, and it's saved me a fair amount of time.


Except you. You have helped me more than once in the past and I appreciate it. Thank you. Ten extra points!

Haha, thanks. I'll take the points. I wish I had the time to be more active on this list, but the wife says I have to pay attention to her and the kids, and I'm only allowed to have 2 jobs and 1 hobby. Luckily my current hobby overlaps with Django so here I am.

-James

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWbz4aJLbvLbWOXpgDNKBYpX_zN-WJD95cv2oQfsZqiCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: advantage of angular js with django??

AngularJS is a Single Page App (SPA) framework. You can use Django along with Django Rest API package as the backend to your Angular app. The biggest advantage is you can create, change or have multiple frontend systems on different platforms without having to make changes to your Django backend. For example you can create an AngularJS web app and a React Native app for iOS using the same Django backend.

On Friday, May 31, 2019 at 2:43:25 AM UTC-5, Pradeep Singh wrote:

What are the advantages of using AngularJS with Django?

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/eb63d6f5-5125-4e5f-882d-eaa469529323%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Error - Cannot query "dgp": Must be "Employee" instance. ( dgp is userName and Employee is Model Name )

HI

I get the error when i enter the records of Profile Model and save it. i get GUI for model.

I created group and given access of both model to dgp user.


ValueError at /admin/newapp/profile1/

  dgp is my user name and Employee is the model name.

Can anybody help me in this regards

Employee Refers to User Model ( Foreign Key Relation)
Profile Model Refers to Employee Model ( Foreign Key Relation)

Models.py



class Employee(models.Model):
    user = models.OneToOneField(User,  on_delete=models.CASCADE,primary_key="True")
    department = models.CharField(max_length=100)
    level = models.IntegerField()
    parentlevel = models.IntegerField()
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)


   
    def __str__(self):
        return '%s' % (self.user)




class Profile(models.Model):

    State = models.CharField(max_length=100,default="MH")
    District = models.CharField(max_length=100,default="Parbhani")
   
    user = models.ForeignKey(Employee, on_delete=models.CASCADE)
    InwardNumber = models.CharField(max_length=100,default="2019/3")


admin.py

class Profile1Admin(admin.ModelAdmin):

  def get_form(self, request, obj=None, **kwargs):

        username = request.user.username
   
        print("----- Inside get_exclude Method--------")
        print (username)

        if username == 'dgp': # if user is not a superuser

LOGIC 1 --------
        elif username == 'inumber':
           
LOGIC 2 ----
print("-----  ***********  Inside DGP LOGIN ***-------")
            self.fields = self.inward_fields
        else:
            Logic 3 --     

        return super(Profile1Admin, self).get_form(request, obj, **kwargs)

Can Anyone please help me in this regards.


--
Mr. Shetty Balaji S.
Asst. Professor
Department of Information Technology,
SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India
  Mobile: +91-9270696267

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAECSbOvG66UTQFMZHemVrfJY0zdoteyfFQ3NK6_6vxqAgy2OyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: SOLUTION FounD : How to restore Models original Properties - Problem in Models column Exclude

Dear Alexis Roda Sir

Thank You very Much.

definitely Race Condition may arise if we do not put code inn critical section. But your suggested approach did not work and i found another alternative which is working fine. If we put this code with necessary care than will it be ok?



On Tue, May 28, 2019 at 8:33 PM Alexis Roda <alexis.roda.villalonga@gmail.com> wrote:
No, it isn't. It's not thread safe.

Changes in shared state in multi-threaded code may lead to race conditions[1].

Depending on your usage it may be very unlikely, but under the right circumstances root may end up having some missing fields in the form or dgp may see fields that it is not intended to see.

Either protect the critical section[2] with some kind of lock or, as I suggested in my previous answer, create non-shared (request local) state.



--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMDYoXa16C5goSadFbSoXQg1-v2zh9vrq%2BAk%3Dkqbq1rk%3DsgSQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Mr. Shetty Balaji S.
Asst. Professor
Department of Information Technology,
SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India
  Mobile: +91-9270696267

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAECSbOvKUK0H2mrt_S%2BhmbVmmeneQXXc%2BR9a%3DFGHE7XOVmOK-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

TemplateSyntaxError

I am creating a simple form in which when a user will select a particular song and press Favorite button a star image will get pop up in front of that song. 
But it is showing TemplateSyntaxError. 
Please correct me where I am wrong
here is my template

<img src="{{ album.album_logo.url }}">

<h1>{{ album.album_title}}</h1>
<h3>{{ album.artist }}</h3>

{% if error_message %}
<p><strong>{{ error_message }}</strong></p>
{% endif %}

<form action="{% url 'music:favorite' albums_id %}" method="post">
{% csrf_token %}
{% for song in album.song_set.all %}
<input type="radio" id="song{{ forloop.counter }}" name="song" value="{{song.id}}">
<label for="song{{ forloop.counter }}">
{{ song.song_title }}
{{% if song.is_favorite %}}
{{% endif %}}
</label><br>
<input type="submit" value="Favorite" >
</form>

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMT%3DisUed7dkD%2BPCgis7bBZSAveti1Wy4WgNSoPA7Dm6kKLO3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: state_operations while adding 2 fields

> Am 31.05.2019 um 13:15 schrieb Axel Rau <Axel.Rau@chaos1.de>:
>
> is it posible to bundle 2 AddField migrations with one RunPython?
> How should I arrange the state_operations in this case?
>
> The following migration does not work.

It seems, the variant below does the job.
However there is no state operation for undoing the migration.

Axel

- - -
class Migration(migrations.Migration):

dependencies = [
('erdb', '0007_add_customer_group'),
]

operations = [
migrations.RunPython(forwards_func, reverse_code=reverse_func),
migrations.SeparateDatabaseAndState(
database_operations=[],
state_operations=[
migrations.AddField(
model_name='account',
name='is_account_admin',
field=models.BooleanField(
db_column='is_account_admin',
default=False),
),
migrations.AddField(
model_name='account',
name='self_admin_only',
field=models.BooleanField(
db_column='self_admin_only',
default=False),
),
],
)
]
- - -
---
PGP-Key:29E99DD6 ☀ computing @ chaos claudius

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8FA10E29-8B1E-4A60-A483-DB8104C36FDD%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.

Re: How to use permissions on a CreateView class?

Thanks guys!
The problem was the permission mixins on my class...

Thanks!

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash


On Thu, May 30, 2019 at 8:26 PM Andrew C. <andreke12346@gmail.com> wrote:
Sorry. Info ISN'T saved on private browser

On Thu, May 30, 2019 at 7:25 PM Andrew C. <andreke12346@gmail.com> wrote:
Try clearing your browser history and info. Should also test in Incognito or Private browser so info is saved. I have a suspicion that your browser is saving login info and you're just not realizing this.

On Tue, May 28, 2019 at 5:54 PM Fellipe Henrique <fellipeh@gmail.com> wrote:
Hi Jim, 

Tried that, as you can see on my code, but not working.. when user type the url, still see the template..

Any suggestions?

Regards,

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash


On Tue, May 28, 2019 at 2:36 PM Jim Illback <subaru_87@hotmail.com> wrote:
I think you can also add to your class (right under your template_name… for example) this statement:

	permission_required = 'appname.permission_name'
This will limit to logged on users (as below), and also to users who possess this permission.
Jim


On May 28, 2019, at 9:55 AM, Joe Reitman <jreitman28@gmail.com> wrote:

Fellipe,

Here is an example of decorating class based views from the documentation:

from django.contrib.auth.decorators import login_required  from django.utils.decorators import method_decorator  from django.views.generic import TemplateView    class ProtectedView(TemplateView):      template_name = 'secret.html'        @method_decorator(login_required)      def dispatch(self, *args, **kwargs):          return super().dispatch(*args, **kwargs)

On Tuesday, May 28, 2019 at 6:54:38 AM UTC-5, Fellipe Henrique wrote:
Hello,

I have these class, based on CreateView class... and I only want allow user with these permissions to add record...

class ClienteCreateView(ERPbrViewMixin, CreateView):
template_name = 'cadastro/cliente/form.html'
permission_required = ('cliente.can_open', 'cliente.can_edit', 'cliente.can_add')
model = Cliente
form_class = ClienteForm
But, not working... user without these permission, when type the url show the form...

Any tips how to do that?

Cheers!


T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/060a2c59-bf39-456c-a686-bf6ba104e1f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/B5E64E45-C1C3-455F-AEC7-167852FE17C7%40hotmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1jwZHCR%3Dn2FMcdPdWsAOKG7wQRhqKBb4is58P61dGCi8_Eqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJVmkN%3D-Js0_CKEeqZ0YP0eC_zvWPVZXP5v_2KC4MmCoCmko0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1jwZF6iAunSMbhtCpAUq6%2BPfzMNLWMwQfMRo0%3DcQ1A0gNvSw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: how i can become django master ?


On Fri, May 31, 2019 at 12:10 PM soroush safari <mr.safarii1992@gmail.com> wrote:
hello guys. where I need to start reading Django and her reference?

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/46308830-4049-4f9b-8b29-fce212c2af63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGuvt90UsjwnwHAuit0sTG3F126S31-Y0BpRiQ6H1MYh_Do_aQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: how i can become django master ?

Olá, bom dia, creio que você está perguntando como pode começar a se familiarizar, e se integrar sobre a documentação, você pode começar uma trilha no próprio site do djago, que vai te trazer alguns conhecimentos iniciais, este é o link:  https://docs.djangoproject.com/en/2.2/intro/tutorial01/

Livre de vírus. www.avast.com.

Em sex, 31 de mai de 2019 às 08:10, soroush safari <mr.safarii1992@gmail.com> escreveu:
hello guys. where I need to start reading Django and her reference?

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/46308830-4049-4f9b-8b29-fce212c2af63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
                                                  

PEDRO HENRIQUE
Cargo: Auxiliar de Contabilidade
Fones: (83) 3521-2518 e (83) 3521-1072

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPcz%2BA5giOz0Yc2STHj17UOWGxhcmQ3uHfJ5S6Mvv7KY6%3DouFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

state_operations while adding 2 fields

Hi all,

is it posible to bundle 2 AddField migrations with one RunPython?
How should I arrange the state_operations in this case?

The following migration does not work.

Please advice,
Axel

def forwards_func(apps, schema_editor):
with connections['erdb_migration'].cursor() as cursor:
cursor.execute('Alter TABLE account \
ADD column is_account_admin boolean \
DEFAULT false')
cursor.execute('Alter TABLE account \
ADD column self_admin_only boolean \
DEFAULT false')

def reverse_func(apps, schema_editor):
with connections['erdb_migration'].cursor() as cursor:
cursor.execute('Alter TABLE account \
DROP column is_account_admin')
cursor.execute('Alter TABLE account \
DROP column self_admin_only')


class Migration(migrations.Migration):

dependencies = [
('erdb', '0007_add_customer_group'),
]


operations = [
migrations.RunPython(forwards_func, reverse_code=reverse_func),
]

state_operations=[(
migrations.AddField(
model_name='account',
name='is_account_admin',
field=models.BooleanField(
db_column='is_account_admin',
default=False),
),
migrations.RemoveField(
model_name='account',
name='is_account_admin'
)),(
migrations.AddField(
model_name='account',
name='self_admin_only',
field=models.BooleanField(
db_column='self_admin_only',
default=False),
),
migrations.RemoveField(
model_name='account',
name='self_admin_only'
))

],

---
PGP-Key:29E99DD6 ☀ computing @ chaos claudius

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/C379B063-80E2-47ED-BBB0-7E90077E2500%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.

Re: POINT OF SALE SYSTEM

yes of course

On Fri, May 31, 2019 at 9:10 AM yavoucko lye <yavouckolye@gmail.com> wrote:
yes of 

On Thu, May 30, 2019 at 11:36 AM Muhammed Bilal <mmbh93@gmail.com> wrote:

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/319b2899-cb41-474b-80c9-25aeab6b50d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
YAVOUCKO YANGALA Liyé
Pdg de Teranga-Food
Mobile: (+221) 778399425
Fixe: (+221) 338232086
Adresse: Dakar (Cité Keur Gorgui, Lot 31)



--
YAVOUCKO YANGALA Liyé
Pdg de Teranga-Food
Mobile: (+221) 778399425
Fixe: (+221) 338232086
Adresse: Dakar (Cité Keur Gorgui, Lot 31)

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHKysxib5vcJ0yhwT16UNKH2A7bU5z4HqytjrSkKgs788Mafng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: POINT OF SALE SYSTEM

yes of 

On Thu, May 30, 2019 at 11:36 AM Muhammed Bilal <mmbh93@gmail.com> wrote:

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/319b2899-cb41-474b-80c9-25aeab6b50d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
YAVOUCKO YANGALA Liyé
Pdg de Teranga-Food
Mobile: (+221) 778399425
Fixe: (+221) 338232086
Adresse: Dakar (Cité Keur Gorgui, Lot 31)

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHKysxj96NHE55SbuWEZff2XsxdorKZ8Y1fGp2sTMy4X4zjCmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.