These are chat archives for mirumee/saleor

3rd
Aug 2018
Joshua Fialkoff
@jfialkoff
Aug 03 2018 11:37
Thanks @NyanKiyoshi . I've already been exploring that file. It's not super clear to me how to add additional fields. Is there any documentation on that or, if not, can you give me some pointers. I'm finding that file a little confusing.
NyanKiyoshi
@NyanKiyoshi
Aug 03 2018 12:11
There would be two ways... One would be to create an independent form; another would be to force Saleor to not exclude given fields from the i18n address form no matter what, which would resume to do this (where is_private is set in the Address model); getting dirty
Index: saleor/account/i18n.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- saleor/account/i18n.py    (revision 89489fa751617fdb1e60f508ef6eb05931398c5b)
+++ saleor/account/i18n.py    (date 1533298072000)
@@ -75,6 +75,8 @@

 class AddressForm(forms.ModelForm):

+    BASE_FIELDS = ['is_private']
+
     AUTOCOMPLETE_MAPPING = [
         ('first_name', 'given-name'),
         ('last_name', 'family-name'),
@@ -114,7 +116,9 @@
             'country_area': pgettext_lazy(
                 'Country area', 'State or province'),
             'phone': pgettext_lazy(
-                'Phone number', 'Phone number')}
+                'Phone number', 'Phone number'),
+            'is_private': pgettext_lazy(
+                '....', 'Is private')}

     phone = PossiblePhoneNumberFormField(
         widget=PhonePrefixWidget, required=False)
@@ -148,7 +152,8 @@
         ('postal_code', ['postal_code']),
         ('city', ['city']),
         ('sorting_code', []),
-        ('country_code', ['country'])]
+        ('country_code', ['country'])] + [
+            (field_name, [field_name]) for field_name in AddressForm.BASE_FIELDS]

     class Meta:
         model = Address
@@ -208,6 +213,7 @@
         return bound_fields

     if fields_order:
+        fields_order.append(AddressForm.BASE_FIELDS)
         return [_convert_to_bound_fields(form_instance, line)
                 for line in fields_order]
Kuntal
@Kuntal-KK
Aug 03 2018 12:41
how can I add my own css, js file in server? In local it is working but when pushing to heroku, custom css is not coming.
Joshua Fialkoff
@jfialkoff
Aug 03 2018 13:13
Thanks so much @NyanKiyoshi !

hello people!,
I'm playing around with saleor
followed the https://saleor.readthedocs.io/en/latest/gettingstarted/installation-linux.html
the application runs smooth


export SECRET_KEY=secret
export AWS_ACCESS_KEY_ID=<secret>
export AWS_SECRET_ACCESS_KEY=<secret>
export AWS_LOCATION=us-east-2
export AWS_MEDIA_BUCKET_NAME=static.site.org
export AWS_STORAGE_BUCKET_NAME=media.site.org
export STATIC_URL=https://media.site.org.s3.amazonaws.com/us-east-2/
export MEDIA_URL=https://media.site.org.s3.amazonaws.com/us-east-2/

now im trying to use CDN, the static files are uploaded s3

DEBUG=False python manage.py runserver --nostatic

the page is searching the assets at:

STATIC_URL/storefront.72bb718d745444bc6aad.js                  (not found 404)
STATIC_URL/assets/storefront.72bb718d745444bc6aad.js    (in s3 I can see the file is located at)
NyanKiyoshi
@NyanKiyoshi
Aug 03 2018 18:18
You mean it is requesting STATIC_URL/storefront.72bb718d745444bc6aad.js exactly like this, instead of https://media.site.org.s3.amazonaws.com/us-east-2/storefront.72bb718d745444bc6aad.js?
its missing the /assets/ prefix
its looking at https://media.site.org.s3.amazonaws.com/us-east-2/storefront.72bb718d745444bc6aad.js
should be https://media.site.org.s3.amazonaws.com/us-east-2/assets/storefront.72bb718d745444bc6aad.js
NyanKiyoshi
@NyanKiyoshi
Aug 03 2018 18:21
You should supply https://media.site.org.s3.amazonaws.com/us-east-2/assets instead, or I'm missing something
the files are uploaded using python manage.py collectstatic
you mean STATIC_URL=https://media.site.org.s3.amazonaws.com/us-east-2/assets/
that was the error visiting the /
if i visit /dashboard/
the /dashboard/prefix would be missing...
NyanKiyoshi
@NyanKiyoshi
Aug 03 2018 18:24
Yes, setting STATIC_URL=https://media.site.org.s3.amazonaws.com/us-east-2/assets/ and then recompile the assets as it will update the generated config in webpack-bundle.json
ok, I'll give it a try
thanks!
NyanKiyoshi
@NyanKiyoshi
Aug 03 2018 18:27
I'm not 100% sure if it is gonna conflict or not with the static files that are not under the assets folder (e.g.: the placeholder image)
Keep me updated on that
NyanKiyoshi
@NyanKiyoshi
Aug 03 2018 19:00
Opened #2515 for that